A great renaming. 2d coordinate systems are now called workplanes,
and the associated entities are now just points. [git-p4: depot-paths = "//depot/solvespace/": change = 1690]solver
parent
5bc3738ec4
commit
15476d4732
|
@ -32,8 +32,8 @@ void Constraint::MenuConstrain(int id) {
|
|||
} else if(gs.lineSegments == 1 && gs.n == 1) {
|
||||
c.type = PT_PT_DISTANCE;
|
||||
Entity *e = SS.GetEntity(gs.entity[0]);
|
||||
c.ptA = e->assoc[0];
|
||||
c.ptB = e->assoc[1];
|
||||
c.ptA = e->point[0];
|
||||
c.ptB = e->point[1];
|
||||
} else {
|
||||
Error("Bad selection for distance / diameter constraint.");
|
||||
return;
|
||||
|
@ -78,8 +78,8 @@ void Constraint::MenuConstrain(int id) {
|
|||
if(gs.lineSegments == 1 && gs.n == 1) {
|
||||
c.entityA = gs.entity[0];
|
||||
Entity *e = SS.GetEntity(c.entityA);
|
||||
ha = e->assoc[0];
|
||||
hb = e->assoc[1];
|
||||
ha = e->point[0];
|
||||
hb = e->point[1];
|
||||
} else if(gs.points == 2 && gs.n == 2) {
|
||||
ha = c.ptA = gs.point[0];
|
||||
hb = c.ptB = gs.point[1];
|
||||
|
@ -89,18 +89,18 @@ void Constraint::MenuConstrain(int id) {
|
|||
}
|
||||
Entity *ea = SS.GetEntity(ha);
|
||||
Entity *eb = SS.GetEntity(hb);
|
||||
if(ea->csys.v == Entity::NO_CSYS.v &&
|
||||
eb->csys.v == Entity::NO_CSYS.v)
|
||||
if(ea->workplane.v == Entity::FREE_IN_3D.v &&
|
||||
eb->workplane.v == Entity::FREE_IN_3D.v)
|
||||
{
|
||||
Error("Horizontal/vertical constraint applies only to "
|
||||
"entities drawn in a 2d coordinate system.");
|
||||
return;
|
||||
}
|
||||
if(eb->csys.v == SS.GW.activeCsys.v) {
|
||||
// We are constraining two points in two different csyss; so
|
||||
if(eb->workplane.v == SS.GW.activeWorkplane.v) {
|
||||
// We are constraining two points in two different wrkpls; so
|
||||
// we have two choices for the definitons of the coordinate
|
||||
// directions. ptA's gets chosen, so make sure that's the
|
||||
// active csys.
|
||||
// active workplane.
|
||||
hEntity t = c.ptA;
|
||||
c.ptA = c.ptB;
|
||||
c.ptB = t;
|
||||
|
@ -133,14 +133,14 @@ Expr *Constraint::Distance(hEntity hpa, hEntity hpb) {
|
|||
|
||||
if(pa->type == Entity::POINT_IN_2D &&
|
||||
pb->type == Entity::POINT_IN_2D &&
|
||||
pa->csys.v == pb->csys.v)
|
||||
pa->workplane.v == pb->workplane.v)
|
||||
{
|
||||
// A nice case; they are both in the same 2d csys, so I can write
|
||||
// A nice case; they are both in the same workplane, so I can write
|
||||
// the equation in terms of the basis vectors in that csys.
|
||||
Expr *du = Expr::FromParam(pa->param.h[0])->Minus(
|
||||
Expr::FromParam(pb->param.h[0]));
|
||||
Expr *dv = Expr::FromParam(pa->param.h[1])->Minus(
|
||||
Expr::FromParam(pb->param.h[1]));
|
||||
Expr *du = Expr::FromParam(pa->param[0])->Minus(
|
||||
Expr::FromParam(pb->param[0]));
|
||||
Expr *dv = Expr::FromParam(pa->param[1])->Minus(
|
||||
Expr::FromParam(pb->param[1]));
|
||||
|
||||
return ((du->Square())->Plus(dv->Square()))->Sqrt();
|
||||
}
|
||||
|
@ -188,8 +188,8 @@ void Constraint::Generate(IdList<Equation,hEquation> *l) {
|
|||
case EQUAL_LENGTH_LINES: {
|
||||
Entity *a = SS.GetEntity(entityA);
|
||||
Entity *b = SS.GetEntity(entityB);
|
||||
AddEq(l, Distance(a->assoc[0], a->assoc[1])->Minus(
|
||||
Distance(b->assoc[0], b->assoc[1])), 0);
|
||||
AddEq(l, Distance(a->point[0], a->point[1])->Minus(
|
||||
Distance(b->point[0], b->point[1])), 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -210,26 +210,26 @@ void Constraint::Generate(IdList<Equation,hEquation> *l) {
|
|||
AddEq(l, eab.y, 1);
|
||||
AddEq(l, eab.z, 2);
|
||||
} else if(!(a->IsPointIn3d() || b->IsPointIn3d()) &&
|
||||
(a->csys.v == b->csys.v))
|
||||
(a->workplane.v == b->workplane.v))
|
||||
{
|
||||
// Both in same csys, nice.
|
||||
AddEq(l, Expr::FromParam(a->param.h[0])->Minus(
|
||||
Expr::FromParam(b->param.h[0])), 0);
|
||||
AddEq(l, Expr::FromParam(a->param.h[1])->Minus(
|
||||
Expr::FromParam(b->param.h[1])), 1);
|
||||
// Both in same workplane, nice.
|
||||
AddEq(l, Expr::FromParam(a->param[0])->Minus(
|
||||
Expr::FromParam(b->param[0])), 0);
|
||||
AddEq(l, Expr::FromParam(a->param[1])->Minus(
|
||||
Expr::FromParam(b->param[1])), 1);
|
||||
} else {
|
||||
// Either two 2 DOF points in different planes, or one
|
||||
// 3 DOF point and one 2 DOF point. Either way, write two
|
||||
// equations on the projection of a into b's plane.
|
||||
ExprVector p3;
|
||||
p3 = a->PointGetExprs();
|
||||
Entity *csy = SS.GetEntity(b->csys);
|
||||
ExprVector offset = csy->Csys2dGetOffsetExprs();
|
||||
Entity *w = SS.GetEntity(b->workplane);
|
||||
ExprVector offset = w->WorkplaneGetOffsetExprs();
|
||||
p3 = p3.Minus(offset);
|
||||
ExprVector u, v;
|
||||
csy->Csys2dGetBasisExprs(&u, &v);
|
||||
AddEq(l, Expr::FromParam(b->param.h[0])->Minus(p3.Dot(u)), 0);
|
||||
AddEq(l, Expr::FromParam(b->param.h[1])->Minus(p3.Dot(v)), 1);
|
||||
w->WorkplaneGetBasisExprs(&u, &v);
|
||||
AddEq(l, Expr::FromParam(b->param[0])->Minus(p3.Dot(u)), 0);
|
||||
AddEq(l, Expr::FromParam(b->param[1])->Minus(p3.Dot(v)), 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -248,28 +248,28 @@ void Constraint::Generate(IdList<Equation,hEquation> *l) {
|
|||
hEntity ha, hb;
|
||||
if(entityA.v) {
|
||||
Entity *e = SS.GetEntity(entityA);
|
||||
ha = e->assoc[0];
|
||||
hb = e->assoc[1];
|
||||
ha = e->point[0];
|
||||
hb = e->point[1];
|
||||
} else {
|
||||
ha = ptA;
|
||||
hb = ptB;
|
||||
}
|
||||
Entity *a = SS.GetEntity(ha);
|
||||
Entity *b = SS.GetEntity(hb);
|
||||
if(a->csys.v == Entity::NO_CSYS.v) {
|
||||
if(a->workplane.v == Entity::FREE_IN_3D.v) {
|
||||
Entity *t = a;
|
||||
a = b;
|
||||
b = t;
|
||||
}
|
||||
|
||||
if(a->csys.v == b->csys.v) {
|
||||
if(a->workplane.v == b->workplane.v) {
|
||||
int i = (type == HORIZONTAL) ? 1 : 0;
|
||||
AddEq(l, Expr::FromParam(a->param.h[i])->Minus(
|
||||
Expr::FromParam(b->param.h[i])), 0);
|
||||
AddEq(l, Expr::FromParam(a->param[i])->Minus(
|
||||
Expr::FromParam(b->param[i])), 0);
|
||||
} else {
|
||||
Entity *csy = SS.GetEntity(a->csys);
|
||||
Entity *w = SS.GetEntity(a->workplane);
|
||||
ExprVector u, v;
|
||||
csy->Csys2dGetBasisExprs(&u, &v);
|
||||
w->WorkplaneGetBasisExprs(&u, &v);
|
||||
ExprVector norm = (type == HORIZONTAL) ? v : u;
|
||||
ExprVector pa = a->PointGetExprs();
|
||||
ExprVector pb = b->PointGetExprs();
|
||||
|
|
|
@ -55,7 +55,7 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
|
|||
if(dogd.drawing) {
|
||||
glPushMatrix();
|
||||
glxTranslatev(ref);
|
||||
glxOntoCsys(gr, gu);
|
||||
glxOntoWorkplane(gr, gu);
|
||||
glxWriteText(exprA->Print());
|
||||
glPopMatrix();
|
||||
} else {
|
||||
|
@ -114,8 +114,8 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
|
|||
case EQUAL_LENGTH_LINES: {
|
||||
for(int i = 0; i < 2; i++) {
|
||||
Entity *e = SS.GetEntity(i == 0 ? entityA : entityB);
|
||||
Vector a = SS.GetEntity(e->assoc[0])->PointGetCoords();
|
||||
Vector b = SS.GetEntity(e->assoc[1])->PointGetCoords();
|
||||
Vector a = SS.GetEntity(e->point[0])->PointGetCoords();
|
||||
Vector b = SS.GetEntity(e->point[1])->PointGetCoords();
|
||||
Vector m = (a.ScaledBy(1.0/3)).Plus(b.ScaledBy(2.0/3));
|
||||
Vector ab = a.Minus(b);
|
||||
Vector n = (gn.Cross(ab)).WithMagnitude(10/SS.GW.scale);
|
||||
|
@ -129,14 +129,14 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
|
|||
case VERTICAL:
|
||||
if(entityA.v) {
|
||||
Entity *e = SS.GetEntity(entityA);
|
||||
Vector a = SS.GetEntity(e->assoc[0])->PointGetCoords();
|
||||
Vector b = SS.GetEntity(e->assoc[1])->PointGetCoords();
|
||||
Vector a = SS.GetEntity(e->point[0])->PointGetCoords();
|
||||
Vector b = SS.GetEntity(e->point[1])->PointGetCoords();
|
||||
Vector m = (a.ScaledBy(0.5)).Plus(b.ScaledBy(0.5));
|
||||
|
||||
if(dogd.drawing) {
|
||||
glPushMatrix();
|
||||
glxTranslatev(m);
|
||||
glxOntoCsys(gr, gu);
|
||||
glxOntoWorkplane(gr, gu);
|
||||
glxWriteText(type == HORIZONTAL ? "H" : "V");
|
||||
glPopMatrix();
|
||||
} else {
|
||||
|
@ -147,10 +147,10 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
|
|||
Vector a = SS.GetEntity(ptA)->PointGetCoords();
|
||||
Vector b = SS.GetEntity(ptB)->PointGetCoords();
|
||||
|
||||
Entity *csy = SS.GetEntity(SS.GetEntity(ptA)->csys);
|
||||
Entity *w = SS.GetEntity(SS.GetEntity(ptA)->workplane);
|
||||
Vector cu, cv, cn;
|
||||
csy->Csys2dGetBasisVectors(&cu, &cv);
|
||||
cn = csy->Csys2dGetNormalVector();
|
||||
w->WorkplaneGetBasisVectors(&cu, &cv);
|
||||
cn = w->WorkplaneGetNormalVector();
|
||||
|
||||
int i;
|
||||
for(i = 0; i < 2; i++) {
|
||||
|
|
112
entity.cpp
112
entity.cpp
|
@ -5,10 +5,10 @@ char *Entity::DescriptionString(void) {
|
|||
return r->DescriptionString();
|
||||
}
|
||||
|
||||
void Entity::Csys2dGetBasisVectors(Vector *u, Vector *v) {
|
||||
void Entity::WorkplaneGetBasisVectors(Vector *u, Vector *v) {
|
||||
double q[4];
|
||||
for(int i = 0; i < 4; i++) {
|
||||
q[i] = SS.GetParam(param.h[i])->val;
|
||||
q[i] = SS.GetParam(param[i])->val;
|
||||
}
|
||||
Quaternion quat = Quaternion::MakeFrom(q[0], q[1], q[2], q[3]);
|
||||
|
||||
|
@ -16,17 +16,17 @@ void Entity::Csys2dGetBasisVectors(Vector *u, Vector *v) {
|
|||
*v = quat.RotationV();
|
||||
}
|
||||
|
||||
Vector Entity::Csys2dGetNormalVector(void) {
|
||||
Vector Entity::WorkplaneGetNormalVector(void) {
|
||||
Vector u, v;
|
||||
Csys2dGetBasisVectors(&u, &v);
|
||||
WorkplaneGetBasisVectors(&u, &v);
|
||||
return u.Cross(v);
|
||||
}
|
||||
|
||||
void Entity::Csys2dGetBasisExprs(ExprVector *u, ExprVector *v) {
|
||||
Expr *a = Expr::FromParam(param.h[0]);
|
||||
Expr *b = Expr::FromParam(param.h[1]);
|
||||
Expr *c = Expr::FromParam(param.h[2]);
|
||||
Expr *d = Expr::FromParam(param.h[3]);
|
||||
void Entity::WorkplaneGetBasisExprs(ExprVector *u, ExprVector *v) {
|
||||
Expr *a = Expr::FromParam(param[0]);
|
||||
Expr *b = Expr::FromParam(param[1]);
|
||||
Expr *c = Expr::FromParam(param[2]);
|
||||
Expr *d = Expr::FromParam(param[3]);
|
||||
|
||||
Expr *two = Expr::FromConstant(2);
|
||||
|
||||
|
@ -53,13 +53,13 @@ void Entity::Csys2dGetBasisExprs(ExprVector *u, ExprVector *v) {
|
|||
v->z = (v->z)->Plus(two->Times(c->Times(d)));
|
||||
}
|
||||
|
||||
ExprVector Entity::Csys2dGetOffsetExprs(void) {
|
||||
return SS.GetEntity(assoc[0])->PointGetExprs();
|
||||
ExprVector Entity::WorkplaneGetOffsetExprs(void) {
|
||||
return SS.GetEntity(point[0])->PointGetExprs();
|
||||
}
|
||||
|
||||
bool Entity::HasPlane(void) {
|
||||
switch(type) {
|
||||
case CSYS_2D:
|
||||
case WORKPLANE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -67,11 +67,11 @@ bool Entity::HasPlane(void) {
|
|||
}
|
||||
|
||||
void Entity::PlaneGetExprs(ExprVector *n, Expr **dn) {
|
||||
if(type == CSYS_2D) {
|
||||
Expr *a = Expr::FromParam(param.h[0]);
|
||||
Expr *b = Expr::FromParam(param.h[1]);
|
||||
Expr *c = Expr::FromParam(param.h[2]);
|
||||
Expr *d = Expr::FromParam(param.h[3]);
|
||||
if(type == WORKPLANE) {
|
||||
Expr *a = Expr::FromParam(param[0]);
|
||||
Expr *b = Expr::FromParam(param[1]);
|
||||
Expr *c = Expr::FromParam(param[2]);
|
||||
Expr *d = Expr::FromParam(param[3]);
|
||||
|
||||
Expr *two = Expr::FromConstant(2);
|
||||
|
||||
|
@ -85,7 +85,7 @@ void Entity::PlaneGetExprs(ExprVector *n, Expr **dn) {
|
|||
n->z = (n->z)->Minus(c->Square());
|
||||
n->z = (n->z)->Plus (d->Square());
|
||||
|
||||
ExprVector p0 = SS.GetEntity(assoc[0])->PointGetExprs();
|
||||
ExprVector p0 = SS.GetEntity(point[0])->PointGetExprs();
|
||||
// The plane is n dot (p - p0) = 0, or
|
||||
// n dot p - n dot p0 = 0
|
||||
// so dn = n dot p0
|
||||
|
@ -117,12 +117,12 @@ bool Entity::IsPointIn3d(void) {
|
|||
bool Entity::PointIsKnown(void) {
|
||||
switch(type) {
|
||||
case POINT_IN_3D:
|
||||
return SS.GetParam(param.h[0])->known &&
|
||||
SS.GetParam(param.h[1])->known &&
|
||||
SS.GetParam(param.h[2])->known;
|
||||
return SS.GetParam(param[0])->known &&
|
||||
SS.GetParam(param[1])->known &&
|
||||
SS.GetParam(param[2])->known;
|
||||
case POINT_IN_2D:
|
||||
return SS.GetParam(param.h[0])->known &&
|
||||
SS.GetParam(param.h[1])->known;
|
||||
return SS.GetParam(param[0])->known &&
|
||||
SS.GetParam(param[1])->known;
|
||||
default: oops();
|
||||
}
|
||||
}
|
||||
|
@ -134,17 +134,17 @@ bool Entity::PointIsFromReferences(void) {
|
|||
void Entity::PointForceTo(Vector p) {
|
||||
switch(type) {
|
||||
case POINT_IN_3D:
|
||||
SS.GetParam(param.h[0])->val = p.x;
|
||||
SS.GetParam(param.h[1])->val = p.y;
|
||||
SS.GetParam(param.h[2])->val = p.z;
|
||||
SS.GetParam(param[0])->val = p.x;
|
||||
SS.GetParam(param[1])->val = p.y;
|
||||
SS.GetParam(param[2])->val = p.z;
|
||||
break;
|
||||
|
||||
case POINT_IN_2D: {
|
||||
Entity *c = SS.GetEntity(csys);
|
||||
Entity *c = SS.GetEntity(workplane);
|
||||
Vector u, v;
|
||||
c->Csys2dGetBasisVectors(&u, &v);
|
||||
SS.GetParam(param.h[0])->val = p.Dot(u);
|
||||
SS.GetParam(param.h[1])->val = p.Dot(v);
|
||||
c->WorkplaneGetBasisVectors(&u, &v);
|
||||
SS.GetParam(param[0])->val = p.Dot(u);
|
||||
SS.GetParam(param[1])->val = p.Dot(v);
|
||||
break;
|
||||
}
|
||||
default: oops();
|
||||
|
@ -155,17 +155,17 @@ Vector Entity::PointGetCoords(void) {
|
|||
Vector p;
|
||||
switch(type) {
|
||||
case POINT_IN_3D:
|
||||
p.x = SS.GetParam(param.h[0])->val;
|
||||
p.y = SS.GetParam(param.h[1])->val;
|
||||
p.z = SS.GetParam(param.h[2])->val;
|
||||
p.x = SS.GetParam(param[0])->val;
|
||||
p.y = SS.GetParam(param[1])->val;
|
||||
p.z = SS.GetParam(param[2])->val;
|
||||
break;
|
||||
|
||||
case POINT_IN_2D: {
|
||||
Entity *c = SS.GetEntity(csys);
|
||||
Entity *c = SS.GetEntity(workplane);
|
||||
Vector u, v;
|
||||
c->Csys2dGetBasisVectors(&u, &v);
|
||||
p = u.ScaledBy(SS.GetParam(param.h[0])->val);
|
||||
p = p.Plus(v.ScaledBy(SS.GetParam(param.h[1])->val));
|
||||
c->WorkplaneGetBasisVectors(&u, &v);
|
||||
p = u.ScaledBy(SS.GetParam(param[0])->val);
|
||||
p = p.Plus(v.ScaledBy(SS.GetParam(param[1])->val));
|
||||
break;
|
||||
}
|
||||
default: oops();
|
||||
|
@ -177,18 +177,18 @@ ExprVector Entity::PointGetExprs(void) {
|
|||
ExprVector r;
|
||||
switch(type) {
|
||||
case POINT_IN_3D:
|
||||
r.x = Expr::FromParam(param.h[0]);
|
||||
r.y = Expr::FromParam(param.h[1]);
|
||||
r.z = Expr::FromParam(param.h[2]);
|
||||
r.x = Expr::FromParam(param[0]);
|
||||
r.y = Expr::FromParam(param[1]);
|
||||
r.z = Expr::FromParam(param[2]);
|
||||
break;
|
||||
|
||||
case POINT_IN_2D: {
|
||||
Entity *c = SS.GetEntity(csys);
|
||||
Entity *c = SS.GetEntity(workplane);
|
||||
ExprVector u, v;
|
||||
c->Csys2dGetBasisExprs(&u, &v);
|
||||
c->WorkplaneGetBasisExprs(&u, &v);
|
||||
|
||||
r = u.ScaledBy(Expr::FromParam(param.h[0]));
|
||||
r = r.Plus(v.ScaledBy(Expr::FromParam(param.h[1])));
|
||||
r = u.ScaledBy(Expr::FromParam(param[0]));
|
||||
r = r.Plus(v.ScaledBy(Expr::FromParam(param[1])));
|
||||
break;
|
||||
}
|
||||
default: oops();
|
||||
|
@ -254,7 +254,7 @@ void Entity::DrawOrGetDistance(int order) {
|
|||
if(!SS.GW.showPoints) break;
|
||||
|
||||
Entity *isfor = SS.GetEntity(h.request().entity(0));
|
||||
if(!SS.GW.show2dCsyss && isfor->type == Entity::CSYS_2D) break;
|
||||
if(!SS.GW.showWorkplanes && isfor->type == Entity::WORKPLANE) break;
|
||||
|
||||
Vector v = PointGetCoords();
|
||||
|
||||
|
@ -277,15 +277,15 @@ void Entity::DrawOrGetDistance(int order) {
|
|||
break;
|
||||
}
|
||||
|
||||
case CSYS_2D: {
|
||||
case WORKPLANE: {
|
||||
if(order >= 0 && order != 0) break;
|
||||
if(!SS.GW.show2dCsyss) break;
|
||||
if(!SS.GW.showWorkplanes) break;
|
||||
|
||||
Vector p;
|
||||
p = SS.GetEntity(assoc[0])->PointGetCoords();
|
||||
p = SS.GetEntity(point[0])->PointGetCoords();
|
||||
|
||||
Vector u, v;
|
||||
Csys2dGetBasisVectors(&u, &v);
|
||||
WorkplaneGetBasisVectors(&u, &v);
|
||||
|
||||
double s = (min(SS.GW.width, SS.GW.height))*0.4/SS.GW.scale;
|
||||
|
||||
|
@ -306,7 +306,7 @@ void Entity::DrawOrGetDistance(int order) {
|
|||
if(dogd.drawing) {
|
||||
glPushMatrix();
|
||||
glxTranslatev(mm);
|
||||
glxOntoCsys(u, v);
|
||||
glxOntoWorkplane(u, v);
|
||||
glxWriteText(DescriptionString());
|
||||
glPopMatrix();
|
||||
}
|
||||
|
@ -315,17 +315,17 @@ void Entity::DrawOrGetDistance(int order) {
|
|||
|
||||
case LINE_SEGMENT: {
|
||||
if(order >= 0 && order != 1) break;
|
||||
Vector a = SS.GetEntity(assoc[0])->PointGetCoords();
|
||||
Vector b = SS.GetEntity(assoc[1])->PointGetCoords();
|
||||
Vector a = SS.GetEntity(point[0])->PointGetCoords();
|
||||
Vector b = SS.GetEntity(point[1])->PointGetCoords();
|
||||
LineDrawOrGetDistanceOrEdge(a, b);
|
||||
break;
|
||||
}
|
||||
|
||||
case CUBIC: {
|
||||
Vector p0 = SS.GetEntity(assoc[0])->PointGetCoords();
|
||||
Vector p1 = SS.GetEntity(assoc[1])->PointGetCoords();
|
||||
Vector p2 = SS.GetEntity(assoc[2])->PointGetCoords();
|
||||
Vector p3 = SS.GetEntity(assoc[3])->PointGetCoords();
|
||||
Vector p0 = SS.GetEntity(point[0])->PointGetCoords();
|
||||
Vector p1 = SS.GetEntity(point[1])->PointGetCoords();
|
||||
Vector p2 = SS.GetEntity(point[2])->PointGetCoords();
|
||||
Vector p3 = SS.GetEntity(point[3])->PointGetCoords();
|
||||
int i, n = 20;
|
||||
Vector prev = p0;
|
||||
for(i = 1; i <= n; i++) {
|
||||
|
|
31
file.cpp
31
file.cpp
|
@ -24,19 +24,19 @@ void SolveSpace::NewFile(void) {
|
|||
// planes; these are our references, present in every sketch.
|
||||
Request r;
|
||||
memset(&r, 0, sizeof(r));
|
||||
r.type = Request::CSYS_2D;
|
||||
r.type = Request::WORKPLANE;
|
||||
r.group = Group::HGROUP_REFERENCES;
|
||||
r.csys = Entity::NO_CSYS;
|
||||
r.workplane = Entity::FREE_IN_3D;
|
||||
|
||||
r.name.strcpy("#XY-csys");
|
||||
r.name.strcpy("#XY");
|
||||
r.h = Request::HREQUEST_REFERENCE_XY;
|
||||
request.Add(&r);
|
||||
|
||||
r.name.strcpy("#YZ-csys");
|
||||
r.name.strcpy("#YZ");
|
||||
r.h = Request::HREQUEST_REFERENCE_YZ;
|
||||
request.Add(&r);
|
||||
|
||||
r.name.strcpy("#ZX-csys");
|
||||
r.name.strcpy("#ZX");
|
||||
r.h = Request::HREQUEST_REFERENCE_ZX;
|
||||
request.Add(&r);
|
||||
}
|
||||
|
@ -54,22 +54,23 @@ const SolveSpace::SaveTable SolveSpace::SAVED[] = {
|
|||
|
||||
{ 'r', "Request.h.v", 'x', &(SS.sv.r.h.v) },
|
||||
{ 'r', "Request.type", 'd', &(SS.sv.r.type) },
|
||||
{ 'r', "Request.csys.v", 'x', &(SS.sv.r.csys.v) },
|
||||
{ 'r', "Request.workplane.v", 'x', &(SS.sv.r.workplane.v) },
|
||||
{ 'r', "Request.group.v", 'x', &(SS.sv.r.group.v) },
|
||||
{ 'r', "Request.name", 'N', &(SS.sv.r.name) },
|
||||
{ 'r', "Request.construction", 'b', &(SS.sv.r.construction) },
|
||||
|
||||
{ 'e', "Entity.h.v", 'x', &(SS.sv.e.h.v) },
|
||||
{ 'e', "Entity.type", 'd', &(SS.sv.e.type) },
|
||||
{ 'e', "Entity.param.h[0].v", 'x', &(SS.sv.e.param.h[0].v) },
|
||||
{ 'e', "Entity.param.h[1].v", 'x', &(SS.sv.e.param.h[1].v) },
|
||||
{ 'e', "Entity.param.h[2].v", 'x', &(SS.sv.e.param.h[2].v) },
|
||||
{ 'e', "Entity.param.h[3].v", 'x', &(SS.sv.e.param.h[3].v) },
|
||||
{ 'e', "Entity.assoc[0].v", 'x', &(SS.sv.e.assoc[0].v) },
|
||||
{ 'e', "Entity.assoc[1].v", 'x', &(SS.sv.e.assoc[1].v) },
|
||||
{ 'e', "Entity.assoc[2].v", 'x', &(SS.sv.e.assoc[2].v) },
|
||||
{ 'e', "Entity.assoc[3].v", 'x', &(SS.sv.e.assoc[3].v) },
|
||||
{ 'e', "Entity.csys.v", 'x', &(SS.sv.e.csys.v) },
|
||||
{ 'e', "Entity.param[0].v", 'x', &(SS.sv.e.param[0].v) },
|
||||
{ 'e', "Entity.param[1].v", 'x', &(SS.sv.e.param[1].v) },
|
||||
{ 'e', "Entity.param[2].v", 'x', &(SS.sv.e.param[2].v) },
|
||||
{ 'e', "Entity.param[3].v", 'x', &(SS.sv.e.param[3].v) },
|
||||
{ 'e', "Entity.point[0].v", 'x', &(SS.sv.e.point[0].v) },
|
||||
{ 'e', "Entity.point[1].v", 'x', &(SS.sv.e.point[1].v) },
|
||||
{ 'e', "Entity.point[2].v", 'x', &(SS.sv.e.point[2].v) },
|
||||
{ 'e', "Entity.point[3].v", 'x', &(SS.sv.e.point[3].v) },
|
||||
{ 'e', "Entity.direction.v", 'x', &(SS.sv.e.direction.v) },
|
||||
{ 'e', "Entity.workplane.v", 'x', &(SS.sv.e.workplane.v) },
|
||||
|
||||
{ 'c', "Constraint.h.v", 'x', &(SS.sv.c.h.v) },
|
||||
{ 'c', "Constraint.type", 'd', &(SS.sv.c.type) },
|
||||
|
|
|
@ -46,7 +46,7 @@ void glxTranslatev(Vector u)
|
|||
glTranslated((GLdouble)u.x, (GLdouble)u.y, (GLdouble)u.z);
|
||||
}
|
||||
|
||||
void glxOntoCsys(Vector u, Vector v)
|
||||
void glxOntoWorkplane(Vector u, Vector v)
|
||||
{
|
||||
double mat[16];
|
||||
Vector n = u.Cross(v);
|
||||
|
|
|
@ -46,8 +46,8 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
|
|||
{ 1, "New Boolean Union", 0, 0, NULL },
|
||||
|
||||
{ 0, "&Request", 0, NULL },
|
||||
{ 1, "Dra&w in 2d Coordinate System\tW", MNU_SEL_CSYS, 'W', mReq },
|
||||
{ 1, "Draw Anywhere in 3d\tQ", MNU_NO_CSYS, 'Q', mReq },
|
||||
{ 1, "Draw in &Workplane\tW", MNU_SEL_WORKPLANE, 'W', mReq },
|
||||
{ 1, "Draw Anywhere in 3d\tQ", MNU_FREE_IN_3D, 'Q', mReq },
|
||||
{ 1, NULL, 0, NULL },
|
||||
{ 1, "Datum &Point\tP", MNU_DATUM_POINT, 'P', mReq },
|
||||
{ 1, "Datum A&xis\tX", 0, 'X', mReq },
|
||||
|
@ -99,9 +99,9 @@ void GraphicsWindow::Init(void) {
|
|||
|
||||
// Start locked on to the XY plane.
|
||||
hRequest r = Request::HREQUEST_REFERENCE_XY;
|
||||
activeCsys = r.entity(0);
|
||||
activeWorkplane = r.entity(0);
|
||||
|
||||
show2dCsyss = true;
|
||||
showWorkplanes = true;
|
||||
showAxes = true;
|
||||
showPoints = true;
|
||||
showAllGroups = true;
|
||||
|
@ -206,17 +206,17 @@ void GraphicsWindow::EnsureValidActives(void) {
|
|||
}
|
||||
|
||||
// The active coordinate system must also exist.
|
||||
if(activeCsys.v != Entity::NO_CSYS.v &&
|
||||
!SS.entity.FindByIdNoOops(activeCsys))
|
||||
if(activeWorkplane.v != Entity::FREE_IN_3D.v &&
|
||||
!SS.entity.FindByIdNoOops(activeWorkplane))
|
||||
{
|
||||
activeCsys = Entity::NO_CSYS;
|
||||
activeWorkplane = Entity::FREE_IN_3D;
|
||||
change = true;
|
||||
}
|
||||
if(change) SS.TW.Show();
|
||||
|
||||
bool in3d = (activeCsys.v == Entity::NO_CSYS.v);
|
||||
CheckMenuById(MNU_NO_CSYS, in3d);
|
||||
CheckMenuById(MNU_SEL_CSYS, !in3d);
|
||||
bool in3d = (activeWorkplane.v == Entity::FREE_IN_3D.v);
|
||||
CheckMenuById(MNU_FREE_IN_3D, in3d);
|
||||
CheckMenuById(MNU_SEL_WORKPLANE, !in3d);
|
||||
|
||||
// And update the checked state for various menus
|
||||
switch(viewUnits) {
|
||||
|
@ -288,32 +288,32 @@ void GraphicsWindow::MenuEdit(int id) {
|
|||
void GraphicsWindow::MenuRequest(int id) {
|
||||
char *s;
|
||||
switch(id) {
|
||||
case MNU_SEL_CSYS: {
|
||||
case MNU_SEL_WORKPLANE: {
|
||||
SS.GW.GroupSelection();
|
||||
if(SS.GW.gs.n == 1 && SS.GW.gs.csyss == 1) {
|
||||
SS.GW.activeCsys = SS.GW.gs.entity[0];
|
||||
if(SS.GW.gs.n == 1 && SS.GW.gs.workplanes == 1) {
|
||||
SS.GW.activeWorkplane = SS.GW.gs.entity[0];
|
||||
SS.GW.ClearSelection();
|
||||
}
|
||||
|
||||
if(SS.GW.activeCsys.v == Entity::NO_CSYS.v) {
|
||||
Error("Select 2d coordinate system (e.g., the XY plane) "
|
||||
if(SS.GW.activeWorkplane.v == Entity::FREE_IN_3D.v) {
|
||||
Error("Select workplane (e.g., the XY plane) "
|
||||
"before locking on.");
|
||||
break;
|
||||
}
|
||||
// Align the view with the selected csys
|
||||
Entity *e = SS.GetEntity(SS.GW.activeCsys);
|
||||
// Align the view with the selected workplane
|
||||
Entity *e = SS.GetEntity(SS.GW.activeWorkplane);
|
||||
Vector pr, pu;
|
||||
e->Csys2dGetBasisVectors(&pr, &pu);
|
||||
e->WorkplaneGetBasisVectors(&pr, &pu);
|
||||
Quaternion quatf = Quaternion::MakeFrom(pr, pu);
|
||||
Vector offsetf = SS.GetEntity(e->assoc[0])->PointGetCoords();
|
||||
Vector offsetf = SS.GetEntity(e->point[0])->PointGetCoords();
|
||||
SS.GW.AnimateOnto(quatf, offsetf);
|
||||
|
||||
SS.GW.EnsureValidActives();
|
||||
SS.TW.Show();
|
||||
break;
|
||||
}
|
||||
case MNU_NO_CSYS:
|
||||
SS.GW.activeCsys = Entity::NO_CSYS;
|
||||
case MNU_FREE_IN_3D:
|
||||
SS.GW.activeWorkplane = Entity::FREE_IN_3D;
|
||||
SS.GW.EnsureValidActives();
|
||||
SS.TW.Show();
|
||||
break;
|
||||
|
@ -517,7 +517,7 @@ void GraphicsWindow::GroupSelection(void) {
|
|||
gs.entity[(gs.entities)++] = s->entity;
|
||||
}
|
||||
switch(e->type) {
|
||||
case Entity::CSYS_2D: (gs.csyss)++; break;
|
||||
case Entity::WORKPLANE: (gs.workplanes)++; break;
|
||||
case Entity::LINE_SEGMENT: (gs.lineSegments)++; break;
|
||||
}
|
||||
if(e->HasPlane()) (gs.planes)++;
|
||||
|
@ -539,7 +539,7 @@ hRequest GraphicsWindow::AddRequest(int type) {
|
|||
Request r;
|
||||
memset(&r, 0, sizeof(r));
|
||||
r.group = activeGroup;
|
||||
r.csys = activeCsys;
|
||||
r.workplane = activeWorkplane;
|
||||
r.type = type;
|
||||
SS.request.AddAndAssignId(&r);
|
||||
SS.GenerateAll();
|
||||
|
@ -744,8 +744,8 @@ void GraphicsWindow::ToggleBool(int link, DWORD v) {
|
|||
}
|
||||
|
||||
void GraphicsWindow::ToggleAnyDatumShown(int link, DWORD v) {
|
||||
bool t = !(SS.GW.show2dCsyss && SS.GW.showAxes && SS.GW.showPoints);
|
||||
SS.GW.show2dCsyss = t;
|
||||
bool t = !(SS.GW.showWorkplanes && SS.GW.showAxes && SS.GW.showPoints);
|
||||
SS.GW.showWorkplanes = t;
|
||||
SS.GW.showAxes = t;
|
||||
SS.GW.showPoints = t;
|
||||
|
||||
|
@ -795,7 +795,7 @@ void GraphicsWindow::Paint(int w, int h) {
|
|||
// levels, and only the first gets normal depth testing.
|
||||
glxUnlockColor();
|
||||
for(a = 0; a <= 2; a++) {
|
||||
// Three levels: 0 least prominent (e.g. a reference csys), 1 is
|
||||
// Three levels: 0 least prominent (e.g. a reference workplane), 1 is
|
||||
// middle (e.g. line segment), 2 is always in front (e.g. point).
|
||||
if(a == 1) glDisable(GL_DEPTH_TEST);
|
||||
for(i = 0; i < SS.entity.n; i++) {
|
||||
|
|
26
sketch.cpp
26
sketch.cpp
|
@ -1,6 +1,6 @@
|
|||
#include "solvespace.h"
|
||||
|
||||
const hEntity Entity::NO_CSYS = { 0 };
|
||||
const hEntity Entity::FREE_IN_3D = { 0 };
|
||||
|
||||
const hGroup Group::HGROUP_REFERENCES = { 1 };
|
||||
const hRequest Request::HREQUEST_REFERENCE_XY = { 1 };
|
||||
|
@ -44,7 +44,7 @@ void Group::Draw(void) {
|
|||
glxColor3d(1, 0, 0);
|
||||
glPushMatrix();
|
||||
glxTranslatev(error.b);
|
||||
glxOntoCsys(SS.GW.projRight, SS.GW.projUp);
|
||||
glxOntoWorkplane(SS.GW.projRight, SS.GW.projUp);
|
||||
glxWriteText("not closed contour!");
|
||||
glPopMatrix();
|
||||
}
|
||||
|
@ -72,8 +72,8 @@ void Request::Generate(IdList<Entity,hEntity> *entity,
|
|||
Entity e;
|
||||
memset(&e, 0, sizeof(e));
|
||||
switch(type) {
|
||||
case Request::CSYS_2D:
|
||||
et = Entity::CSYS_2D; points = 1; params = 4; goto c;
|
||||
case Request::WORKPLANE:
|
||||
et = Entity::WORKPLANE; points = 1; params = 4; goto c;
|
||||
|
||||
case Request::DATUM_POINT:
|
||||
et = 0; points = 1; params = 0; goto c;
|
||||
|
@ -92,29 +92,29 @@ c: {
|
|||
for(i = 0; i < points; i++) {
|
||||
Entity p;
|
||||
memset(&p, 0, sizeof(p));
|
||||
p.csys = csys;
|
||||
p.workplane = workplane;
|
||||
// points start from entity 1, except for datum point case
|
||||
p.h = h.entity(i+(et ? 1 : 0));
|
||||
p.symbolic = true;
|
||||
if(csys.v == Entity::NO_CSYS.v) {
|
||||
if(workplane.v == Entity::FREE_IN_3D.v) {
|
||||
p.type = Entity::POINT_IN_3D;
|
||||
// params for x y z
|
||||
p.param.h[0] = AddParam(param, h.param(16 + 3*i + 0));
|
||||
p.param.h[1] = AddParam(param, h.param(16 + 3*i + 1));
|
||||
p.param.h[2] = AddParam(param, h.param(16 + 3*i + 2));
|
||||
p.param[0] = AddParam(param, h.param(16 + 3*i + 0));
|
||||
p.param[1] = AddParam(param, h.param(16 + 3*i + 1));
|
||||
p.param[2] = AddParam(param, h.param(16 + 3*i + 2));
|
||||
} else {
|
||||
p.type = Entity::POINT_IN_2D;
|
||||
// params for u v
|
||||
p.param.h[0] = AddParam(param, h.param(16 + 3*i + 0));
|
||||
p.param.h[1] = AddParam(param, h.param(16 + 3*i + 1));
|
||||
p.param[0] = AddParam(param, h.param(16 + 3*i + 0));
|
||||
p.param[1] = AddParam(param, h.param(16 + 3*i + 1));
|
||||
}
|
||||
entity->Add(&p);
|
||||
e.assoc[i] = p.h;
|
||||
e.point[i] = p.h;
|
||||
}
|
||||
// And generate any params not associated with the point that
|
||||
// we happen to need.
|
||||
for(i = 0; i < params; i++) {
|
||||
e.param.h[i] = AddParam(param, h.param(i));
|
||||
e.param[i] = AddParam(param, h.param(i));
|
||||
}
|
||||
|
||||
if(et) entity->Add(&e);
|
||||
|
|
94
sketch.h
94
sketch.h
|
@ -47,6 +47,19 @@ public:
|
|||
inline hRequest request(void);
|
||||
};
|
||||
|
||||
|
||||
class EntityId {
|
||||
DWORD v; // entity ID, starting from 0
|
||||
};
|
||||
class EntityMap {
|
||||
int tag;
|
||||
|
||||
EntityId h;
|
||||
hEntity input;
|
||||
int copyNumber;
|
||||
// (input, copyNumber) gets mapped to ((Request)xxx).entity(h.v)
|
||||
};
|
||||
|
||||
// A set of requests. Every request must have an associated group.
|
||||
class Group {
|
||||
public:
|
||||
|
@ -69,27 +82,20 @@ public:
|
|||
SPolygon poly;
|
||||
|
||||
NameStr name;
|
||||
|
||||
char *DescriptionString(void);
|
||||
|
||||
// When a request generates entities from entities, and the source
|
||||
// entities may have come from multiple requests, it's necessary to
|
||||
// remap the entity ID so that it's still unique. We do this with a
|
||||
// mapping list.
|
||||
IdList<EntityId,EntityMap> remap;
|
||||
hEntity Remap(hEntity in, int copyNumber);
|
||||
|
||||
void Draw(void);
|
||||
|
||||
SPolygon GetPolygon(void);
|
||||
};
|
||||
|
||||
|
||||
class EntityId {
|
||||
DWORD v; // entity ID, starting from 0
|
||||
};
|
||||
class EntityMap {
|
||||
int tag;
|
||||
|
||||
EntityId h;
|
||||
hEntity input;
|
||||
int copyNumber;
|
||||
// (input, copyNumber) gets mapped to ((Request)xxx).entity(h.v)
|
||||
};
|
||||
|
||||
// A user request for some primitive or derived operation; for example a
|
||||
// line, or a step and repeat.
|
||||
class Request {
|
||||
|
@ -103,25 +109,19 @@ public:
|
|||
hRequest h;
|
||||
|
||||
// Types of requests
|
||||
static const int CSYS_2D = 100;
|
||||
static const int WORKPLANE = 100;
|
||||
static const int DATUM_POINT = 101;
|
||||
static const int LINE_SEGMENT = 200;
|
||||
static const int CUBIC = 300;
|
||||
|
||||
int type;
|
||||
|
||||
hEntity csys; // or Entity::NO_CSYS
|
||||
hEntity workplane; // or Entity::FREE_IN_3D
|
||||
hGroup group;
|
||||
|
||||
NameStr name;
|
||||
bool construction;
|
||||
|
||||
// When a request generates entities from entities, and the source
|
||||
// entities may have come from multiple requests, it's necessary to
|
||||
// remap the entity ID so that it's still unique. We do this with a
|
||||
// mapping list.
|
||||
IdList<EntityId,EntityMap> remap;
|
||||
hEntity Remap(hEntity in, int copyNumber);
|
||||
|
||||
|
||||
hParam AddParam(IdList<Param,hParam> *param, hParam hp);
|
||||
void Generate(IdList<Entity,hEntity> *entity, IdList<Param,hParam> *param);
|
||||
|
||||
|
@ -133,32 +133,36 @@ public:
|
|||
int tag;
|
||||
hEntity h;
|
||||
|
||||
static const hEntity NO_CSYS;
|
||||
static const hEntity FREE_IN_3D;
|
||||
|
||||
static const int CSYS_2D = 1000;
|
||||
static const int POINT_IN_3D = 2000;
|
||||
static const int POINT_IN_2D = 2001;
|
||||
static const int LINE_SEGMENT = 3000;
|
||||
static const int CUBIC = 4000;
|
||||
static const int WORKPLANE = 1000;
|
||||
static const int POINT_IN_3D = 2000;
|
||||
static const int POINT_IN_2D = 2001;
|
||||
static const int POINT_OFFSET = 2010;
|
||||
static const int DIRECTION_QUATERNION = 3000;
|
||||
static const int DIRECTION_OFFSET = 3010;
|
||||
static const int LINE_SEGMENT = 10000;
|
||||
static const int CUBIC = 11000;
|
||||
|
||||
static const int EDGE_LIST = 90000;
|
||||
static const int FACE_LIST = 91000;
|
||||
int type;
|
||||
|
||||
bool symbolic;
|
||||
// The params are usually handles to the symbolic variables, but may
|
||||
// also be constants
|
||||
union {
|
||||
hParam h[16];
|
||||
double v[16];
|
||||
} param;
|
||||
// Associated entities, e.g. the endpoints for a line segment
|
||||
hEntity assoc[16];
|
||||
|
||||
hEntity csys; // or Entity::NO_CSYS
|
||||
// When it comes time to draw an entity, we look here to get the
|
||||
// defining variables.
|
||||
hParam param[4];
|
||||
hEntity point[4];
|
||||
hEntity direction;
|
||||
|
||||
// Applies only for a CSYS_2D type
|
||||
void Csys2dGetBasisVectors(Vector *u, Vector *v);
|
||||
Vector Csys2dGetNormalVector(void);
|
||||
void Csys2dGetBasisExprs(ExprVector *u, ExprVector *v);
|
||||
ExprVector Csys2dGetOffsetExprs(void);
|
||||
hEntity workplane; // or Entity::FREE_IN_3D
|
||||
|
||||
// Applies only for a WORKPLANE type
|
||||
void WorkplaneGetBasisVectors(Vector *u, Vector *v);
|
||||
Vector WorkplaneGetNormalVector(void);
|
||||
void WorkplaneGetBasisExprs(ExprVector *u, ExprVector *v);
|
||||
ExprVector WorkplaneGetOffsetExprs(void);
|
||||
|
||||
bool IsPoint(void);
|
||||
bool IsPointIn3d(void);
|
||||
|
@ -244,7 +248,9 @@ public:
|
|||
hConstraint h;
|
||||
|
||||
int type;
|
||||
|
||||
hGroup group;
|
||||
hEntity workplane;
|
||||
|
||||
// These are the parameters for the constraint.
|
||||
Expr *exprA;
|
||||
|
|
|
@ -67,7 +67,7 @@ void glxVertex3v(Vector u);
|
|||
void glxFillPolygon(SPolygon *p);
|
||||
void glxWriteText(char *str);
|
||||
void glxTranslatev(Vector u);
|
||||
void glxOntoCsys(Vector u, Vector v);
|
||||
void glxOntoWorkplane(Vector u, Vector v);
|
||||
void glxLockColorTo(double r, double g, double b);
|
||||
void glxUnlockColor(void);
|
||||
void glxColor3d(double r, double g, double b);
|
||||
|
|
20
textwin.cpp
20
textwin.cpp
|
@ -205,21 +205,21 @@ void TextWindow::ShowHeader(void) {
|
|||
} else {
|
||||
// Navigation buttons
|
||||
char *cd;
|
||||
if(SS.GW.activeCsys.v == Entity::NO_CSYS.v) {
|
||||
if(SS.GW.activeWorkplane.v == Entity::FREE_IN_3D.v) {
|
||||
cd = "free in 3d";
|
||||
} else {
|
||||
cd = SS.GetEntity(SS.GW.activeCsys)->DescriptionString();
|
||||
cd = SS.GetEntity(SS.GW.activeWorkplane)->DescriptionString();
|
||||
}
|
||||
Printf(" %Lb%f<<%E %Lh%fhome%E %CT csys:%CD %s",
|
||||
Printf(" %Lb%f<<%E %Lh%fhome%E %CT workplane:%CD %s",
|
||||
(DWORD)(&TextWindow::ScreenNavigation),
|
||||
(DWORD)(&TextWindow::ScreenNavigation),
|
||||
cd);
|
||||
}
|
||||
|
||||
int datumColor;
|
||||
if(SS.GW.show2dCsyss && SS.GW.showAxes && SS.GW.showPoints) {
|
||||
if(SS.GW.showWorkplanes && SS.GW.showAxes && SS.GW.showPoints) {
|
||||
datumColor = 'S'; // shown
|
||||
} else if(!(SS.GW.show2dCsyss || SS.GW.showAxes || SS.GW.showPoints)) {
|
||||
} else if(!(SS.GW.showWorkplanes || SS.GW.showAxes || SS.GW.showPoints)) {
|
||||
datumColor = 'H'; // hidden
|
||||
} else {
|
||||
datumColor = 'M'; // mixed
|
||||
|
@ -227,13 +227,13 @@ void TextWindow::ShowHeader(void) {
|
|||
|
||||
#define hs(b) ((b) ? 'S' : 'H')
|
||||
Printf("%CTshow: "
|
||||
"%Cp%Ll%D%f2d-csys%E%CT "
|
||||
"%Cp%Ll%D%fworkplane%E%CT "
|
||||
"%Cp%Ll%D%faxes%E%CT "
|
||||
"%Cp%Ll%D%fpoints%E%CT "
|
||||
"%Cp%Ll%fany-datum%E%CT",
|
||||
hs(SS.GW.show2dCsyss), (DWORD)&(SS.GW.show2dCsyss), &(SS.GW.ToggleBool),
|
||||
hs(SS.GW.showAxes), (DWORD)&(SS.GW.showAxes), &(SS.GW.ToggleBool),
|
||||
hs(SS.GW.showPoints), (DWORD)&(SS.GW.showPoints), &(SS.GW.ToggleBool),
|
||||
hs(SS.GW.showWorkplanes), (DWORD)&(SS.GW.showWorkplanes), &(SS.GW.ToggleBool),
|
||||
hs(SS.GW.showAxes), (DWORD)&(SS.GW.showAxes), &(SS.GW.ToggleBool),
|
||||
hs(SS.GW.showPoints), (DWORD)&(SS.GW.showPoints), &(SS.GW.ToggleBool),
|
||||
datumColor, &(SS.GW.ToggleAnyDatumShown)
|
||||
);
|
||||
Printf("%CT "
|
||||
|
@ -302,7 +302,7 @@ void TextWindow::ShowRequestInfo(void) {
|
|||
|
||||
char *s;
|
||||
switch(r->type) {
|
||||
case Request::CSYS_2D: s = "2d coordinate system"; break;
|
||||
case Request::WORKPLANE: s = "workplane"; break;
|
||||
case Request::DATUM_POINT: s = "datum point"; break;
|
||||
case Request::LINE_SEGMENT: s = "line segment"; break;
|
||||
default: oops();
|
||||
|
|
10
ui.h
10
ui.h
|
@ -93,8 +93,8 @@ public:
|
|||
// Edit
|
||||
MNU_DELETE,
|
||||
// Request
|
||||
MNU_SEL_CSYS,
|
||||
MNU_NO_CSYS,
|
||||
MNU_SEL_WORKPLANE,
|
||||
MNU_FREE_IN_3D,
|
||||
MNU_DATUM_POINT,
|
||||
MNU_LINE_SEGMENT,
|
||||
MNU_RECTANGLE,
|
||||
|
@ -147,7 +147,7 @@ public:
|
|||
Unit viewUnits;
|
||||
|
||||
hGroup activeGroup;
|
||||
hEntity activeCsys;
|
||||
hEntity activeWorkplane;
|
||||
void EnsureValidActives();
|
||||
|
||||
// Operations that must be completed by doing something with the mouse
|
||||
|
@ -188,7 +188,7 @@ public:
|
|||
hEntity entity[MAX_SELECTED];
|
||||
int points;
|
||||
int entities;
|
||||
int csyss;
|
||||
int workplanes;
|
||||
int planes;
|
||||
int lineSegments;
|
||||
int n;
|
||||
|
@ -196,7 +196,7 @@ public:
|
|||
void GroupSelection(void);
|
||||
|
||||
// This sets what gets displayed.
|
||||
bool show2dCsyss;
|
||||
bool showWorkplanes;
|
||||
bool showAxes;
|
||||
bool showPoints;
|
||||
bool showAllGroups;
|
||||
|
|
Loading…
Reference in New Issue