From 4eed7693be2ae62ae3bc52f14aad90796cd700b9 Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Sat, 10 May 2008 18:57:47 -0800 Subject: [PATCH] Little changes, more pwls in a circle, and make "same orientation" constraints work mod 180 degrees, so that it snaps to however the workplane was drawn (more vertical vs. more horizontal). [git-p4: depot-paths = "//depot/solvespace/": change = 1714] --- constraint.cpp | 10 +++++++++- entity.cpp | 2 +- graphicswin.cpp | 3 ++- polygon.h | 1 + sketch.cpp | 2 +- ui.h | 3 ++- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/constraint.cpp b/constraint.cpp index b3345d92..5ed2fc2a 100644 --- a/constraint.cpp +++ b/constraint.cpp @@ -564,7 +564,15 @@ void Constraint::Generate(IdList *l) { AddEq(l, VectorsParallel(0, an, bn), 0); AddEq(l, VectorsParallel(1, an, bn), 1); - AddEq(l, au.Dot(bv), 2); + Expr *d1 = au.Dot(bv); + Expr *d2 = au.Dot(bu); + // Allow either orientation for the coordinate system, depending + // on how it was drawn. + if(fabs(d1->Eval()) < fabs(d2->Eval())) { + AddEq(l, d1, 2); + } else { + AddEq(l, d2, 2); + } break; } diff --git a/entity.cpp b/entity.cpp index 447fd9f6..09ea21d5 100644 --- a/entity.cpp +++ b/entity.cpp @@ -558,7 +558,7 @@ void Entity::DrawOrGetDistance(int order) { Vector center = SS.GetEntity(point[0])->PointGetNum(); Vector u = q.RotationU(), v = q.RotationV(); - int i, c = 20; + int i, c = 40; Vector prev = u.ScaledBy(r).Plus(center); for(i = 1; i <= c; i++) { double phi = (2*PI*i)/c; diff --git a/graphicswin.cpp b/graphicswin.cpp index 0261940e..937f66c2 100644 --- a/graphicswin.cpp +++ b/graphicswin.cpp @@ -39,7 +39,8 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = { { 1, "Dimensions in &Millimeters", MNU_UNITS_MM, 0, mView }, { 0, "&Group", 0, 0, NULL }, -{ 1, "New &Drawing Group\tShift+Ctrl+D", MNU_GROUP_DRAWING, 'D'|S|C,mGrp }, +{ 1, "New &Drawing in 3d\tShift+Ctrl+D", MNU_GROUP_3D, 'D'|S|C, mGrp }, +{ 1, "New Drawing in Workplane\tShift+Ctrl+W",MNU_GROUP_WRKPL, 'W'|S|C, mGrp }, { 1, NULL, 0, NULL }, { 1, "New Step and Repeat &Translating", 0, 0, NULL }, { 1, "New Step and Repeat &Rotating", 0, 0, NULL }, diff --git a/polygon.h b/polygon.h index 25d5651e..47eb245a 100644 --- a/polygon.h +++ b/polygon.h @@ -43,6 +43,7 @@ class SEdgeList { public: SList l; + void InsertEdgeBreaking(SEdge *e); bool AssemblePolygon(SPolygon *dest, SEdge *errorAt); }; diff --git a/sketch.cpp b/sketch.cpp index d2ddbcba..7c1c4e0b 100644 --- a/sketch.cpp +++ b/sketch.cpp @@ -23,7 +23,7 @@ void Group::MenuGroup(int id) { g.visible = true; switch(id) { - case GraphicsWindow::MNU_GROUP_DRAWING: + case GraphicsWindow::MNU_GROUP_3D: g.type = DRAWING; g.name.strcpy("drawing"); break; diff --git a/ui.h b/ui.h index ffc47879..4760870f 100644 --- a/ui.h +++ b/ui.h @@ -109,7 +109,8 @@ public: MNU_CUBIC, MNU_CONSTRUCTION, // Group - MNU_GROUP_DRAWING, + MNU_GROUP_3D, + MNU_GROUP_WRKPL, MNU_GROUP_EXTRUDE, // Constrain MNU_DISTANCE_DIA,