diff --git a/draw.cpp b/draw.cpp index a2c9c15..95d94f4 100644 --- a/draw.cpp +++ b/draw.cpp @@ -97,13 +97,13 @@ void GraphicsWindow::ClearNonexistentSelectionItems(void) { // Toggle the selection state of the indicated item: if it was selected then // un-select it, and if it wasn't then select it. //----------------------------------------------------------------------------- -void GraphicsWindow::ToggleSelectionStateOf(hEntity he) { +void GraphicsWindow::ToggleSelectionStateOf(hEntity he, bool batch) { Selection stog; ZERO(&stog); stog.entity = he; - ToggleSelectionStateOf(&stog); + ToggleSelectionStateOf(&stog, batch); } -void GraphicsWindow::ToggleSelectionStateOf(Selection *stog) { +void GraphicsWindow::ToggleSelectionStateOf(Selection *stog, bool batch) { if(stog->IsEmpty()) return; Selection *s; @@ -121,7 +121,7 @@ void GraphicsWindow::ToggleSelectionStateOf(Selection *stog) { // If two points are coincident, then it's impossible to hover one of // them. But make sure to deselect both, to avoid mysterious seeming // inability to deselect if the bottom one did somehow get selected. - if(wasSelected && stog->entity.v) { + if(wasSelected && stog->entity.v && !batch) { Entity *e = SK.GetEntity(stog->entity); if(e->IsPoint()) { Vector ep = e->PointGetNum(); @@ -184,7 +184,7 @@ void GraphicsWindow::SelectByMarquee(void) { if(pp.x >= xmin && pp.x <= xmax && pp.y >= ymin && pp.y <= ymax) { - ToggleSelectionStateOf(e->h); + ToggleSelectionStateOf(e->h, true); } } else { // Use the 3d bounding box test routines, to avoid duplication; @@ -206,7 +206,7 @@ void GraphicsWindow::SelectByMarquee(void) { !ptA.OutsideAndNotOn(ptMax, ptMin) || !ptB.OutsideAndNotOn(ptMax, ptMin)) { - ToggleSelectionStateOf(e->h); + ToggleSelectionStateOf(e->h, true); break; } } diff --git a/graphicswin.cpp b/graphicswin.cpp index 94b8820..4b198f4 100644 --- a/graphicswin.cpp +++ b/graphicswin.cpp @@ -631,7 +631,7 @@ void GraphicsWindow::MenuEdit(int id) { if(e->IsFace() || e->IsDistance()) continue; if(!e->IsVisible()) continue; - SS.GW.ToggleSelectionStateOf(e->h); + SS.GW.ToggleSelectionStateOf(e->h, true); } InvalidateGraphics(); SS.later.showTW = true; @@ -673,7 +673,7 @@ void GraphicsWindow::MenuEdit(int id) { } } if(onChain && !alreadySelected) { - SS.GW.ToggleSelectionStateOf(e->h); + SS.GW.ToggleSelectionStateOf(e->h, true); newlySelected++; didSomething = true; } diff --git a/srf/curve.cpp b/srf/curve.cpp index 058402a..d2e0576 100644 --- a/srf/curve.cpp +++ b/srf/curve.cpp @@ -793,7 +793,9 @@ SSurface *SCurve::GetSurfaceB(SShell *a, SShell *b) { // stuff in the Booleans. So remove them. //----------------------------------------------------------------------------- void SCurve::RemoveShortSegments(SSurface *srfA, SSurface *srfB) { - if(pts.n < 2) return; + // Three, not two; curves are pwl'd to at least two edges (three points) + // even if not necessary, to avoid square holes. + if(pts.n <= 3) return; pts.ClearTags(); Vector prev = pts.elem[0].p; diff --git a/srf/ratpoly.cpp b/srf/ratpoly.cpp index f32f86b..51839a6 100644 --- a/srf/ratpoly.cpp +++ b/srf/ratpoly.cpp @@ -266,7 +266,15 @@ void SBezier::MakePwlInto(List *l, double chordTol) { chordTol = SS.ChordTolMm(); } l->Add(&(ctrl[0])); - MakePwlWorker(l, 0.0, 1.0, chordTol); + if(deg == 1) { + l->Add(&(ctrl[1])); + } else { + // Never do fewer than one intermediate point; people seem to get + // unhappy when their circles turn into squares, but maybe less + // unhappy with octagons. + MakePwlWorker(l, 0.0, 0.5, chordTol); + MakePwlWorker(l, 0.5, 1.0, chordTol); + } } void SBezier::MakePwlWorker(List *l, double ta, double tb, double chordTol) diff --git a/ui.h b/ui.h index 6360288..74327fd 100644 --- a/ui.h +++ b/ui.h @@ -453,8 +453,8 @@ public: int n; } gs; void GroupSelection(void); - void ToggleSelectionStateOf(hEntity he); - void ToggleSelectionStateOf(Selection *s); + void ToggleSelectionStateOf(hEntity he, bool batch=false); + void ToggleSelectionStateOf(Selection *s, bool batch=false); void SelectByMarquee(void); void ClearSuper(void); diff --git a/wishlist.txt b/wishlist.txt index 8c32c60..c3b8398 100644 --- a/wishlist.txt +++ b/wishlist.txt @@ -2,6 +2,7 @@ copy and paste background image associative entities from solid model, as a special group +n*log(n) intersection finding ----- some kind of import