Use the new equality/inequality operators of handles to reduce references to .v. NFC.
This commit is contained in:
parent
7bd4b149f7
commit
5efb09e6d4
@ -12,16 +12,16 @@ void SolveSpaceUI::Clipboard::Clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SolveSpaceUI::Clipboard::ContainsEntity(hEntity he) {
|
bool SolveSpaceUI::Clipboard::ContainsEntity(hEntity he) {
|
||||||
if(he.v == Entity::NO_ENTITY.v)
|
if(he == Entity::NO_ENTITY)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
ClipboardRequest *cr;
|
ClipboardRequest *cr;
|
||||||
for(cr = r.First(); cr; cr = r.NextAfter(cr)) {
|
for(cr = r.First(); cr; cr = r.NextAfter(cr)) {
|
||||||
if(cr->oldEnt.v == he.v)
|
if(cr->oldEnt == he)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for(int i = 0; i < MAX_POINTS_IN_ENTITY; i++) {
|
for(int i = 0; i < MAX_POINTS_IN_ENTITY; i++) {
|
||||||
if(cr->oldPointEnt[i].v == he.v)
|
if(cr->oldPointEnt[i] == he)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -29,16 +29,16 @@ bool SolveSpaceUI::Clipboard::ContainsEntity(hEntity he) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hEntity SolveSpaceUI::Clipboard::NewEntityFor(hEntity he) {
|
hEntity SolveSpaceUI::Clipboard::NewEntityFor(hEntity he) {
|
||||||
if(he.v == Entity::NO_ENTITY.v)
|
if(he == Entity::NO_ENTITY)
|
||||||
return Entity::NO_ENTITY;
|
return Entity::NO_ENTITY;
|
||||||
|
|
||||||
ClipboardRequest *cr;
|
ClipboardRequest *cr;
|
||||||
for(cr = r.First(); cr; cr = r.NextAfter(cr)) {
|
for(cr = r.First(); cr; cr = r.NextAfter(cr)) {
|
||||||
if(cr->oldEnt.v == he.v)
|
if(cr->oldEnt == he)
|
||||||
return cr->newReq.entity(0);
|
return cr->newReq.entity(0);
|
||||||
|
|
||||||
for(int i = 0; i < MAX_POINTS_IN_ENTITY; i++) {
|
for(int i = 0; i < MAX_POINTS_IN_ENTITY; i++) {
|
||||||
if(cr->oldPointEnt[i].v == he.v)
|
if(cr->oldPointEnt[i] == he)
|
||||||
return cr->newReq.entity(1+i);
|
return cr->newReq.entity(1+i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -170,9 +170,9 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) {
|
|||||||
hRequest hr = he.request();
|
hRequest hr = he.request();
|
||||||
Request *r = SK.GetRequest(hr);
|
Request *r = SK.GetRequest(hr);
|
||||||
if(r->type == Request::Type::ARC_OF_CIRCLE) {
|
if(r->type == Request::Type::ARC_OF_CIRCLE) {
|
||||||
if(he.v == hr.entity(2).v) {
|
if(he == hr.entity(2)) {
|
||||||
return hr.entity(3);
|
return hr.entity(3);
|
||||||
} else if(he.v == hr.entity(3).v) {
|
} else if(he == hr.entity(3)) {
|
||||||
return hr.entity(2);
|
return hr.entity(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,8 @@ void Constraint::DeleteAllConstraintsFor(Constraint::Type type, hEntity entityA,
|
|||||||
ConstraintBase *ct = &(SK.constraint.elem[i]);
|
ConstraintBase *ct = &(SK.constraint.elem[i]);
|
||||||
if(ct->type != type) continue;
|
if(ct->type != type) continue;
|
||||||
|
|
||||||
if(ct->entityA.v != entityA.v) continue;
|
if(ct->entityA != entityA) continue;
|
||||||
if(ct->ptA.v != ptA.v) continue;
|
if(ct->ptA != ptA) continue;
|
||||||
ct->tag = 1;
|
ct->tag = 1;
|
||||||
}
|
}
|
||||||
SK.constraint.RemoveTagged();
|
SK.constraint.RemoveTagged();
|
||||||
@ -406,7 +406,7 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
Entity *l0 = SK.GetEntity(gs.entity[0]),
|
Entity *l0 = SK.GetEntity(gs.entity[0]),
|
||||||
*l1 = SK.GetEntity(gs.entity[1]);
|
*l1 = SK.GetEntity(gs.entity[1]);
|
||||||
|
|
||||||
if((l1->group.v != SS.GW.activeGroup.v) ||
|
if((l1->group != SS.GW.activeGroup) ||
|
||||||
(l1->construction && !(l0->construction)))
|
(l1->construction && !(l0->construction)))
|
||||||
{
|
{
|
||||||
swap(l0, l1);
|
swap(l0, l1);
|
||||||
@ -433,10 +433,10 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
"(symmetric about workplane)\n"));
|
"(symmetric about workplane)\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(c.entityA.v == Entity::NO_ENTITY.v) {
|
if(c.entityA == Entity::NO_ENTITY) {
|
||||||
// Horizontal / vertical symmetry, implicit symmetry plane
|
// Horizontal / vertical symmetry, implicit symmetry plane
|
||||||
// normal to the workplane
|
// normal to the workplane
|
||||||
if(c.workplane.v == Entity::FREE_IN_3D.v) {
|
if(c.workplane == Entity::FREE_IN_3D) {
|
||||||
Error(_("A workplane must be active when constraining "
|
Error(_("A workplane must be active when constraining "
|
||||||
"symmetric without an explicit symmetry plane."));
|
"symmetric without an explicit symmetry plane."));
|
||||||
return;
|
return;
|
||||||
@ -466,7 +466,7 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
case Command::VERTICAL:
|
case Command::VERTICAL:
|
||||||
case Command::HORIZONTAL: {
|
case Command::HORIZONTAL: {
|
||||||
hEntity ha, hb;
|
hEntity ha, hb;
|
||||||
if(c.workplane.v == Entity::FREE_IN_3D.v) {
|
if(c.workplane == Entity::FREE_IN_3D) {
|
||||||
Error(_("Activate a workplane (with Sketch -> In Workplane) before "
|
Error(_("Activate a workplane (with Sketch -> In Workplane) before "
|
||||||
"applying a horizontal or vertical constraint."));
|
"applying a horizontal or vertical constraint."));
|
||||||
return;
|
return;
|
||||||
@ -510,12 +510,10 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
|
|
||||||
Entity *nfree = SK.GetEntity(c.entityA);
|
Entity *nfree = SK.GetEntity(c.entityA);
|
||||||
Entity *nref = SK.GetEntity(c.entityB);
|
Entity *nref = SK.GetEntity(c.entityB);
|
||||||
if(nref->group.v == SS.GW.activeGroup.v) {
|
if(nref->group == SS.GW.activeGroup) {
|
||||||
swap(nref, nfree);
|
swap(nref, nfree);
|
||||||
}
|
}
|
||||||
if(nfree->group.v == SS.GW.activeGroup.v &&
|
if(nfree->group == SS.GW.activeGroup && nref->group != SS.GW.activeGroup) {
|
||||||
nref ->group.v != SS.GW.activeGroup.v)
|
|
||||||
{
|
|
||||||
// nfree is free, and nref is locked (since it came from a
|
// nfree is free, and nref is locked (since it came from a
|
||||||
// previous group); so let's force nfree aligned to nref,
|
// previous group); so let's force nfree aligned to nref,
|
||||||
// and make convergence easy
|
// and make convergence easy
|
||||||
@ -746,7 +744,7 @@ void Constraint::MenuConstrain(Command id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(const Constraint &cc : SK.constraint) {
|
for(const Constraint &cc : SK.constraint) {
|
||||||
if(c.h.v != cc.h.v && c.Equals(cc)) {
|
if(c.h != cc.h && c.Equals(cc)) {
|
||||||
// Oops, we already have this exact constraint. Remove the one we just added.
|
// Oops, we already have this exact constraint. Remove the one we just added.
|
||||||
SK.constraint.RemoveById(c.h);
|
SK.constraint.RemoveById(c.h);
|
||||||
SS.GW.ClearSelection();
|
SS.GW.ClearSelection();
|
||||||
|
@ -40,7 +40,7 @@ Expr *ConstraintBase::PointLineDistance(hEntity wrkpl, hEntity hpt, hEntity hln)
|
|||||||
|
|
||||||
EntityBase *p = SK.GetEntity(hpt);
|
EntityBase *p = SK.GetEntity(hpt);
|
||||||
|
|
||||||
if(wrkpl.v == EntityBase::FREE_IN_3D.v) {
|
if(wrkpl == EntityBase::FREE_IN_3D) {
|
||||||
ExprVector ep = p->PointGetExprs();
|
ExprVector ep = p->PointGetExprs();
|
||||||
|
|
||||||
ExprVector ea = a->PointGetExprs();
|
ExprVector ea = a->PointGetExprs();
|
||||||
@ -82,7 +82,7 @@ Expr *ConstraintBase::Distance(hEntity wrkpl, hEntity hpa, hEntity hpb) {
|
|||||||
ssassert(pa->IsPoint() && pb->IsPoint(),
|
ssassert(pa->IsPoint() && pb->IsPoint(),
|
||||||
"Expected two points to measure projected distance between");
|
"Expected two points to measure projected distance between");
|
||||||
|
|
||||||
if(wrkpl.v == EntityBase::FREE_IN_3D.v) {
|
if(wrkpl == EntityBase::FREE_IN_3D) {
|
||||||
// This is true distance
|
// This is true distance
|
||||||
ExprVector ea, eb, eab;
|
ExprVector ea, eb, eab;
|
||||||
ea = pa->PointGetExprs();
|
ea = pa->PointGetExprs();
|
||||||
@ -111,7 +111,7 @@ Expr *ConstraintBase::Distance(hEntity wrkpl, hEntity hpa, hEntity hpb) {
|
|||||||
Expr *ConstraintBase::DirectionCosine(hEntity wrkpl,
|
Expr *ConstraintBase::DirectionCosine(hEntity wrkpl,
|
||||||
ExprVector ae, ExprVector be)
|
ExprVector ae, ExprVector be)
|
||||||
{
|
{
|
||||||
if(wrkpl.v == EntityBase::FREE_IN_3D.v) {
|
if(wrkpl == EntityBase::FREE_IN_3D) {
|
||||||
Expr *mags = (ae.Magnitude())->Times(be.Magnitude());
|
Expr *mags = (ae.Magnitude())->Times(be.Magnitude());
|
||||||
return (ae.Dot(be))->Div(mags);
|
return (ae.Dot(be))->Div(mags);
|
||||||
} else {
|
} else {
|
||||||
@ -146,7 +146,7 @@ void ConstraintBase::ModifyToSatisfy() {
|
|||||||
Vector a = SK.GetEntity(entityA)->VectorGetNum();
|
Vector a = SK.GetEntity(entityA)->VectorGetNum();
|
||||||
Vector b = SK.GetEntity(entityB)->VectorGetNum();
|
Vector b = SK.GetEntity(entityB)->VectorGetNum();
|
||||||
if(other) a = a.ScaledBy(-1);
|
if(other) a = a.ScaledBy(-1);
|
||||||
if(workplane.v != EntityBase::FREE_IN_3D.v) {
|
if(workplane != EntityBase::FREE_IN_3D) {
|
||||||
a = a.ProjectVectorInto(workplane);
|
a = a.ProjectVectorInto(workplane);
|
||||||
b = b.ProjectVectorInto(workplane);
|
b = b.ProjectVectorInto(workplane);
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ void ConstraintBase::AddEq(IdList<Equation,hEquation> *l, const ExprVector &v,
|
|||||||
int baseIndex) const {
|
int baseIndex) const {
|
||||||
AddEq(l, v.x, baseIndex);
|
AddEq(l, v.x, baseIndex);
|
||||||
AddEq(l, v.y, baseIndex + 1);
|
AddEq(l, v.y, baseIndex + 1);
|
||||||
if(workplane.v == EntityBase::FREE_IN_3D.v) {
|
if(workplane == EntityBase::FREE_IN_3D) {
|
||||||
AddEq(l, v.z, baseIndex + 2);
|
AddEq(l, v.z, baseIndex + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ void ConstraintBase::Generate(IdList<Param,hParam> *l) {
|
|||||||
case Type::PARALLEL:
|
case Type::PARALLEL:
|
||||||
case Type::CUBIC_LINE_TANGENT:
|
case Type::CUBIC_LINE_TANGENT:
|
||||||
// Add new parameter only when we operate in 3d space
|
// Add new parameter only when we operate in 3d space
|
||||||
if(workplane.v != EntityBase::FREE_IN_3D.v) break;
|
if(workplane != EntityBase::FREE_IN_3D) break;
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case Type::SAME_ORIENTATION:
|
case Type::SAME_ORIENTATION:
|
||||||
case Type::PT_ON_LINE: {
|
case Type::PT_ON_LINE: {
|
||||||
@ -361,7 +361,7 @@ void ConstraintBase::GenerateEquations(IdList<Equation,hEquation> *l,
|
|||||||
case Type::POINTS_COINCIDENT: {
|
case Type::POINTS_COINCIDENT: {
|
||||||
EntityBase *a = SK.GetEntity(ptA);
|
EntityBase *a = SK.GetEntity(ptA);
|
||||||
EntityBase *b = SK.GetEntity(ptB);
|
EntityBase *b = SK.GetEntity(ptB);
|
||||||
if(workplane.v == EntityBase::FREE_IN_3D.v) {
|
if(workplane == EntityBase::FREE_IN_3D) {
|
||||||
ExprVector pa = a->PointGetExprs();
|
ExprVector pa = a->PointGetExprs();
|
||||||
ExprVector pb = b->PointGetExprs();
|
ExprVector pb = b->PointGetExprs();
|
||||||
AddEq(l, pa.x->Minus(pb.x), 0);
|
AddEq(l, pa.x->Minus(pb.x), 0);
|
||||||
@ -430,7 +430,7 @@ void ConstraintBase::GenerateEquations(IdList<Equation,hEquation> *l,
|
|||||||
}
|
}
|
||||||
|
|
||||||
case Type::AT_MIDPOINT:
|
case Type::AT_MIDPOINT:
|
||||||
if(workplane.v == EntityBase::FREE_IN_3D.v) {
|
if(workplane == EntityBase::FREE_IN_3D) {
|
||||||
EntityBase *ln = SK.GetEntity(entityA);
|
EntityBase *ln = SK.GetEntity(entityA);
|
||||||
ExprVector a = SK.GetEntity(ln->point[0])->PointGetExprs();
|
ExprVector a = SK.GetEntity(ln->point[0])->PointGetExprs();
|
||||||
ExprVector b = SK.GetEntity(ln->point[1])->PointGetExprs();
|
ExprVector b = SK.GetEntity(ln->point[1])->PointGetExprs();
|
||||||
@ -469,7 +469,7 @@ void ConstraintBase::GenerateEquations(IdList<Equation,hEquation> *l,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case Type::SYMMETRIC:
|
case Type::SYMMETRIC:
|
||||||
if(workplane.v == EntityBase::FREE_IN_3D.v) {
|
if(workplane == EntityBase::FREE_IN_3D) {
|
||||||
EntityBase *plane = SK.GetEntity(entityA);
|
EntityBase *plane = SK.GetEntity(entityA);
|
||||||
EntityBase *ea = SK.GetEntity(ptA);
|
EntityBase *ea = SK.GetEntity(ptA);
|
||||||
EntityBase *eb = SK.GetEntity(ptB);
|
EntityBase *eb = SK.GetEntity(ptB);
|
||||||
@ -521,7 +521,7 @@ void ConstraintBase::GenerateEquations(IdList<Equation,hEquation> *l,
|
|||||||
|
|
||||||
case Type::SYMMETRIC_HORIZ:
|
case Type::SYMMETRIC_HORIZ:
|
||||||
case Type::SYMMETRIC_VERT: {
|
case Type::SYMMETRIC_VERT: {
|
||||||
ssassert(workplane.v != Entity::FREE_IN_3D.v,
|
ssassert(workplane != Entity::FREE_IN_3D,
|
||||||
"Unexpected horizontal/vertical symmetric constraint in 3d");
|
"Unexpected horizontal/vertical symmetric constraint in 3d");
|
||||||
|
|
||||||
EntityBase *a = SK.GetEntity(ptA);
|
EntityBase *a = SK.GetEntity(ptA);
|
||||||
@ -576,7 +576,7 @@ void ConstraintBase::GenerateEquations(IdList<Equation,hEquation> *l,
|
|||||||
|
|
||||||
case Type::HORIZONTAL:
|
case Type::HORIZONTAL:
|
||||||
case Type::VERTICAL: {
|
case Type::VERTICAL: {
|
||||||
ssassert(workplane.v != Entity::FREE_IN_3D.v,
|
ssassert(workplane != Entity::FREE_IN_3D,
|
||||||
"Unexpected horizontal/vertical constraint in 3d");
|
"Unexpected horizontal/vertical constraint in 3d");
|
||||||
|
|
||||||
hEntity ha, hb;
|
hEntity ha, hb;
|
||||||
@ -701,7 +701,7 @@ void ConstraintBase::GenerateEquations(IdList<Equation,hEquation> *l,
|
|||||||
|
|
||||||
ExprVector b = line->VectorGetExprs();
|
ExprVector b = line->VectorGetExprs();
|
||||||
|
|
||||||
if(workplane.v == EntityBase::FREE_IN_3D.v) {
|
if(workplane == EntityBase::FREE_IN_3D) {
|
||||||
ExprVector eq = VectorsParallel3d(a, b, valP);
|
ExprVector eq = VectorsParallel3d(a, b, valP);
|
||||||
AddEq(l, eq);
|
AddEq(l, eq);
|
||||||
} else {
|
} else {
|
||||||
@ -755,7 +755,7 @@ void ConstraintBase::GenerateEquations(IdList<Equation,hEquation> *l,
|
|||||||
ExprVector a = ea->VectorGetExprsInWorkplane(workplane);
|
ExprVector a = ea->VectorGetExprsInWorkplane(workplane);
|
||||||
ExprVector b = eb->VectorGetExprsInWorkplane(workplane);
|
ExprVector b = eb->VectorGetExprsInWorkplane(workplane);
|
||||||
|
|
||||||
if(workplane.v == EntityBase::FREE_IN_3D.v) {
|
if(workplane == EntityBase::FREE_IN_3D) {
|
||||||
ExprVector eq = VectorsParallel3d(a, b, valP);
|
ExprVector eq = VectorsParallel3d(a, b, valP);
|
||||||
AddEq(l, eq);
|
AddEq(l, eq);
|
||||||
} else {
|
} else {
|
||||||
@ -775,7 +775,7 @@ void ConstraintBase::GenerateEquations(IdList<Equation,hEquation> *l,
|
|||||||
|
|
||||||
case Type::WHERE_DRAGGED: {
|
case Type::WHERE_DRAGGED: {
|
||||||
EntityBase *ep = SK.GetEntity(ptA);
|
EntityBase *ep = SK.GetEntity(ptA);
|
||||||
if(workplane.v == EntityBase::FREE_IN_3D.v) {
|
if(workplane == EntityBase::FREE_IN_3D) {
|
||||||
ExprVector ev = ep->PointGetExprs();
|
ExprVector ev = ep->PointGetExprs();
|
||||||
Vector v = ep->PointGetNum();
|
Vector v = ep->PointGetNum();
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ void TextWindow::DescribeSelection() {
|
|||||||
Group *g = SK.GetGroup(e->group);
|
Group *g = SK.GetGroup(e->group);
|
||||||
Printf(false, "");
|
Printf(false, "");
|
||||||
Printf(false, "%FtIN GROUP%E %s", g->DescriptionString().c_str());
|
Printf(false, "%FtIN GROUP%E %s", g->DescriptionString().c_str());
|
||||||
if(e->workplane.v == Entity::FREE_IN_3D.v) {
|
if(e->workplane == Entity::FREE_IN_3D) {
|
||||||
Printf(false, "%FtNOT LOCKED IN WORKPLANE%E");
|
Printf(false, "%FtNOT LOCKED IN WORKPLANE%E");
|
||||||
} else {
|
} else {
|
||||||
Entity *w = SK.GetEntity(e->workplane);
|
Entity *w = SK.GetEntity(e->workplane);
|
||||||
@ -232,12 +232,13 @@ void TextWindow::DescribeSelection() {
|
|||||||
|
|
||||||
std::vector<hConstraint> lhc = {};
|
std::vector<hConstraint> lhc = {};
|
||||||
for(const Constraint &c : SK.constraint) {
|
for(const Constraint &c : SK.constraint) {
|
||||||
if(!(c.ptA.v == e->h.v ||
|
if(!(c.ptA == e->h ||
|
||||||
c.ptB.v == e->h.v ||
|
c.ptB == e->h ||
|
||||||
c.entityA.v == e->h.v ||
|
c.entityA == e->h ||
|
||||||
c.entityB.v == e->h.v ||
|
c.entityB == e->h ||
|
||||||
c.entityC.v == e->h.v ||
|
c.entityC == e->h ||
|
||||||
c.entityD.v == e->h.v)) continue;
|
c.entityD == e->h))
|
||||||
|
continue;
|
||||||
lhc.push_back(c.h);
|
lhc.push_back(c.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,8 +315,7 @@ void TextWindow::DescribeSelection() {
|
|||||||
Printf(true, " pt-ln distance = %Fi%s%E",
|
Printf(true, " pt-ln distance = %Fi%s%E",
|
||||||
SS.MmToString(pp.DistanceToLine(lp0, lp1.Minus(lp0))).c_str());
|
SS.MmToString(pp.DistanceToLine(lp0, lp1.Minus(lp0))).c_str());
|
||||||
hEntity wrkpl = SS.GW.ActiveWorkplane();
|
hEntity wrkpl = SS.GW.ActiveWorkplane();
|
||||||
if(wrkpl.v != Entity::FREE_IN_3D.v &&
|
if(wrkpl != Entity::FREE_IN_3D && !(p->workplane == wrkpl && ln->workplane == wrkpl)) {
|
||||||
!(p->workplane.v == wrkpl.v && ln->workplane.v == wrkpl.v)) {
|
|
||||||
Vector ppw = pp.ProjectInto(wrkpl);
|
Vector ppw = pp.ProjectInto(wrkpl);
|
||||||
Vector lp0w = lp0.ProjectInto(wrkpl);
|
Vector lp0w = lp0.ProjectInto(wrkpl);
|
||||||
Vector lp1w = lp1.ProjectInto(wrkpl);
|
Vector lp1w = lp1.ProjectInto(wrkpl);
|
||||||
@ -385,9 +385,8 @@ void TextWindow::DescribeSelection() {
|
|||||||
lhe.push_back(c->entityC);
|
lhe.push_back(c->entityC);
|
||||||
lhe.push_back(c->entityD);
|
lhe.push_back(c->entityD);
|
||||||
|
|
||||||
auto it = std::remove_if(lhe.begin(), lhe.end(),
|
auto it = std::remove_if(lhe.begin(), lhe.end(), [](hEntity he) {
|
||||||
[](hEntity he) {
|
return he == Entity::NO_ENTITY || !he.isFromRequest();
|
||||||
return he.v == Entity::NO_ENTITY.v || !he.isFromRequest();
|
|
||||||
});
|
});
|
||||||
lhe.erase(it, lhe.end());
|
lhe.erase(it, lhe.end());
|
||||||
|
|
||||||
|
11
src/draw.cpp
11
src/draw.cpp
@ -8,8 +8,8 @@
|
|||||||
#include "solvespace.h"
|
#include "solvespace.h"
|
||||||
|
|
||||||
bool GraphicsWindow::Selection::Equals(Selection *b) {
|
bool GraphicsWindow::Selection::Equals(Selection *b) {
|
||||||
if(entity.v != b->entity.v) return false;
|
if(entity != b->entity) return false;
|
||||||
if(constraint.v != b->constraint.v) return false;
|
if(constraint != b->constraint) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,8 @@ void GraphicsWindow::MakeUnselected(Selection *stog, bool coincidentPointTrick){
|
|||||||
Vector ep = e->PointGetNum();
|
Vector ep = e->PointGetNum();
|
||||||
for(s = selection.First(); s; s = selection.NextAfter(s)) {
|
for(s = selection.First(); s; s = selection.NextAfter(s)) {
|
||||||
if(!s->entity.v) continue;
|
if(!s->entity.v) continue;
|
||||||
if(s->entity.v == stog->entity.v) continue;
|
if(s->entity == stog->entity)
|
||||||
|
continue;
|
||||||
Entity *se = SK.GetEntity(s->entity);
|
Entity *se = SK.GetEntity(s->entity);
|
||||||
if(!se->IsPoint()) continue;
|
if(!se->IsPoint()) continue;
|
||||||
if(ep.Equals(se->PointGetNum())) {
|
if(ep.Equals(se->PointGetNum())) {
|
||||||
@ -211,7 +212,7 @@ void GraphicsWindow::SelectByMarquee() {
|
|||||||
|
|
||||||
Entity *e;
|
Entity *e;
|
||||||
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
||||||
if(e->group.v != SS.GW.activeGroup.v) continue;
|
if(e->group != SS.GW.activeGroup) continue;
|
||||||
if(e->IsFace() || e->IsDistance()) continue;
|
if(e->IsFace() || e->IsDistance()) continue;
|
||||||
if(!e->IsVisible()) continue;
|
if(!e->IsVisible()) continue;
|
||||||
|
|
||||||
@ -701,7 +702,7 @@ void GraphicsWindow::Draw(Canvas *canvas) {
|
|||||||
if(SS.showContourAreas) {
|
if(SS.showContourAreas) {
|
||||||
for(hGroup hg : SK.groupOrder) {
|
for(hGroup hg : SK.groupOrder) {
|
||||||
Group *g = SK.GetGroup(hg);
|
Group *g = SK.GetGroup(hg);
|
||||||
if(g->h.v != activeGroup.v) continue;
|
if(g->h != activeGroup) continue;
|
||||||
if(!(g->IsVisible())) continue;
|
if(!(g->IsVisible())) continue;
|
||||||
g->DrawContourAreaLabels(canvas);
|
g->DrawContourAreaLabels(canvas);
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ void Constraint::DoArcForAngle(Canvas *canvas, Canvas::hStroke hcs,
|
|||||||
Vector gr = camera.projRight.ScaledBy(1.0);
|
Vector gr = camera.projRight.ScaledBy(1.0);
|
||||||
Vector gu = camera.projUp.ScaledBy(1.0);
|
Vector gu = camera.projUp.ScaledBy(1.0);
|
||||||
|
|
||||||
if(workplane.v != Entity::FREE_IN_3D.v) {
|
if(workplane != Entity::FREE_IN_3D) {
|
||||||
a0 = a0.ProjectInto(workplane);
|
a0 = a0.ProjectInto(workplane);
|
||||||
b0 = b0.ProjectInto(workplane);
|
b0 = b0.ProjectInto(workplane);
|
||||||
da = da.ProjectVectorInto(workplane);
|
da = da.ProjectVectorInto(workplane);
|
||||||
@ -452,7 +452,7 @@ bool Constraint::IsVisible() const {
|
|||||||
if(!(g->visible)) return false;
|
if(!(g->visible)) return false;
|
||||||
// And likewise if the group is not the active group; except for comments
|
// And likewise if the group is not the active group; except for comments
|
||||||
// with an assigned style.
|
// with an assigned style.
|
||||||
if(g->h.v != SS.GW.activeGroup.v && !(type == Type::COMMENT && disp.style.v)) {
|
if(g->h != SS.GW.activeGroup && !(type == Type::COMMENT && disp.style.v)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(disp.style.v) {
|
if(disp.style.v) {
|
||||||
@ -529,7 +529,7 @@ void Constraint::DoLayout(DrawAs how, Canvas *canvas,
|
|||||||
Vector ap = SK.GetEntity(ptA)->PointGetNum();
|
Vector ap = SK.GetEntity(ptA)->PointGetNum();
|
||||||
Vector bp = SK.GetEntity(ptB)->PointGetNum();
|
Vector bp = SK.GetEntity(ptB)->PointGetNum();
|
||||||
|
|
||||||
if(workplane.v != Entity::FREE_IN_3D.v) {
|
if(workplane != Entity::FREE_IN_3D) {
|
||||||
DoProjectedPoint(canvas, hcs, &ap);
|
DoProjectedPoint(canvas, hcs, &ap);
|
||||||
DoProjectedPoint(canvas, hcs, &bp);
|
DoProjectedPoint(canvas, hcs, &bp);
|
||||||
}
|
}
|
||||||
@ -596,7 +596,7 @@ void Constraint::DoLayout(DrawAs how, Canvas *canvas,
|
|||||||
Vector lB = SK.GetEntity(line->point[1])->PointGetNum();
|
Vector lB = SK.GetEntity(line->point[1])->PointGetNum();
|
||||||
Vector dl = lB.Minus(lA);
|
Vector dl = lB.Minus(lA);
|
||||||
|
|
||||||
if(workplane.v != Entity::FREE_IN_3D.v) {
|
if(workplane != Entity::FREE_IN_3D) {
|
||||||
lA = lA.ProjectInto(workplane);
|
lA = lA.ProjectInto(workplane);
|
||||||
lB = lB.ProjectInto(workplane);
|
lB = lB.ProjectInto(workplane);
|
||||||
DoProjectedPoint(canvas, hcs, &pt);
|
DoProjectedPoint(canvas, hcs, &pt);
|
||||||
@ -638,7 +638,7 @@ void Constraint::DoLayout(DrawAs how, Canvas *canvas,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(workplane.v != Entity::FREE_IN_3D.v) {
|
if(workplane != Entity::FREE_IN_3D) {
|
||||||
// Draw the projection marker from the closest point on the
|
// Draw the projection marker from the closest point on the
|
||||||
// projected line to the projected point on the real line.
|
// projected line to the projected point on the real line.
|
||||||
Vector lAB = (lA.Minus(lB));
|
Vector lAB = (lA.Minus(lB));
|
||||||
@ -829,7 +829,7 @@ void Constraint::DoLayout(DrawAs how, Canvas *canvas,
|
|||||||
case Type::PERPENDICULAR: {
|
case Type::PERPENDICULAR: {
|
||||||
Vector u = Vector::From(0, 0, 0), v = Vector::From(0, 0, 0);
|
Vector u = Vector::From(0, 0, 0), v = Vector::From(0, 0, 0);
|
||||||
Vector rn, ru;
|
Vector rn, ru;
|
||||||
if(workplane.v == Entity::FREE_IN_3D.v) {
|
if(workplane == Entity::FREE_IN_3D) {
|
||||||
rn = gn;
|
rn = gn;
|
||||||
ru = gu;
|
ru = gu;
|
||||||
} else {
|
} else {
|
||||||
@ -882,7 +882,7 @@ void Constraint::DoLayout(DrawAs how, Canvas *canvas,
|
|||||||
v = norm->NormalV();
|
v = norm->NormalV();
|
||||||
} else if(type == Type::CUBIC_LINE_TANGENT) {
|
} else if(type == Type::CUBIC_LINE_TANGENT) {
|
||||||
Vector n;
|
Vector n;
|
||||||
if(workplane.v == Entity::FREE_IN_3D.v) {
|
if(workplane == Entity::FREE_IN_3D) {
|
||||||
u = gr;
|
u = gr;
|
||||||
v = gu;
|
v = gu;
|
||||||
n = gn;
|
n = gn;
|
||||||
@ -985,7 +985,7 @@ void Constraint::DoLayout(DrawAs how, Canvas *canvas,
|
|||||||
a = SK.GetEntity(e->point[0])->PointGetNum();
|
a = SK.GetEntity(e->point[0])->PointGetNum();
|
||||||
b = SK.GetEntity(e->point[1])->PointGetNum();
|
b = SK.GetEntity(e->point[1])->PointGetNum();
|
||||||
|
|
||||||
if(workplane.v != Entity::FREE_IN_3D.v) {
|
if(workplane != Entity::FREE_IN_3D) {
|
||||||
DoProjectedPoint(canvas, hcs, &a);
|
DoProjectedPoint(canvas, hcs, &a);
|
||||||
DoProjectedPoint(canvas, hcs, &b);
|
DoProjectedPoint(canvas, hcs, &b);
|
||||||
}
|
}
|
||||||
@ -1005,7 +1005,7 @@ void Constraint::DoLayout(DrawAs how, Canvas *canvas,
|
|||||||
Entity *forLen = SK.GetEntity(entityA);
|
Entity *forLen = SK.GetEntity(entityA);
|
||||||
Vector a = SK.GetEntity(forLen->point[0])->PointGetNum(),
|
Vector a = SK.GetEntity(forLen->point[0])->PointGetNum(),
|
||||||
b = SK.GetEntity(forLen->point[1])->PointGetNum();
|
b = SK.GetEntity(forLen->point[1])->PointGetNum();
|
||||||
if(workplane.v != Entity::FREE_IN_3D.v) {
|
if(workplane != Entity::FREE_IN_3D) {
|
||||||
DoProjectedPoint(canvas, hcs, &a);
|
DoProjectedPoint(canvas, hcs, &a);
|
||||||
DoProjectedPoint(canvas, hcs, &b);
|
DoProjectedPoint(canvas, hcs, &b);
|
||||||
}
|
}
|
||||||
@ -1017,7 +1017,7 @@ void Constraint::DoLayout(DrawAs how, Canvas *canvas,
|
|||||||
Vector la = SK.GetEntity(ln->point[0])->PointGetNum(),
|
Vector la = SK.GetEntity(ln->point[0])->PointGetNum(),
|
||||||
lb = SK.GetEntity(ln->point[1])->PointGetNum();
|
lb = SK.GetEntity(ln->point[1])->PointGetNum();
|
||||||
Vector pt = SK.GetEntity(ptA)->PointGetNum();
|
Vector pt = SK.GetEntity(ptA)->PointGetNum();
|
||||||
if(workplane.v != Entity::FREE_IN_3D.v) {
|
if(workplane != Entity::FREE_IN_3D) {
|
||||||
DoProjectedPoint(canvas, hcs, &pt);
|
DoProjectedPoint(canvas, hcs, &pt);
|
||||||
la = la.ProjectInto(workplane);
|
la = la.ProjectInto(workplane);
|
||||||
lb = lb.ProjectInto(workplane);
|
lb = lb.ProjectInto(workplane);
|
||||||
@ -1039,7 +1039,7 @@ void Constraint::DoLayout(DrawAs how, Canvas *canvas,
|
|||||||
Entity *pte = SK.GetEntity(i == 0 ? ptA : ptB);
|
Entity *pte = SK.GetEntity(i == 0 ? ptA : ptB);
|
||||||
Vector pt = pte->PointGetNum();
|
Vector pt = pte->PointGetNum();
|
||||||
|
|
||||||
if(workplane.v != Entity::FREE_IN_3D.v) {
|
if(workplane != Entity::FREE_IN_3D) {
|
||||||
DoProjectedPoint(canvas, hcs, &pt);
|
DoProjectedPoint(canvas, hcs, &pt);
|
||||||
la = la.ProjectInto(workplane);
|
la = la.ProjectInto(workplane);
|
||||||
lb = lb.ProjectInto(workplane);
|
lb = lb.ProjectInto(workplane);
|
||||||
@ -1104,7 +1104,7 @@ s:
|
|||||||
case Type::VERTICAL:
|
case Type::VERTICAL:
|
||||||
if(entityA.v) {
|
if(entityA.v) {
|
||||||
Vector r, u, n;
|
Vector r, u, n;
|
||||||
if(workplane.v == Entity::FREE_IN_3D.v) {
|
if(workplane == Entity::FREE_IN_3D) {
|
||||||
r = gr; u = gu; n = gn;
|
r = gr; u = gu; n = gn;
|
||||||
} else {
|
} else {
|
||||||
r = SK.GetEntity(workplane)->Normal()->NormalU();
|
r = SK.GetEntity(workplane)->Normal()->NormalU();
|
||||||
@ -1171,7 +1171,7 @@ s:
|
|||||||
|
|
||||||
case Type::COMMENT: {
|
case Type::COMMENT: {
|
||||||
Vector u, v;
|
Vector u, v;
|
||||||
if(workplane.v == Entity::FREE_IN_3D.v) {
|
if(workplane == Entity::FREE_IN_3D) {
|
||||||
u = gr;
|
u = gr;
|
||||||
v = gu;
|
v = gu;
|
||||||
} else {
|
} else {
|
||||||
|
@ -150,7 +150,7 @@ bool Entity::IsStylable() const {
|
|||||||
bool Entity::IsVisible() const {
|
bool Entity::IsVisible() const {
|
||||||
Group *g = SK.GetGroup(group);
|
Group *g = SK.GetGroup(group);
|
||||||
|
|
||||||
if(g->h.v == Group::HGROUP_REFERENCES.v && IsNormal()) {
|
if(g->h == Group::HGROUP_REFERENCES && IsNormal()) {
|
||||||
// The reference normals are always shown
|
// The reference normals are always shown
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ bool Entity::IsVisible() const {
|
|||||||
|
|
||||||
if(!SS.GW.showWorkplanes) {
|
if(!SS.GW.showWorkplanes) {
|
||||||
if(IsWorkplane() && !h.isFromRequest()) {
|
if(IsWorkplane() && !h.isFromRequest()) {
|
||||||
if(g->h.v != SS.GW.activeGroup.v) {
|
if(g->h != SS.GW.activeGroup) {
|
||||||
// The group-associated workplanes are hidden outside
|
// The group-associated workplanes are hidden outside
|
||||||
// their group.
|
// their group.
|
||||||
return false;
|
return false;
|
||||||
@ -453,7 +453,7 @@ void Entity::Draw(DrawAs how, Canvas *canvas) {
|
|||||||
zIndex = 5;
|
zIndex = 5;
|
||||||
} else if(how == DrawAs::HIDDEN) {
|
} else if(how == DrawAs::HIDDEN) {
|
||||||
zIndex = 2;
|
zIndex = 2;
|
||||||
} else if(group.v != SS.GW.activeGroup.v) {
|
} else if(group != SS.GW.activeGroup) {
|
||||||
zIndex = 3;
|
zIndex = 3;
|
||||||
} else {
|
} else {
|
||||||
zIndex = 4;
|
zIndex = 4;
|
||||||
@ -568,11 +568,11 @@ void Entity::Draw(DrawAs how, Canvas *canvas) {
|
|||||||
// dimmer for the ones at the model origin.
|
// dimmer for the ones at the model origin.
|
||||||
hRequest hr = h.request();
|
hRequest hr = h.request();
|
||||||
uint8_t luma = (asReference) ? 255 : 100;
|
uint8_t luma = (asReference) ? 255 : 100;
|
||||||
if(hr.v == Request::HREQUEST_REFERENCE_XY.v) {
|
if(hr == Request::HREQUEST_REFERENCE_XY) {
|
||||||
stroke.color = RgbaColor::From(0, 0, luma);
|
stroke.color = RgbaColor::From(0, 0, luma);
|
||||||
} else if(hr.v == Request::HREQUEST_REFERENCE_YZ.v) {
|
} else if(hr == Request::HREQUEST_REFERENCE_YZ) {
|
||||||
stroke.color = RgbaColor::From(luma, 0, 0);
|
stroke.color = RgbaColor::From(luma, 0, 0);
|
||||||
} else if(hr.v == Request::HREQUEST_REFERENCE_ZX.v) {
|
} else if(hr == Request::HREQUEST_REFERENCE_ZX) {
|
||||||
stroke.color = RgbaColor::From(0, luma, 0);
|
stroke.color = RgbaColor::From(0, luma, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ ExprVector EntityBase::VectorGetExprsInWorkplane(hEntity wrkpl) const {
|
|||||||
case Type::NORMAL_N_ROT:
|
case Type::NORMAL_N_ROT:
|
||||||
case Type::NORMAL_N_ROT_AA: {
|
case Type::NORMAL_N_ROT_AA: {
|
||||||
ExprVector ev = NormalExprsN();
|
ExprVector ev = NormalExprsN();
|
||||||
if(wrkpl.v == EntityBase::FREE_IN_3D.v) {
|
if(wrkpl == EntityBase::FREE_IN_3D) {
|
||||||
return ev;
|
return ev;
|
||||||
}
|
}
|
||||||
// Get the offset and basis vectors for this weird exotic csys.
|
// Get the offset and basis vectors for this weird exotic csys.
|
||||||
@ -565,7 +565,7 @@ ExprVector EntityBase::PointGetExprs() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EntityBase::PointGetExprsInWorkplane(hEntity wrkpl, Expr **u, Expr **v) const {
|
void EntityBase::PointGetExprsInWorkplane(hEntity wrkpl, Expr **u, Expr **v) const {
|
||||||
if(type == Type::POINT_IN_2D && workplane.v == wrkpl.v) {
|
if(type == Type::POINT_IN_2D && workplane == wrkpl) {
|
||||||
// They want our coordinates in the form that we've written them,
|
// They want our coordinates in the form that we've written them,
|
||||||
// very nice.
|
// very nice.
|
||||||
*u = Expr::From(param[0]);
|
*u = Expr::From(param[0]);
|
||||||
@ -587,7 +587,7 @@ void EntityBase::PointGetExprsInWorkplane(hEntity wrkpl, Expr **u, Expr **v) con
|
|||||||
}
|
}
|
||||||
|
|
||||||
ExprVector EntityBase::PointGetExprsInWorkplane(hEntity wrkpl) const {
|
ExprVector EntityBase::PointGetExprsInWorkplane(hEntity wrkpl) const {
|
||||||
if(wrkpl.v == Entity::FREE_IN_3D.v) {
|
if(wrkpl == Entity::FREE_IN_3D) {
|
||||||
return PointGetExprs();
|
return PointGetExprs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -873,11 +873,11 @@ void EntityBase::GenerateEquations(IdList<Equation,hEquation> *l) const {
|
|||||||
int i;
|
int i;
|
||||||
for(i = 0; i < SK.constraint.n; i++) {
|
for(i = 0; i < SK.constraint.n; i++) {
|
||||||
ConstraintBase *c = &(SK.constraint.elem[i]);
|
ConstraintBase *c = &(SK.constraint.elem[i]);
|
||||||
if(c->group.v != group.v) continue;
|
if(c->group != group) continue;
|
||||||
if(c->type != Constraint::Type::POINTS_COINCIDENT) continue;
|
if(c->type != Constraint::Type::POINTS_COINCIDENT) continue;
|
||||||
|
|
||||||
if((c->ptA.v == point[1].v && c->ptB.v == point[2].v) ||
|
if((c->ptA == point[1] && c->ptB == point[2]) ||
|
||||||
(c->ptA.v == point[2].v && c->ptB.v == point[1].v))
|
(c->ptA == point[2] && c->ptB == point[1]))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ void SolveSpaceUI::ExportSectionTo(const Platform::Path &filename) {
|
|||||||
|
|
||||||
SS.GW.GroupSelection();
|
SS.GW.GroupSelection();
|
||||||
auto const &gs = SS.GW.gs;
|
auto const &gs = SS.GW.gs;
|
||||||
if((gs.n == 0 && g->activeWorkplane.v != Entity::FREE_IN_3D.v)) {
|
if((gs.n == 0 && g->activeWorkplane != Entity::FREE_IN_3D)) {
|
||||||
Entity *wrkpl = SK.GetEntity(g->activeWorkplane);
|
Entity *wrkpl = SK.GetEntity(g->activeWorkplane);
|
||||||
origin = wrkpl->WorkplaneGetOffset();
|
origin = wrkpl->WorkplaneGetOffset();
|
||||||
n = wrkpl->Normal()->NormalN();
|
n = wrkpl->Normal()->NormalN();
|
||||||
|
16
src/expr.cpp
16
src/expr.cpp
@ -361,8 +361,8 @@ Expr *Expr::PartialWrt(hParam p) const {
|
|||||||
Expr *da, *db;
|
Expr *da, *db;
|
||||||
|
|
||||||
switch(op) {
|
switch(op) {
|
||||||
case Op::PARAM_PTR: return From(p.v == parp->h.v ? 1 : 0);
|
case Op::PARAM_PTR: return From(p == parp->h ? 1 : 0);
|
||||||
case Op::PARAM: return From(p.v == parh.v ? 1 : 0);
|
case Op::PARAM: return From(p == parh ? 1 : 0);
|
||||||
|
|
||||||
case Op::CONSTANT: return From(0.0);
|
case Op::CONSTANT: return From(0.0);
|
||||||
case Op::VARIABLE: ssassert(false, "Not supported yet");
|
case Op::VARIABLE: ssassert(false, "Not supported yet");
|
||||||
@ -412,8 +412,8 @@ uint64_t Expr::ParamsUsed() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Expr::DependsOn(hParam p) const {
|
bool Expr::DependsOn(hParam p) const {
|
||||||
if(op == Op::PARAM) return (parh.v == p.v);
|
if(op == Op::PARAM) return (parh == p);
|
||||||
if(op == Op::PARAM_PTR) return (parp->h.v == p.v);
|
if(op == Op::PARAM_PTR) return (parp->h == p);
|
||||||
|
|
||||||
int c = Children();
|
int c = Children();
|
||||||
if(c == 1) return a->DependsOn(p);
|
if(c == 1) return a->DependsOn(p);
|
||||||
@ -494,7 +494,7 @@ Expr *Expr::FoldConstants() {
|
|||||||
void Expr::Substitute(hParam oldh, hParam newh) {
|
void Expr::Substitute(hParam oldh, hParam newh) {
|
||||||
ssassert(op != Op::PARAM_PTR, "Expected an expression that refer to params via handles");
|
ssassert(op != Op::PARAM_PTR, "Expected an expression that refer to params via handles");
|
||||||
|
|
||||||
if(op == Op::PARAM && parh.v == oldh.v) {
|
if(op == Op::PARAM && parh == oldh) {
|
||||||
parh = newh;
|
parh = newh;
|
||||||
}
|
}
|
||||||
int c = Children();
|
int c = Children();
|
||||||
@ -528,11 +528,11 @@ hParam Expr::ReferencedParams(ParamList *pl) const {
|
|||||||
hParam pa, pb;
|
hParam pa, pb;
|
||||||
pa = a->ReferencedParams(pl);
|
pa = a->ReferencedParams(pl);
|
||||||
pb = b->ReferencedParams(pl);
|
pb = b->ReferencedParams(pl);
|
||||||
if(pa.v == NO_PARAMS.v) {
|
if(pa == NO_PARAMS) {
|
||||||
return pb;
|
return pb;
|
||||||
} else if(pb.v == NO_PARAMS.v) {
|
} else if(pb == NO_PARAMS) {
|
||||||
return pa;
|
return pa;
|
||||||
} else if(pa.v == pb.v) {
|
} else if(pa == pb) {
|
||||||
return pa; // either, doesn't matter
|
return pa; // either, doesn't matter
|
||||||
} else {
|
} else {
|
||||||
return MULTIPLE_PARAMS;
|
return MULTIPLE_PARAMS;
|
||||||
|
@ -18,7 +18,7 @@ void SolveSpaceUI::MarkGroupDirty(hGroup hg, bool onlyThis) {
|
|||||||
bool go = false;
|
bool go = false;
|
||||||
for(i = 0; i < SK.groupOrder.n; i++) {
|
for(i = 0; i < SK.groupOrder.n; i++) {
|
||||||
Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
|
Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
|
||||||
if(g->h.v == hg.v) {
|
if(g->h == hg) {
|
||||||
go = true;
|
go = true;
|
||||||
}
|
}
|
||||||
if(go) {
|
if(go) {
|
||||||
@ -72,7 +72,7 @@ bool SolveSpaceUI::GroupExists(hGroup hg) {
|
|||||||
bool SolveSpaceUI::EntityExists(hEntity he) {
|
bool SolveSpaceUI::EntityExists(hEntity he) {
|
||||||
// A nonexstient entity is acceptable, though, usually just means it
|
// A nonexstient entity is acceptable, though, usually just means it
|
||||||
// doesn't apply.
|
// doesn't apply.
|
||||||
if(he.v == Entity::NO_ENTITY.v) return true;
|
if(he == Entity::NO_ENTITY) return true;
|
||||||
return SK.entity.FindByIdNoOops(he) ? true : false;
|
return SK.entity.FindByIdNoOops(he) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ bool SolveSpaceUI::PruneRequests(hGroup hg) {
|
|||||||
int i;
|
int i;
|
||||||
for(i = 0; i < SK.entity.n; i++) {
|
for(i = 0; i < SK.entity.n; i++) {
|
||||||
Entity *e = &(SK.entity.elem[i]);
|
Entity *e = &(SK.entity.elem[i]);
|
||||||
if(e->group.v != hg.v) continue;
|
if(e->group != hg) continue;
|
||||||
|
|
||||||
if(EntityExists(e->workplane)) continue;
|
if(EntityExists(e->workplane)) continue;
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ bool SolveSpaceUI::PruneConstraints(hGroup hg) {
|
|||||||
int i;
|
int i;
|
||||||
for(i = 0; i < SK.constraint.n; i++) {
|
for(i = 0; i < SK.constraint.n; i++) {
|
||||||
Constraint *c = &(SK.constraint.elem[i]);
|
Constraint *c = &(SK.constraint.elem[i]);
|
||||||
if(c->group.v != hg.v) continue;
|
if(c->group != hg) continue;
|
||||||
|
|
||||||
if(EntityExists(c->workplane) &&
|
if(EntityExists(c->workplane) &&
|
||||||
EntityExists(c->ptA) &&
|
EntityExists(c->ptA) &&
|
||||||
@ -164,7 +164,7 @@ void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox)
|
|||||||
if((!g->clean) || !g->IsSolvedOkay()) {
|
if((!g->clean) || !g->IsSolvedOkay()) {
|
||||||
first = min(first, i);
|
first = min(first, i);
|
||||||
}
|
}
|
||||||
if(g->h.v == SS.GW.activeGroup.v) {
|
if(g->h == SS.GW.activeGroup) {
|
||||||
last = i;
|
last = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox)
|
|||||||
|
|
||||||
case Generate::UNTIL_ACTIVE: {
|
case Generate::UNTIL_ACTIVE: {
|
||||||
for(i = 0; i < SK.groupOrder.n; i++) {
|
for(i = 0; i < SK.groupOrder.n; i++) {
|
||||||
if(SK.groupOrder.elem[i].v == SS.GW.activeGroup.v)
|
if(SK.groupOrder.elem[i] == SS.GW.activeGroup)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,13 +235,13 @@ void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox)
|
|||||||
|
|
||||||
for(j = 0; j < SK.request.n; j++) {
|
for(j = 0; j < SK.request.n; j++) {
|
||||||
Request *r = &(SK.request.elem[j]);
|
Request *r = &(SK.request.elem[j]);
|
||||||
if(r->group.v != g->h.v) continue;
|
if(r->group != g->h) continue;
|
||||||
|
|
||||||
r->Generate(&(SK.entity), &(SK.param));
|
r->Generate(&(SK.entity), &(SK.param));
|
||||||
}
|
}
|
||||||
for(j = 0; j < SK.constraint.n; j++) {
|
for(j = 0; j < SK.constraint.n; j++) {
|
||||||
Constraint *c = &SK.constraint.elem[j];
|
Constraint *c = &SK.constraint.elem[j];
|
||||||
if(c->group.v != g->h.v) continue;
|
if(c->group != g->h) continue;
|
||||||
|
|
||||||
c->Generate(&(SK.param));
|
c->Generate(&(SK.param));
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(g->h.v == Group::HGROUP_REFERENCES.v) {
|
if(g->h == Group::HGROUP_REFERENCES) {
|
||||||
ForceReferences();
|
ForceReferences();
|
||||||
g->solved.how = SolveResult::OKAY;
|
g->solved.how = SolveResult::OKAY;
|
||||||
g->clean = true;
|
g->clean = true;
|
||||||
@ -512,13 +512,13 @@ void SolveSpaceUI::WriteEqSystemForGroup(hGroup hg) {
|
|||||||
// And generate all the params for requests in this group
|
// And generate all the params for requests in this group
|
||||||
for(i = 0; i < SK.request.n; i++) {
|
for(i = 0; i < SK.request.n; i++) {
|
||||||
Request *r = &(SK.request.elem[i]);
|
Request *r = &(SK.request.elem[i]);
|
||||||
if(r->group.v != hg.v) continue;
|
if(r->group != hg) continue;
|
||||||
|
|
||||||
r->Generate(&(sys.entity), &(sys.param));
|
r->Generate(&(sys.entity), &(sys.param));
|
||||||
}
|
}
|
||||||
for(i = 0; i < SK.constraint.n; i++) {
|
for(i = 0; i < SK.constraint.n; i++) {
|
||||||
Constraint *c = &SK.constraint.elem[i];
|
Constraint *c = &SK.constraint.elem[i];
|
||||||
if(c->group.v != hg.v) continue;
|
if(c->group != hg) continue;
|
||||||
|
|
||||||
c->Generate(&(sys.param));
|
c->Generate(&(sys.param));
|
||||||
}
|
}
|
||||||
@ -565,7 +565,7 @@ bool SolveSpaceUI::ActiveGroupsOkay() {
|
|||||||
Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
|
Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
|
||||||
if(!g->IsSolvedOkay())
|
if(!g->IsSolvedOkay())
|
||||||
return false;
|
return false;
|
||||||
if(g->h.v == SS.GW.activeGroup.v)
|
if(g->h == SS.GW.activeGroup)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -845,10 +845,10 @@ void GraphicsWindow::EnsureValidActives() {
|
|||||||
bool change = false;
|
bool change = false;
|
||||||
// The active group must exist, and not be the references.
|
// The active group must exist, and not be the references.
|
||||||
Group *g = SK.group.FindByIdNoOops(activeGroup);
|
Group *g = SK.group.FindByIdNoOops(activeGroup);
|
||||||
if((!g) || (g->h.v == Group::HGROUP_REFERENCES.v)) {
|
if((!g) || (g->h == Group::HGROUP_REFERENCES)) {
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < SK.groupOrder.n; i++) {
|
for(i = 0; i < SK.groupOrder.n; i++) {
|
||||||
if(SK.groupOrder.elem[i].v != Group::HGROUP_REFERENCES.v) {
|
if(SK.groupOrder.elem[i] != Group::HGROUP_REFERENCES) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -875,7 +875,7 @@ void GraphicsWindow::EnsureValidActives() {
|
|||||||
Entity *e = SK.entity.FindByIdNoOops(ActiveWorkplane());
|
Entity *e = SK.entity.FindByIdNoOops(ActiveWorkplane());
|
||||||
if(e) {
|
if(e) {
|
||||||
hGroup hgw = e->group;
|
hGroup hgw = e->group;
|
||||||
if(hgw.v != activeGroup.v && SS.GroupsInOrder(activeGroup, hgw)) {
|
if(hgw != activeGroup && SS.GroupsInOrder(activeGroup, hgw)) {
|
||||||
// The active workplane is in a group that comes after the
|
// The active workplane is in a group that comes after the
|
||||||
// active group; so any request or constraint will fail.
|
// active group; so any request or constraint will fail.
|
||||||
SetWorkplaneFreeIn3d();
|
SetWorkplaneFreeIn3d();
|
||||||
@ -932,7 +932,7 @@ hEntity GraphicsWindow::ActiveWorkplane() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool GraphicsWindow::LockedInWorkplane() {
|
bool GraphicsWindow::LockedInWorkplane() {
|
||||||
return (SS.GW.ActiveWorkplane().v != Entity::FREE_IN_3D.v);
|
return (SS.GW.ActiveWorkplane() != Entity::FREE_IN_3D);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsWindow::ForceTextWindowShown() {
|
void GraphicsWindow::ForceTextWindowShown() {
|
||||||
@ -1027,7 +1027,7 @@ void GraphicsWindow::MenuEdit(Command id) {
|
|||||||
case Command::SELECT_ALL: {
|
case Command::SELECT_ALL: {
|
||||||
Entity *e;
|
Entity *e;
|
||||||
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
||||||
if(e->group.v != SS.GW.activeGroup.v) continue;
|
if(e->group != SS.GW.activeGroup) continue;
|
||||||
if(e->IsFace() || e->IsDistance()) continue;
|
if(e->IsFace() || e->IsDistance()) continue;
|
||||||
if(!e->IsVisible()) continue;
|
if(!e->IsVisible()) continue;
|
||||||
|
|
||||||
@ -1045,7 +1045,7 @@ void GraphicsWindow::MenuEdit(Command id) {
|
|||||||
do {
|
do {
|
||||||
didSomething = false;
|
didSomething = false;
|
||||||
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
||||||
if(e->group.v != SS.GW.activeGroup.v) continue;
|
if(e->group != SS.GW.activeGroup) continue;
|
||||||
if(!e->HasEndpoints()) continue;
|
if(!e->HasEndpoints()) continue;
|
||||||
if(!e->IsVisible()) continue;
|
if(!e->IsVisible()) continue;
|
||||||
|
|
||||||
@ -1056,7 +1056,7 @@ void GraphicsWindow::MenuEdit(Command id) {
|
|||||||
List<Selection> *ls = &(SS.GW.selection);
|
List<Selection> *ls = &(SS.GW.selection);
|
||||||
for(Selection *s = ls->First(); s; s = ls->NextAfter(s)) {
|
for(Selection *s = ls->First(); s; s = ls->NextAfter(s)) {
|
||||||
if(!s->entity.v) continue;
|
if(!s->entity.v) continue;
|
||||||
if(s->entity.v == e->h.v) {
|
if(s->entity == e->h) {
|
||||||
alreadySelected = true;
|
alreadySelected = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ bool Group::IsVisible() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t Group::GetNumConstraints(void) {
|
size_t Group::GetNumConstraints(void) {
|
||||||
return SK.constraint.CountIf([&](Constraint const & c) { return c.group.v == h.v; });
|
return SK.constraint.CountIf([&](Constraint const & c) { return c.group == h; });
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector Group::ExtrusionGetVector() {
|
Vector Group::ExtrusionGetVector() {
|
||||||
@ -288,7 +288,7 @@ void Group::MenuGroup(Command id, Platform::Path linkFile) {
|
|||||||
Group *gi = SK.GetGroup(SK.groupOrder.elem[i]);
|
Group *gi = SK.GetGroup(SK.groupOrder.elem[i]);
|
||||||
if(afterActive)
|
if(afterActive)
|
||||||
gi->order += 1;
|
gi->order += 1;
|
||||||
if(gi->h.v == SS.GW.activeGroup.v) {
|
if(gi->h == SS.GW.activeGroup) {
|
||||||
g.order = gi->order + 1;
|
g.order = gi->order + 1;
|
||||||
afterActive = true;
|
afterActive = true;
|
||||||
}
|
}
|
||||||
@ -450,7 +450,7 @@ void Group::Generate(IdList<Entity,hEntity> *entity,
|
|||||||
hEntity pt = { 0 };
|
hEntity pt = { 0 };
|
||||||
for(i = 0; i < entity->n; i++) {
|
for(i = 0; i < entity->n; i++) {
|
||||||
Entity *e = &(entity->elem[i]);
|
Entity *e = &(entity->elem[i]);
|
||||||
if(e->group.v != opA.v) continue;
|
if(e->group != opA) continue;
|
||||||
|
|
||||||
if(e->IsPoint()) pt = e->h;
|
if(e->IsPoint()) pt = e->h;
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ void Group::Generate(IdList<Entity,hEntity> *entity,
|
|||||||
|
|
||||||
for(i = 0; i < entity->n; i++) {
|
for(i = 0; i < entity->n; i++) {
|
||||||
Entity *e = &(entity->elem[i]);
|
Entity *e = &(entity->elem[i]);
|
||||||
if(e->group.v != opA.v) continue;
|
if(e->group != opA) continue;
|
||||||
|
|
||||||
e->CalculateNumerical(/*forExport=*/false);
|
e->CalculateNumerical(/*forExport=*/false);
|
||||||
hEntity he = e->h;
|
hEntity he = e->h;
|
||||||
@ -532,7 +532,7 @@ void Group::Generate(IdList<Entity,hEntity> *entity,
|
|||||||
|
|
||||||
for(i = 0; i < entity->n; i++) {
|
for(i = 0; i < entity->n; i++) {
|
||||||
Entity *e = &(entity->elem[i]);
|
Entity *e = &(entity->elem[i]);
|
||||||
if(e->group.v != opA.v)
|
if(e->group != opA)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
e->CalculateNumerical(/*forExport=*/false);
|
e->CalculateNumerical(/*forExport=*/false);
|
||||||
@ -542,7 +542,7 @@ void Group::Generate(IdList<Entity,hEntity> *entity,
|
|||||||
NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, CopyAs::NUMERIC);
|
NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, CopyAs::NUMERIC);
|
||||||
|
|
||||||
for(a = 0; a < 2; a++) {
|
for(a = 0; a < 2; a++) {
|
||||||
if(e->group.v != opA.v)
|
if(e->group != opA)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
e->CalculateNumerical(false);
|
e->CalculateNumerical(false);
|
||||||
@ -578,7 +578,7 @@ void Group::Generate(IdList<Entity,hEntity> *entity,
|
|||||||
for(a = a0; a < n; a++) {
|
for(a = a0; a < n; a++) {
|
||||||
for(i = 0; i < entity->n; i++) {
|
for(i = 0; i < entity->n; i++) {
|
||||||
Entity *e = &(entity->elem[i]);
|
Entity *e = &(entity->elem[i]);
|
||||||
if(e->group.v != opA.v) continue;
|
if(e->group != opA) continue;
|
||||||
|
|
||||||
e->CalculateNumerical(/*forExport=*/false);
|
e->CalculateNumerical(/*forExport=*/false);
|
||||||
CopyEntity(entity, e,
|
CopyEntity(entity, e,
|
||||||
@ -613,7 +613,7 @@ void Group::Generate(IdList<Entity,hEntity> *entity,
|
|||||||
for(a = a0; a < n; a++) {
|
for(a = a0; a < n; a++) {
|
||||||
for(i = 0; i < entity->n; i++) {
|
for(i = 0; i < entity->n; i++) {
|
||||||
Entity *e = &(entity->elem[i]);
|
Entity *e = &(entity->elem[i]);
|
||||||
if(e->group.v != opA.v) continue;
|
if(e->group != opA) continue;
|
||||||
|
|
||||||
e->CalculateNumerical(/*forExport=*/false);
|
e->CalculateNumerical(/*forExport=*/false);
|
||||||
CopyEntity(entity, e,
|
CopyEntity(entity, e,
|
||||||
@ -687,7 +687,7 @@ void Group::GenerateEquations(IdList<Equation,hEquation> *l) {
|
|||||||
#undef EC
|
#undef EC
|
||||||
#undef EP
|
#undef EP
|
||||||
} else if(type == Type::EXTRUDE) {
|
} else if(type == Type::EXTRUDE) {
|
||||||
if(predef.entityB.v != Entity::FREE_IN_3D.v) {
|
if(predef.entityB != Entity::FREE_IN_3D) {
|
||||||
// The extrusion path is locked along a line, normal to the
|
// The extrusion path is locked along a line, normal to the
|
||||||
// specified workplane.
|
// specified workplane.
|
||||||
Entity *w = SK.GetEntity(predef.entityB);
|
Entity *w = SK.GetEntity(predef.entityB);
|
||||||
@ -702,7 +702,7 @@ void Group::GenerateEquations(IdList<Equation,hEquation> *l) {
|
|||||||
AddEq(l, v.Dot(extruden), 1);
|
AddEq(l, v.Dot(extruden), 1);
|
||||||
}
|
}
|
||||||
} else if(type == Type::TRANSLATE) {
|
} else if(type == Type::TRANSLATE) {
|
||||||
if(predef.entityB.v != Entity::FREE_IN_3D.v) {
|
if(predef.entityB != Entity::FREE_IN_3D) {
|
||||||
Entity *w = SK.GetEntity(predef.entityB);
|
Entity *w = SK.GetEntity(predef.entityB);
|
||||||
ExprVector n = w->Normal()->NormalExprsN();
|
ExprVector n = w->Normal()->NormalExprsN();
|
||||||
ExprVector trans;
|
ExprVector trans;
|
||||||
|
@ -16,7 +16,7 @@ void Group::AssembleLoops(bool *allClosed,
|
|||||||
int i;
|
int i;
|
||||||
for(i = 0; i < SK.entity.n; i++) {
|
for(i = 0; i < SK.entity.n; i++) {
|
||||||
Entity *e = &(SK.entity.elem[i]);
|
Entity *e = &(SK.entity.elem[i]);
|
||||||
if(e->group.v != h.v) continue;
|
if(e->group != h) continue;
|
||||||
if(e->construction) continue;
|
if(e->construction) continue;
|
||||||
if(e->forceHidden) continue;
|
if(e->forceHidden) continue;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ void SShell::RemapFaces(Group *g, int remap) {
|
|||||||
SSurface *ss;
|
SSurface *ss;
|
||||||
for(ss = surface.First(); ss; ss = surface.NextAfter(ss)){
|
for(ss = surface.First(); ss; ss = surface.NextAfter(ss)){
|
||||||
hEntity face = { ss->face };
|
hEntity face = { ss->face };
|
||||||
if(face.v == Entity::NO_ENTITY.v) continue;
|
if(face == Entity::NO_ENTITY) continue;
|
||||||
|
|
||||||
face = g->Remap(face, remap);
|
face = g->Remap(face, remap);
|
||||||
ss->face = face.v;
|
ss->face = face.v;
|
||||||
@ -95,7 +95,7 @@ void SMesh::RemapFaces(Group *g, int remap) {
|
|||||||
STriangle *tr;
|
STriangle *tr;
|
||||||
for(tr = l.First(); tr; tr = l.NextAfter(tr)) {
|
for(tr = l.First(); tr; tr = l.NextAfter(tr)) {
|
||||||
hEntity face = { tr->meta.face };
|
hEntity face = { tr->meta.face };
|
||||||
if(face.v == Entity::NO_ENTITY.v) continue;
|
if(face == Entity::NO_ENTITY) continue;
|
||||||
|
|
||||||
face = g->Remap(face, remap);
|
face = g->Remap(face, remap);
|
||||||
tr->meta.face = face.v;
|
tr->meta.face = face.v;
|
||||||
@ -261,7 +261,7 @@ void Group::GenerateShellAndMesh() {
|
|||||||
|
|
||||||
Entity *e;
|
Entity *e;
|
||||||
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
||||||
if(e->group.v != opA.v) continue;
|
if(e->group != opA) continue;
|
||||||
if(e->type != Entity::Type::LINE_SEGMENT) continue;
|
if(e->type != Entity::Type::LINE_SEGMENT) continue;
|
||||||
|
|
||||||
Vector a = SK.GetEntity(e->point[0])->PointGetNum(),
|
Vector a = SK.GetEntity(e->point[0])->PointGetNum(),
|
||||||
@ -458,7 +458,7 @@ void Group::GenerateDisplayItems() {
|
|||||||
displayMesh.PrecomputeTransparency();
|
displayMesh.PrecomputeTransparency();
|
||||||
|
|
||||||
// Recalculate mass center if needed
|
// Recalculate mass center if needed
|
||||||
if(SS.centerOfMass.draw && SS.centerOfMass.dirty && h.v == SS.GW.activeGroup.v) {
|
if(SS.centerOfMass.draw && SS.centerOfMass.dirty && h == SS.GW.activeGroup) {
|
||||||
SS.UpdateCenterOfMass();
|
SS.UpdateCenterOfMass();
|
||||||
}
|
}
|
||||||
displayDirty = false;
|
displayDirty = false;
|
||||||
@ -469,7 +469,7 @@ Group *Group::PreviousGroup() const {
|
|||||||
int i;
|
int i;
|
||||||
for(i = 0; i < SK.groupOrder.n; i++) {
|
for(i = 0; i < SK.groupOrder.n; i++) {
|
||||||
Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
|
Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
|
||||||
if(g->h.v == h.v) break;
|
if(g->h == h) break;
|
||||||
}
|
}
|
||||||
if(i == 0 || i >= SK.groupOrder.n) return NULL;
|
if(i == 0 || i >= SK.groupOrder.n) return NULL;
|
||||||
return SK.GetGroup(SK.groupOrder.elem[i - 1]);
|
return SK.GetGroup(SK.groupOrder.elem[i - 1]);
|
||||||
@ -687,7 +687,7 @@ void Group::DrawFilledPaths(Canvas *canvas) {
|
|||||||
if(s->filled) {
|
if(s->filled) {
|
||||||
// This is a filled loop, where the user specified a fill color.
|
// This is a filled loop, where the user specified a fill color.
|
||||||
fill.color = s->fillColor;
|
fill.color = s->fillColor;
|
||||||
} else if(h.v == SS.GW.activeGroup.v && SS.checkClosedContour &&
|
} else if(h == SS.GW.activeGroup && SS.checkClosedContour &&
|
||||||
polyError.how == PolyError::GOOD) {
|
polyError.how == PolyError::GOOD) {
|
||||||
// If this is the active group, and we are supposed to check
|
// If this is the active group, and we are supposed to check
|
||||||
// for closed contours, and we do indeed have a closed and
|
// for closed contours, and we do indeed have a closed and
|
||||||
|
@ -455,8 +455,8 @@ public:
|
|||||||
Entity *e = SK.GetEntity(he);
|
Entity *e = SK.GetEntity(he);
|
||||||
Vector pos = e->PointGetNum();
|
Vector pos = e->PointGetNum();
|
||||||
hEntity p = findPoint(pos);
|
hEntity p = findPoint(pos);
|
||||||
if(p.v == he.v) return;
|
if(p == he) return;
|
||||||
if(p.v != Entity::NO_ENTITY.v) {
|
if(p != Entity::NO_ENTITY) {
|
||||||
if(constrain) {
|
if(constrain) {
|
||||||
Constraint::ConstrainCoincident(he, p);
|
Constraint::ConstrainCoincident(he, p);
|
||||||
}
|
}
|
||||||
@ -475,7 +475,7 @@ public:
|
|||||||
|
|
||||||
hEntity createOrGetPoint(const Vector &p) {
|
hEntity createOrGetPoint(const Vector &p) {
|
||||||
hEntity he = findPoint(p);
|
hEntity he = findPoint(p);
|
||||||
if(he.v != Entity::NO_ENTITY.v) return he;
|
if(he != Entity::NO_ENTITY) return he;
|
||||||
|
|
||||||
hRequest hr = SS.GW.AddRequest(Request::Type::DATUM_POINT, /*rememberForUndo=*/false);
|
hRequest hr = SS.GW.AddRequest(Request::Type::DATUM_POINT, /*rememberForUndo=*/false);
|
||||||
he = hr.entity(0);
|
he = hr.entity(0);
|
||||||
|
@ -15,8 +15,8 @@ void GraphicsWindow::ReplacePointInConstraints(hEntity oldpt, hEntity newpt) {
|
|||||||
int i;
|
int i;
|
||||||
for(i = 0; i < SK.constraint.n; i++) {
|
for(i = 0; i < SK.constraint.n; i++) {
|
||||||
Constraint *c = &(SK.constraint.elem[i]);
|
Constraint *c = &(SK.constraint.elem[i]);
|
||||||
if(c->ptA.v == oldpt.v) c->ptA = newpt;
|
if(c->ptA == oldpt) c->ptA = newpt;
|
||||||
if(c->ptB.v == oldpt.v) c->ptB = newpt;
|
if(c->ptB == oldpt) c->ptB = newpt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ void GraphicsWindow::RemoveConstraintsForPointBeingDeleted(hEntity hpt) {
|
|||||||
SK.constraint.ClearTags();
|
SK.constraint.ClearTags();
|
||||||
for(int i = 0; i < SK.constraint.n; i++) {
|
for(int i = 0; i < SK.constraint.n; i++) {
|
||||||
Constraint *c = &(SK.constraint.elem[i]);
|
Constraint *c = &(SK.constraint.elem[i]);
|
||||||
if(c->ptA.v == hpt.v || c->ptB.v == hpt.v) {
|
if(c->ptA == hpt || c->ptB == hpt) {
|
||||||
c->tag = 1;
|
c->tag = 1;
|
||||||
(SS.deleted.constraints)++;
|
(SS.deleted.constraints)++;
|
||||||
if(c->type != Constraint::Type::POINTS_COINCIDENT &&
|
if(c->type != Constraint::Type::POINTS_COINCIDENT &&
|
||||||
@ -49,12 +49,12 @@ void GraphicsWindow::RemoveConstraintsForPointBeingDeleted(hEntity hpt) {
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void GraphicsWindow::FixConstraintsForRequestBeingDeleted(hRequest hr) {
|
void GraphicsWindow::FixConstraintsForRequestBeingDeleted(hRequest hr) {
|
||||||
Request *r = SK.GetRequest(hr);
|
Request *r = SK.GetRequest(hr);
|
||||||
if(r->group.v != SS.GW.activeGroup.v) return;
|
if(r->group != SS.GW.activeGroup) return;
|
||||||
|
|
||||||
Entity *e;
|
Entity *e;
|
||||||
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
||||||
if(!(e->h.isFromRequest())) continue;
|
if(!(e->h.isFromRequest())) continue;
|
||||||
if(e->h.request().v != hr.v) continue;
|
if(e->h.request() != hr) continue;
|
||||||
|
|
||||||
if(e->type != Entity::Type::POINT_IN_2D &&
|
if(e->type != Entity::Type::POINT_IN_2D &&
|
||||||
e->type != Entity::Type::POINT_IN_3D)
|
e->type != Entity::Type::POINT_IN_3D)
|
||||||
@ -74,13 +74,13 @@ void GraphicsWindow::FixConstraintsForPointBeingDeleted(hEntity hpt) {
|
|||||||
SK.constraint.ClearTags();
|
SK.constraint.ClearTags();
|
||||||
for(c = SK.constraint.First(); c; c = SK.constraint.NextAfter(c)) {
|
for(c = SK.constraint.First(); c; c = SK.constraint.NextAfter(c)) {
|
||||||
if(c->type != Constraint::Type::POINTS_COINCIDENT) continue;
|
if(c->type != Constraint::Type::POINTS_COINCIDENT) continue;
|
||||||
if(c->group.v != SS.GW.activeGroup.v) continue;
|
if(c->group != SS.GW.activeGroup) continue;
|
||||||
|
|
||||||
if(c->ptA.v == hpt.v) {
|
if(c->ptA == hpt) {
|
||||||
ld.Add(&(c->ptB));
|
ld.Add(&(c->ptB));
|
||||||
c->tag = 1;
|
c->tag = 1;
|
||||||
}
|
}
|
||||||
if(c->ptB.v == hpt.v) {
|
if(c->ptB == hpt) {
|
||||||
ld.Add(&(c->ptA));
|
ld.Add(&(c->ptA));
|
||||||
c->tag = 1;
|
c->tag = 1;
|
||||||
}
|
}
|
||||||
@ -233,10 +233,10 @@ void GraphicsWindow::ParametricCurve::ConstrainPointIfCoincident(hEntity hpt) {
|
|||||||
ptv = pt->PointGetNum();
|
ptv = pt->PointGetNum();
|
||||||
|
|
||||||
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
||||||
if(e->h.v == pt->h.v) continue;
|
if(e->h == pt->h) continue;
|
||||||
if(!e->IsPoint()) continue;
|
if(!e->IsPoint()) continue;
|
||||||
if(e->group.v != pt->group.v) continue;
|
if(e->group != pt->group) continue;
|
||||||
if(e->workplane.v != pt->workplane.v) continue;
|
if(e->workplane != pt->workplane) continue;
|
||||||
|
|
||||||
ev = e->PointGetNum();
|
ev = e->PointGetNum();
|
||||||
if(!ev.Equals(ptv)) continue;
|
if(!ev.Equals(ptv)) continue;
|
||||||
@ -272,8 +272,8 @@ void GraphicsWindow::MakeTangentArc() {
|
|||||||
bool pointf[2];
|
bool pointf[2];
|
||||||
for(i = 0; i < SK.request.n; i++) {
|
for(i = 0; i < SK.request.n; i++) {
|
||||||
Request *r = &(SK.request.elem[i]);
|
Request *r = &(SK.request.elem[i]);
|
||||||
if(r->group.v != activeGroup.v) continue;
|
if(r->group != activeGroup) continue;
|
||||||
if(r->workplane.v != ActiveWorkplane().v) continue;
|
if(r->workplane != ActiveWorkplane()) continue;
|
||||||
if(r->construction) continue;
|
if(r->construction) continue;
|
||||||
if(r->type != Request::Type::LINE_SEGMENT &&
|
if(r->type != Request::Type::LINE_SEGMENT &&
|
||||||
r->type != Request::Type::ARC_OF_CIRCLE)
|
r->type != Request::Type::ARC_OF_CIRCLE)
|
||||||
@ -412,8 +412,8 @@ void GraphicsWindow::MakeTangentArc() {
|
|||||||
SK.constraint.ClearTags();
|
SK.constraint.ClearTags();
|
||||||
for(i = 0; i < SK.constraint.n; i++) {
|
for(i = 0; i < SK.constraint.n; i++) {
|
||||||
Constraint *cs = &(SK.constraint.elem[i]);
|
Constraint *cs = &(SK.constraint.elem[i]);
|
||||||
if(cs->group.v != activeGroup.v) continue;
|
if(cs->group != activeGroup) continue;
|
||||||
if(cs->workplane.v != ActiveWorkplane().v) continue;
|
if(cs->workplane != ActiveWorkplane()) continue;
|
||||||
if(cs->type != Constraint::Type::POINTS_COINCIDENT) continue;
|
if(cs->type != Constraint::Type::POINTS_COINCIDENT) continue;
|
||||||
if (SK.GetEntity(cs->ptA)->PointGetNum().Equals(pshared)) {
|
if (SK.GetEntity(cs->ptA)->PointGetNum().Equals(pshared)) {
|
||||||
cs->tag = 1;
|
cs->tag = 1;
|
||||||
@ -605,12 +605,12 @@ hEntity GraphicsWindow::SplitEntity(hEntity he, Vector pinter) {
|
|||||||
SK.request.ClearTags();
|
SK.request.ClearTags();
|
||||||
for(int i = 0; i < SK.request.n; i++) {
|
for(int i = 0; i < SK.request.n; i++) {
|
||||||
Request *r = &(SK.request.elem[i]);
|
Request *r = &(SK.request.elem[i]);
|
||||||
if(r->group.v != activeGroup.v) continue;
|
if(r->group != activeGroup) continue;
|
||||||
if(r->type != reqType) continue;
|
if(r->type != reqType) continue;
|
||||||
|
|
||||||
// If the user wants to keep the old entities around, they can just
|
// If the user wants to keep the old entities around, they can just
|
||||||
// mark them construction first.
|
// mark them construction first.
|
||||||
if(he.v == r->h.entity(0).v && !r->construction) {
|
if(he == r->h.entity(0) && !r->construction) {
|
||||||
r->tag = 1;
|
r->tag = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -659,8 +659,8 @@ void GraphicsWindow::SplitLinesOrCurves() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(Constraint &c : SK.constraint) {
|
for(Constraint &c : SK.constraint) {
|
||||||
if(c.ptA.request().v == hb.request().v &&
|
if(c.ptA.request() == hb.request() &&
|
||||||
c.entityA.request().v == ha.request().v) {
|
c.entityA.request() == ha.request()) {
|
||||||
pi = SK.GetEntity(c.ptA)->PointGetNum();
|
pi = SK.GetEntity(c.ptA)->PointGetNum();
|
||||||
|
|
||||||
if(ea->type == Entity::Type::LINE_SEGMENT && !pi.OnLineSegment(p0, p1)) {
|
if(ea->type == Entity::Type::LINE_SEGMENT && !pi.OnLineSegment(p0, p1)) {
|
||||||
@ -713,7 +713,7 @@ void GraphicsWindow::SplitLinesOrCurves() {
|
|||||||
// Remove datum point, as it has now been superseded by the split point.
|
// Remove datum point, as it has now been superseded by the split point.
|
||||||
SK.request.ClearTags();
|
SK.request.ClearTags();
|
||||||
for(Request &r : SK.request) {
|
for(Request &r : SK.request) {
|
||||||
if(r.h.v == hb.request().v) {
|
if(r.h == hb.request()) {
|
||||||
if(r.type == Request::Type::DATUM_POINT) {
|
if(r.type == Request::Type::DATUM_POINT) {
|
||||||
// Delete datum point.
|
// Delete datum point.
|
||||||
r.tag = 1;
|
r.tag = 1;
|
||||||
|
@ -24,7 +24,7 @@ void GraphicsWindow::AddPointToDraggedList(hEntity hp) {
|
|||||||
// twice as far as the mouse pointer...
|
// twice as far as the mouse pointer...
|
||||||
List<hEntity> *lhe = &(pending.points);
|
List<hEntity> *lhe = &(pending.points);
|
||||||
for(hEntity *hee = lhe->First(); hee; hee = lhe->NextAfter(hee)) {
|
for(hEntity *hee = lhe->First(); hee; hee = lhe->NextAfter(hee)) {
|
||||||
if(hee->v == hp.v) {
|
if(*hee == hp) {
|
||||||
// Exact same point.
|
// Exact same point.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ void GraphicsWindow::AddPointToDraggedList(hEntity hp) {
|
|||||||
if(pe->type == p->type &&
|
if(pe->type == p->type &&
|
||||||
pe->type != Entity::Type::POINT_IN_2D &&
|
pe->type != Entity::Type::POINT_IN_2D &&
|
||||||
pe->type != Entity::Type::POINT_IN_3D &&
|
pe->type != Entity::Type::POINT_IN_3D &&
|
||||||
pe->group.v == p->group.v)
|
pe->group == p->group)
|
||||||
{
|
{
|
||||||
// Transform-type point, from the same group. So it handles the
|
// Transform-type point, from the same group. So it handles the
|
||||||
// same unknowns.
|
// same unknowns.
|
||||||
@ -75,7 +75,7 @@ void GraphicsWindow::StartDraggingBySelection() {
|
|||||||
// the hovered item too, and they'll always have it.
|
// the hovered item too, and they'll always have it.
|
||||||
if(hover.entity.v) {
|
if(hover.entity.v) {
|
||||||
hEntity dragEntity = ChooseFromHoverToDrag().entity;
|
hEntity dragEntity = ChooseFromHoverToDrag().entity;
|
||||||
if(dragEntity.v != Entity::NO_ENTITY.v) {
|
if(dragEntity != Entity::NO_ENTITY) {
|
||||||
StartDraggingByEntity(dragEntity);
|
StartDraggingByEntity(dragEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -383,7 +383,7 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
|
|||||||
HitTestMakeSelection(mp);
|
HitTestMakeSelection(mp);
|
||||||
|
|
||||||
hRequest hr = pending.point.request();
|
hRequest hr = pending.point.request();
|
||||||
if(pending.point.v == hr.entity(4).v) {
|
if(pending.point == hr.entity(4)) {
|
||||||
// The very first segment; dragging final point drags both
|
// The very first segment; dragging final point drags both
|
||||||
// tangent points.
|
// tangent points.
|
||||||
Vector p0 = SK.GetEntity(hr.entity(1))->PointGetNum(),
|
Vector p0 = SK.GetEntity(hr.entity(1))->PointGetNum(),
|
||||||
@ -486,7 +486,7 @@ void GraphicsWindow::ClearPending(bool scheduleShowTW) {
|
|||||||
|
|
||||||
bool GraphicsWindow::IsFromPending(hRequest r) {
|
bool GraphicsWindow::IsFromPending(hRequest r) {
|
||||||
for(auto &req : pending.requests) {
|
for(auto &req : pending.requests) {
|
||||||
if(req.v == r.v) return true;
|
if(req == r) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -497,8 +497,8 @@ void GraphicsWindow::AddToPending(hRequest r) {
|
|||||||
|
|
||||||
void GraphicsWindow::ReplacePending(hRequest before, hRequest after) {
|
void GraphicsWindow::ReplacePending(hRequest before, hRequest after) {
|
||||||
for(auto &req : pending.requests) {
|
for(auto &req : pending.requests) {
|
||||||
if(req.v == before.v) {
|
if(req == before) {
|
||||||
req.v = after.v;
|
req = after;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -721,7 +721,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
|
|||||||
IdList<Constraint,hConstraint> *lc = &(SK.constraint);
|
IdList<Constraint,hConstraint> *lc = &(SK.constraint);
|
||||||
for(c = lc->First(); c; c = lc->NextAfter(c)) {
|
for(c = lc->First(); c; c = lc->NextAfter(c)) {
|
||||||
if(c->type != Constraint::Type::POINTS_COINCIDENT) continue;
|
if(c->type != Constraint::Type::POINTS_COINCIDENT) continue;
|
||||||
if(c->ptA.v == p->h.v || c->ptB.v == p->h.v) {
|
if(c->ptA == p->h || c->ptB == p->h) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -734,7 +734,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
|
|||||||
Constraint *c;
|
Constraint *c;
|
||||||
for(c = SK.constraint.First(); c; c = SK.constraint.NextAfter(c)) {
|
for(c = SK.constraint.First(); c; c = SK.constraint.NextAfter(c)) {
|
||||||
if(c->type != Constraint::Type::POINTS_COINCIDENT) continue;
|
if(c->type != Constraint::Type::POINTS_COINCIDENT) continue;
|
||||||
if(c->ptA.v == p->h.v || c->ptB.v == p->h.v) {
|
if(c->ptA == p->h || c->ptB == p->h) {
|
||||||
c->tag = 1;
|
c->tag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1178,7 +1178,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my, bool shiftDown, bool ct
|
|||||||
hRequest hr = pending.point.request();
|
hRequest hr = pending.point.request();
|
||||||
Request *r = SK.GetRequest(hr);
|
Request *r = SK.GetRequest(hr);
|
||||||
|
|
||||||
if(hover.entity.v == hr.entity(1).v && r->extraPoints >= 2) {
|
if(hover.entity == hr.entity(1) && r->extraPoints >= 2) {
|
||||||
// They want the endpoints coincident, which means a periodic
|
// They want the endpoints coincident, which means a periodic
|
||||||
// spline instead.
|
// spline instead.
|
||||||
r->type = Request::Type::CUBIC_PERIODIC;
|
r->type = Request::Type::CUBIC_PERIODIC;
|
||||||
@ -1543,7 +1543,7 @@ void GraphicsWindow::SixDofEvent(Platform::SixDofEvent event) {
|
|||||||
// point.
|
// point.
|
||||||
int64_t now = GetMilliseconds();
|
int64_t now = GetMilliseconds();
|
||||||
if(now - last6DofTime > 5000 ||
|
if(now - last6DofTime > 5000 ||
|
||||||
last6DofGroup.v != g->h.v)
|
last6DofGroup != g->h)
|
||||||
{
|
{
|
||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ void CairoRenderer::OutputEnd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CairoRenderer::SelectStroke(hStroke hcs) {
|
void CairoRenderer::SelectStroke(hStroke hcs) {
|
||||||
if(current.hcs.v == hcs.v) return;
|
if(current.hcs == hcs) return;
|
||||||
FinishPath();
|
FinishPath();
|
||||||
|
|
||||||
Stroke *stroke = strokes.FindById(hcs);
|
Stroke *stroke = strokes.FindById(hcs);
|
||||||
|
@ -249,7 +249,7 @@ void OpenGl1Renderer::UnSelectPrimitive() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Canvas::Stroke *OpenGl1Renderer::SelectStroke(hStroke hcs) {
|
Canvas::Stroke *OpenGl1Renderer::SelectStroke(hStroke hcs) {
|
||||||
if(current.hcs.v == hcs.v) return current.stroke;
|
if(current.hcs == hcs) return current.stroke;
|
||||||
|
|
||||||
Stroke *stroke = strokes.FindById(hcs);
|
Stroke *stroke = strokes.FindById(hcs);
|
||||||
UnSelectPrimitive();
|
UnSelectPrimitive();
|
||||||
@ -270,7 +270,7 @@ Canvas::Stroke *OpenGl1Renderer::SelectStroke(hStroke hcs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Canvas::Fill *OpenGl1Renderer::SelectFill(hFill hcf) {
|
Canvas::Fill *OpenGl1Renderer::SelectFill(hFill hcf) {
|
||||||
if(current.hcf.v == hcf.v) return current.fill;
|
if(current.hcf == hcf) return current.fill;
|
||||||
|
|
||||||
Fill *fill = fills.FindById(hcf);
|
Fill *fill = fills.FindById(hcf);
|
||||||
UnSelectPrimitive();
|
UnSelectPrimitive();
|
||||||
|
@ -195,7 +195,7 @@ static void ssglDepthRange(Canvas::Layer layer, int zIndex) {
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
Canvas::Stroke *OpenGl3Renderer::SelectStroke(hStroke hcs) {
|
Canvas::Stroke *OpenGl3Renderer::SelectStroke(hStroke hcs) {
|
||||||
if(current.hcs.v == hcs.v) return current.stroke;
|
if(current.hcs == hcs) return current.stroke;
|
||||||
|
|
||||||
Stroke *stroke = strokes.FindById(hcs);
|
Stroke *stroke = strokes.FindById(hcs);
|
||||||
ssglDepthRange(stroke->layer, stroke->zIndex);
|
ssglDepthRange(stroke->layer, stroke->zIndex);
|
||||||
@ -241,7 +241,7 @@ void OpenGl3Renderer::SelectMask(FillPattern pattern) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Canvas::Fill *OpenGl3Renderer::SelectFill(hFill hcf) {
|
Canvas::Fill *OpenGl3Renderer::SelectFill(hFill hcf) {
|
||||||
if(current.hcf.v == hcf.v) return current.fill;
|
if(current.hcf == hcf) return current.fill;
|
||||||
|
|
||||||
Fill *fill = fills.FindById(hcf);
|
Fill *fill = fills.FindById(hcf);
|
||||||
ssglDepthRange(fill->layer, fill->zIndex);
|
ssglDepthRange(fill->layer, fill->zIndex);
|
||||||
|
@ -146,7 +146,7 @@ void Request::Generate(IdList<Entity,hEntity> *entity,
|
|||||||
p.group = group;
|
p.group = group;
|
||||||
p.style = style;
|
p.style = style;
|
||||||
p.construction = e.construction;
|
p.construction = e.construction;
|
||||||
if(workplane.v == Entity::FREE_IN_3D.v) {
|
if(workplane == Entity::FREE_IN_3D) {
|
||||||
p.type = Entity::Type::POINT_IN_3D;
|
p.type = Entity::Type::POINT_IN_3D;
|
||||||
// params for x y z
|
// params for x y z
|
||||||
p.param[0] = AddParam(param, h.param(16 + 3*i + 0));
|
p.param[0] = AddParam(param, h.param(16 + 3*i + 0));
|
||||||
@ -168,7 +168,7 @@ void Request::Generate(IdList<Entity,hEntity> *entity,
|
|||||||
n.group = group;
|
n.group = group;
|
||||||
n.style = style;
|
n.style = style;
|
||||||
n.construction = e.construction;
|
n.construction = e.construction;
|
||||||
if(workplane.v == Entity::FREE_IN_3D.v) {
|
if(workplane == Entity::FREE_IN_3D) {
|
||||||
n.type = Entity::Type::NORMAL_IN_3D;
|
n.type = Entity::Type::NORMAL_IN_3D;
|
||||||
n.param[0] = AddParam(param, h.param(32+0));
|
n.param[0] = AddParam(param, h.param(32+0));
|
||||||
n.param[1] = AddParam(param, h.param(32+1));
|
n.param[1] = AddParam(param, h.param(32+1));
|
||||||
@ -203,11 +203,11 @@ void Request::Generate(IdList<Entity,hEntity> *entity,
|
|||||||
|
|
||||||
std::string Request::DescriptionString() const {
|
std::string Request::DescriptionString() const {
|
||||||
const char *s = "";
|
const char *s = "";
|
||||||
if(h.v == Request::HREQUEST_REFERENCE_XY.v) {
|
if(h == Request::HREQUEST_REFERENCE_XY) {
|
||||||
s = "#XY";
|
s = "#XY";
|
||||||
} else if(h.v == Request::HREQUEST_REFERENCE_YZ.v) {
|
} else if(h == Request::HREQUEST_REFERENCE_YZ) {
|
||||||
s = "#YZ";
|
s = "#YZ";
|
||||||
} else if(h.v == Request::HREQUEST_REFERENCE_ZX.v) {
|
} else if(h == Request::HREQUEST_REFERENCE_ZX) {
|
||||||
s = "#ZX";
|
s = "#ZX";
|
||||||
} else {
|
} else {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
@ -228,10 +228,10 @@ std::string Request::DescriptionString() const {
|
|||||||
|
|
||||||
int Request::IndexOfPoint(hEntity he) const {
|
int Request::IndexOfPoint(hEntity he) const {
|
||||||
if(type == Type::DATUM_POINT) {
|
if(type == Type::DATUM_POINT) {
|
||||||
return (he.v == h.entity(0).v) ? 0 : -1;
|
return (he == h.entity(0)) ? 0 : -1;
|
||||||
}
|
}
|
||||||
for(int i = 0; i < MAX_POINTS_IN_ENTITY; i++) {
|
for(int i = 0; i < MAX_POINTS_IN_ENTITY; i++) {
|
||||||
if(he.v == h.entity(i + 1).v) {
|
if(he == h.entity(i + 1)) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
16
src/sketch.h
16
src/sketch.h
@ -133,7 +133,7 @@ struct EntityKeyHash {
|
|||||||
};
|
};
|
||||||
struct EntityKeyEqual {
|
struct EntityKeyEqual {
|
||||||
bool operator()(const EntityKey &a, const EntityKey &b) const {
|
bool operator()(const EntityKey &a, const EntityKey &b) const {
|
||||||
return std::tie(a.input.v, a.copyNumber) == std::tie(b.input.v, b.copyNumber);
|
return std::tie(a.input, a.copyNumber) == std::tie(b.input, b.copyNumber);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
typedef std::unordered_map<EntityKey, EntityId, EntityKeyHash, EntityKeyEqual> EntityMap;
|
typedef std::unordered_map<EntityKey, EntityId, EntityKeyHash, EntityKeyEqual> EntityMap;
|
||||||
@ -687,10 +687,10 @@ public:
|
|||||||
std::string comment; // since comments are represented as constraints
|
std::string comment; // since comments are represented as constraints
|
||||||
|
|
||||||
bool Equals(const ConstraintBase &c) const {
|
bool Equals(const ConstraintBase &c) const {
|
||||||
return type == c.type && group.v == c.group.v && workplane.v == c.workplane.v &&
|
return type == c.type && group == c.group && workplane == c.workplane &&
|
||||||
valA == c.valA && valP.v == c.valP.v && ptA.v == c.ptA.v && ptB.v == c.ptB.v &&
|
valA == c.valA && valP == c.valP && ptA == c.ptA && ptB == c.ptB &&
|
||||||
entityA.v == c.entityA.v && entityB.v == c.entityB.v &&
|
entityA == c.entityA && entityB == c.entityB &&
|
||||||
entityC.v == c.entityC.v && entityD.v == c.entityD.v &&
|
entityC == c.entityC && entityD == c.entityD &&
|
||||||
other == c.other && other2 == c.other2 && reference == c.reference &&
|
other == c.other && other2 == c.other2 && reference == c.reference &&
|
||||||
comment == c.comment;
|
comment == c.comment;
|
||||||
}
|
}
|
||||||
@ -917,9 +917,9 @@ inline hEquation hGroup::equation(int i) const
|
|||||||
{ hEquation r; r.v = (v << 16) | 0x80000000 | (uint32_t)i; return r; }
|
{ hEquation r; r.v = (v << 16) | 0x80000000 | (uint32_t)i; return r; }
|
||||||
|
|
||||||
inline bool hRequest::IsFromReferences() const {
|
inline bool hRequest::IsFromReferences() const {
|
||||||
if(v == Request::HREQUEST_REFERENCE_XY.v) return true;
|
if(*this == Request::HREQUEST_REFERENCE_XY) return true;
|
||||||
if(v == Request::HREQUEST_REFERENCE_YZ.v) return true;
|
if(*this == Request::HREQUEST_REFERENCE_YZ) return true;
|
||||||
if(v == Request::HREQUEST_REFERENCE_ZX.v) return true;
|
if(*this == Request::HREQUEST_REFERENCE_ZX) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inline hEntity hRequest::entity(int i) const
|
inline hEntity hRequest::entity(int i) const
|
||||||
|
@ -1045,7 +1045,7 @@ BBox Sketch::CalculateEntityBBox(bool includingInvisible) {
|
|||||||
// arc center point shouldn't be included in bounding box calculation
|
// arc center point shouldn't be included in bounding box calculation
|
||||||
if(e.IsPoint() && e.h.isFromRequest()) {
|
if(e.IsPoint() && e.h.isFromRequest()) {
|
||||||
Request *r = SK.GetRequest(e.h.request());
|
Request *r = SK.GetRequest(e.h.request());
|
||||||
if(r->type == Request::Type::ARC_OF_CIRCLE && e.h.v == r->h.entity(1).v) {
|
if(r->type == Request::Type::ARC_OF_CIRCLE && e.h == r->h.entity(1)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -444,9 +444,9 @@ SSurface SSurface::MakeCopyTrimAgainst(SShell *parent,
|
|||||||
for(sc = into->curve.First(); sc; sc = into->curve.NextAfter(sc)) {
|
for(sc = into->curve.First(); sc; sc = into->curve.NextAfter(sc)) {
|
||||||
if(sc->source != SCurve::Source::INTERSECTION) continue;
|
if(sc->source != SCurve::Source::INTERSECTION) continue;
|
||||||
if(opA) {
|
if(opA) {
|
||||||
if(sc->surfA.v != h.v || sc->surfB.v != ss->h.v) continue;
|
if(sc->surfA != h || sc->surfB != ss->h) continue;
|
||||||
} else {
|
} else {
|
||||||
if(sc->surfB.v != h.v || sc->surfA.v != ss->h.v) continue;
|
if(sc->surfB != h || sc->surfA != ss->h) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
@ -59,8 +59,8 @@ void SShell::MergeCoincidentSurfaces() {
|
|||||||
// new srf
|
// new srf
|
||||||
SCurve *sc;
|
SCurve *sc;
|
||||||
for(sc = curve.First(); sc; sc = curve.NextAfter(sc)) {
|
for(sc = curve.First(); sc; sc = curve.NextAfter(sc)) {
|
||||||
if(sc->surfA.v == sj->h.v) sc->surfA = si->h;
|
if(sc->surfA == sj->h) sc->surfA = si->h;
|
||||||
if(sc->surfB.v == sj->h.v) sc->surfB = si->h;
|
if(sc->surfB == sj->h) sc->surfB = si->h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ void SSurface::IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB,
|
|||||||
// Find the other surface that this curve trims.
|
// Find the other surface that this curve trims.
|
||||||
hSCurve hsc = { (uint32_t)se->auxA };
|
hSCurve hsc = { (uint32_t)se->auxA };
|
||||||
SCurve *sc = shA->curve.FindById(hsc);
|
SCurve *sc = shA->curve.FindById(hsc);
|
||||||
hSSurface hother = (sc->surfA.v == srfA->h.v) ?
|
hSSurface hother = (sc->surfA == srfA->h) ?
|
||||||
sc->surfB : sc->surfA;
|
sc->surfB : sc->surfA;
|
||||||
SSurface *other = shA->surface.FindById(hother);
|
SSurface *other = shA->surface.FindById(hother);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ void Style::CreateDefaultStyle(hStyle h) {
|
|||||||
bool isDefaultStyle = true;
|
bool isDefaultStyle = true;
|
||||||
const Default *d;
|
const Default *d;
|
||||||
for(d = &(Defaults[0]); d->h.v; d++) {
|
for(d = &(Defaults[0]); d->h.v; d++) {
|
||||||
if(d->h.v == h.v) break;
|
if(d->h == h) break;
|
||||||
}
|
}
|
||||||
if(!d->h.v) {
|
if(!d->h.v) {
|
||||||
// Not a default style; so just create it the same as our default
|
// Not a default style; so just create it the same as our default
|
||||||
@ -337,7 +337,7 @@ hStyle Style::ForEntity(hEntity he) {
|
|||||||
|
|
||||||
// Otherwise, we use the default rules.
|
// Otherwise, we use the default rules.
|
||||||
hStyle hs;
|
hStyle hs;
|
||||||
if(e->group.v != SS.GW.activeGroup.v) {
|
if(e->group != SS.GW.activeGroup) {
|
||||||
hs.v = INACTIVE_GRP;
|
hs.v = INACTIVE_GRP;
|
||||||
} else if(e->construction) {
|
} else if(e->construction) {
|
||||||
hs.v = CONSTRUCTION;
|
hs.v = CONSTRUCTION;
|
||||||
|
@ -79,7 +79,7 @@ void System::EvalJacobian() {
|
|||||||
bool System::IsDragged(hParam p) {
|
bool System::IsDragged(hParam p) {
|
||||||
hParam *pp;
|
hParam *pp;
|
||||||
for(pp = dragged.First(); pp; pp = dragged.NextAfter(pp)) {
|
for(pp = dragged.First(); pp; pp = dragged.NextAfter(pp)) {
|
||||||
if(p.v == pp->v) return true;
|
if(p == *pp) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ void System::SolveBySubstitution() {
|
|||||||
}
|
}
|
||||||
for(j = 0; j < param.n; j++) {
|
for(j = 0; j < param.n; j++) {
|
||||||
Param *rp = &(param.elem[j]);
|
Param *rp = &(param.elem[j]);
|
||||||
if(rp->substd.v == a.v) {
|
if(rp->substd == a) {
|
||||||
rp->substd = b;
|
rp->substd = b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,8 +328,8 @@ void System::WriteEquationsExceptFor(hConstraint hc, Group *g) {
|
|||||||
// Generate all the equations from constraints in this group
|
// Generate all the equations from constraints in this group
|
||||||
for(i = 0; i < SK.constraint.n; i++) {
|
for(i = 0; i < SK.constraint.n; i++) {
|
||||||
ConstraintBase *c = &(SK.constraint.elem[i]);
|
ConstraintBase *c = &(SK.constraint.elem[i]);
|
||||||
if(c->group.v != g->h.v) continue;
|
if(c->group != g->h) continue;
|
||||||
if(c->h.v == hc.v) continue;
|
if(c->h == hc) continue;
|
||||||
|
|
||||||
if(c->HasLabel() && c->type != Constraint::Type::COMMENT &&
|
if(c->HasLabel() && c->type != Constraint::Type::COMMENT &&
|
||||||
g->allDimsReference)
|
g->allDimsReference)
|
||||||
@ -351,7 +351,7 @@ void System::WriteEquationsExceptFor(hConstraint hc, Group *g) {
|
|||||||
// And the equations from entities
|
// And the equations from entities
|
||||||
for(i = 0; i < SK.entity.n; i++) {
|
for(i = 0; i < SK.entity.n; i++) {
|
||||||
EntityBase *e = &(SK.entity.elem[i]);
|
EntityBase *e = &(SK.entity.elem[i]);
|
||||||
if(e->group.v != g->h.v) continue;
|
if(e->group != g->h) continue;
|
||||||
|
|
||||||
e->GenerateEquations(&eq);
|
e->GenerateEquations(&eq);
|
||||||
}
|
}
|
||||||
@ -365,7 +365,7 @@ void System::FindWhichToRemoveToFixJacobian(Group *g, List<hConstraint> *bad, bo
|
|||||||
for(a = 0; a < 2; a++) {
|
for(a = 0; a < 2; a++) {
|
||||||
for(i = 0; i < SK.constraint.n; i++) {
|
for(i = 0; i < SK.constraint.n; i++) {
|
||||||
ConstraintBase *c = &(SK.constraint.elem[i]);
|
ConstraintBase *c = &(SK.constraint.elem[i]);
|
||||||
if(c->group.v != g->h.v) continue;
|
if(c->group != g->h) continue;
|
||||||
if((c->type == Constraint::Type::POINTS_COINCIDENT && a == 0) ||
|
if((c->type == Constraint::Type::POINTS_COINCIDENT && a == 0) ||
|
||||||
(c->type != Constraint::Type::POINTS_COINCIDENT && a == 1))
|
(c->type != Constraint::Type::POINTS_COINCIDENT && a == 1))
|
||||||
{
|
{
|
||||||
@ -436,8 +436,8 @@ SolveResult System::Solve(Group *g, int *rank, int *dof, List<hConstraint> *bad,
|
|||||||
if(e->tag != 0) continue;
|
if(e->tag != 0) continue;
|
||||||
|
|
||||||
hParam hp = e->e->ReferencedParams(¶m);
|
hParam hp = e->e->ReferencedParams(¶m);
|
||||||
if(hp.v == Expr::NO_PARAMS.v) continue;
|
if(hp == Expr::NO_PARAMS) continue;
|
||||||
if(hp.v == Expr::MULTIPLE_PARAMS.v) continue;
|
if(hp == Expr::MULTIPLE_PARAMS) continue;
|
||||||
|
|
||||||
Param *p = param.FindById(hp);
|
Param *p = param.FindById(hp);
|
||||||
if(p->tag != 0) continue; // let rank test catch inconsistency
|
if(p->tag != 0) continue; // let rank test catch inconsistency
|
||||||
|
@ -71,7 +71,7 @@ void TextWindow::ScreenActivateGroup(int link, uint32_t v) {
|
|||||||
void TextWindow::ReportHowGroupSolved(hGroup hg) {
|
void TextWindow::ReportHowGroupSolved(hGroup hg) {
|
||||||
SS.GW.ClearSuper();
|
SS.GW.ClearSuper();
|
||||||
SS.TW.GoToScreen(Screen::GROUP_SOLVE_INFO);
|
SS.TW.GoToScreen(Screen::GROUP_SOLVE_INFO);
|
||||||
SS.TW.shown.group.v = hg.v;
|
SS.TW.shown.group = hg;
|
||||||
SS.ScheduleShowTW();
|
SS.ScheduleShowTW();
|
||||||
}
|
}
|
||||||
void TextWindow::ScreenHowGroupSolved(int link, uint32_t v) {
|
void TextWindow::ScreenHowGroupSolved(int link, uint32_t v) {
|
||||||
@ -103,7 +103,7 @@ void TextWindow::ShowListOfGroups() {
|
|||||||
for(i = 0; i < SK.groupOrder.n; i++) {
|
for(i = 0; i < SK.groupOrder.n; i++) {
|
||||||
Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
|
Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
|
||||||
std::string s = g->DescriptionString();
|
std::string s = g->DescriptionString();
|
||||||
bool active = (g->h.v == SS.GW.activeGroup.v);
|
bool active = (g->h == SS.GW.activeGroup);
|
||||||
bool shown = g->visible;
|
bool shown = g->visible;
|
||||||
bool ok = g->IsSolvedOkay();
|
bool ok = g->IsSolvedOkay();
|
||||||
bool warn = (g->type == Group::Type::DRAWING_WORKPLANE &&
|
bool warn = (g->type == Group::Type::DRAWING_WORKPLANE &&
|
||||||
@ -120,7 +120,7 @@ void TextWindow::ShowListOfGroups() {
|
|||||||
sprintf(sdof, "%-3d", dof);
|
sprintf(sdof, "%-3d", dof);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool ref = (g->h.v == Group::HGROUP_REFERENCES.v);
|
bool ref = (g->h == Group::HGROUP_REFERENCES);
|
||||||
Printf(false, "%Bp%Fd "
|
Printf(false, "%Bp%Fd "
|
||||||
"%Ft%s%Fb%D%f%Ll%s%E "
|
"%Ft%s%Fb%D%f%Ll%s%E "
|
||||||
"%Fb%s%D%f%Ll%s%E "
|
"%Fb%s%D%f%Ll%s%E "
|
||||||
@ -245,7 +245,7 @@ void TextWindow::ScreenOpacity(int link, uint32_t v) {
|
|||||||
|
|
||||||
SS.TW.ShowEditControl(11, ssprintf("%.2f", g->color.alphaF()));
|
SS.TW.ShowEditControl(11, ssprintf("%.2f", g->color.alphaF()));
|
||||||
SS.TW.edit.meaning = Edit::GROUP_OPACITY;
|
SS.TW.edit.meaning = Edit::GROUP_OPACITY;
|
||||||
SS.TW.edit.group.v = g->h.v;
|
SS.TW.edit.group = g->h;
|
||||||
}
|
}
|
||||||
void TextWindow::ScreenChangeExprA(int link, uint32_t v) {
|
void TextWindow::ScreenChangeExprA(int link, uint32_t v) {
|
||||||
Group *g = SK.GetGroup(SS.TW.shown.group);
|
Group *g = SK.GetGroup(SS.TW.shown.group);
|
||||||
@ -271,7 +271,7 @@ void TextWindow::ScreenDeleteGroup(int link, uint32_t v) {
|
|||||||
SS.UndoRemember();
|
SS.UndoRemember();
|
||||||
|
|
||||||
hGroup hg = SS.TW.shown.group;
|
hGroup hg = SS.TW.shown.group;
|
||||||
if(hg.v == SS.GW.activeGroup.v) {
|
if(hg == SS.GW.activeGroup) {
|
||||||
SS.GW.activeGroup = SK.GetGroup(SS.GW.activeGroup)->PreviousGroup()->h;
|
SS.GW.activeGroup = SK.GetGroup(SS.GW.activeGroup)->PreviousGroup()->h;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ void TextWindow::ShowGroupInfo() {
|
|||||||
Group *g = SK.GetGroup(shown.group);
|
Group *g = SK.GetGroup(shown.group);
|
||||||
const char *s = "???";
|
const char *s = "???";
|
||||||
|
|
||||||
if(shown.group.v == Group::HGROUP_REFERENCES.v) {
|
if(shown.group == Group::HGROUP_REFERENCES) {
|
||||||
Printf(true, "%FtGROUP %E%s", g->DescriptionString().c_str());
|
Printf(true, "%FtGROUP %E%s", g->DescriptionString().c_str());
|
||||||
goto list_items;
|
goto list_items;
|
||||||
} else {
|
} else {
|
||||||
@ -444,7 +444,7 @@ list_items:
|
|||||||
for(i = 0; i < SK.request.n; i++) {
|
for(i = 0; i < SK.request.n; i++) {
|
||||||
Request *r = &(SK.request.elem[i]);
|
Request *r = &(SK.request.elem[i]);
|
||||||
|
|
||||||
if(r->group.v == shown.group.v) {
|
if(r->group == shown.group) {
|
||||||
std::string s = r->DescriptionString();
|
std::string s = r->DescriptionString();
|
||||||
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E",
|
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E",
|
||||||
(a & 1) ? 'd' : 'a',
|
(a & 1) ? 'd' : 'a',
|
||||||
@ -461,7 +461,7 @@ list_items:
|
|||||||
for(i = 0; i < SK.constraint.n; i++) {
|
for(i = 0; i < SK.constraint.n; i++) {
|
||||||
Constraint *c = &(SK.constraint.elem[i]);
|
Constraint *c = &(SK.constraint.elem[i]);
|
||||||
|
|
||||||
if(c->group.v == shown.group.v) {
|
if(c->group == shown.group) {
|
||||||
std::string s = c->DescriptionString();
|
std::string s = c->DescriptionString();
|
||||||
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E %s",
|
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E %s",
|
||||||
(a & 1) ? 'd' : 'a',
|
(a & 1) ? 'd' : 'a',
|
||||||
|
Loading…
Reference in New Issue
Block a user