Add ability to relax the constraints, applying only

point-coincident constraints and the entity- or group-generated
constraints. Also fix a bug where a dragged point was not released
when the mouse pointer left the window.

[git-p4: depot-paths = "//depot/solvespace/": change = 2045]
This commit is contained in:
Jonathan Westhues 2009-10-01 03:22:56 -08:00
parent 33dfff2a78
commit 2e9e0da71f
7 changed files with 31 additions and 0 deletions

View File

@ -92,6 +92,7 @@ const SolveSpace::SaveTable SolveSpace::SAVED[] = {
{ 'g', "Group.predef.negateV", 'b', &(SS.sv.g.predef.negateV) },
{ 'g', "Group.visible", 'b', &(SS.sv.g.visible) },
{ 'g', "Group.suppress", 'b', &(SS.sv.g.suppress) },
{ 'g', "Group.relaxConstraints", 'b', &(SS.sv.g.relaxConstraints) },
{ 'g', "Group.remap", 'M', &(SS.sv.g.remap) },
{ 'g', "Group.impFile", 'P', &(SS.sv.g.impFile) },
{ 'g', "Group.impFileRel", 'P', &(SS.sv.g.impFileRel) },

View File

@ -910,6 +910,9 @@ void GraphicsWindow::MouseLeave(void) {
toolbarHovered = 0;
PaintGraphics();
}
if(pending.operation == DRAGGING_POINT) {
ClearPending();
}
}
void GraphicsWindow::SpaceNavigatorMoved(double tx, double ty, double tz,

View File

@ -101,6 +101,7 @@ public:
hGroup opB;
bool visible;
bool suppress;
bool relaxConstraints;
bool clean;
bool vvMeshClean;

View File

@ -312,6 +312,13 @@ void System::WriteEquationsExceptFor(hConstraint hc, Group *g) {
if(c->group.v != g->h.v) continue;
if(c->h.v == hc.v) continue;
if(g->relaxConstraints && c->type != Constraint::POINTS_COINCIDENT) {
// When the constraints are relaxed, we keep only the point-
// coincident constraints, and the constraints generated by
// the entities and groups.
continue;
}
c->Generate(&eq);
}
// And the equations from entities

View File

@ -252,6 +252,15 @@ void TextWindow::ScreenChangeSuppress(int link, DWORD v) {
SS.GenerateAll();
SS.GW.ClearSuper();
}
void TextWindow::ScreenChangeRelaxConstraints(int link, DWORD v) {
SS.UndoRemember();
Group *g = SK.GetGroup(SS.TW.shown.group);
g->relaxConstraints = !(g->relaxConstraints);
SS.MarkGroupDirty(g->h);
SS.later.generateAll = true;
SS.later.showTW = true;
}
void TextWindow::ScreenChangeRightLeftHanded(int link, DWORD v) {
SS.UndoRemember();
@ -448,6 +457,14 @@ void TextWindow::ShowGroupInfo(void) {
(!sup ? "" : "no"), (!sup ? "no" : ""));
}
bool relax = g->relaxConstraints;
Printf(true, "%FtSOLVING%E %Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E",
&TextWindow::ScreenChangeRelaxConstraints,
(!relax ? "" : "with all constraints"),
(!relax ? "with all constraints" : ""),
&TextWindow::ScreenChangeRelaxConstraints,
(relax ? "" : "no"), (relax ? "no" : ""));
if(g->type == Group::EXTRUDE ||
g->type == Group::LATHE ||
g->type == Group::SWEEP ||

1
ui.h
View File

@ -152,6 +152,7 @@ public:
static void ScreenChangeMeshCombine(int link, DWORD v);
static void ScreenChangeMeshOrExact(int link, DWORD v);
static void ScreenChangeSuppress(int link, DWORD v);
static void ScreenChangeRelaxConstraints(int link, DWORD v);
static void ScreenChangeRightLeftHanded(int link, DWORD v);
static void ScreenChangeHelixParameter(int link, DWORD v);
static void ScreenColor(int link, DWORD v);

View File

@ -3,6 +3,7 @@ multi-drag
-----
some kind of import
filled contours for export
wireframe export
faster triangulation
interpolating splines