allow equal angle constraints when 3 or 4 lines selected. Variadic constraints broke this feature by make equal length lines in those cases.

This commit is contained in:
phkahler 2023-01-06 20:44:51 -05:00 committed by Paul Kahler
parent 3833dd0246
commit a71e4bef81

View File

@ -312,7 +312,21 @@ void Constraint::MenuConstrain(Command id) {
break;
case Command::EQUAL:
if(gs.lineSegments >= 2 && gs.lineSegments == gs.n) {
if(gs.vectors == 3 && gs.n == 3) {
c.type = Type::EQUAL_ANGLE;
c.entityA = gs.vector[0];
c.entityB = gs.vector[1];
c.entityC = gs.vector[1];
c.entityD = gs.vector[2];
newcons.push_back(c);
} else if(gs.vectors == 4 && gs.n == 4) {
c.type = Type::EQUAL_ANGLE;
c.entityA = gs.vector[0];
c.entityB = gs.vector[1];
c.entityC = gs.vector[2];
c.entityD = gs.vector[3];
newcons.push_back(c);
} else if(gs.lineSegments >= 2 && gs.lineSegments == gs.n) {
c.type = Type::EQUAL_LENGTH_LINES;
c.entityA = gs.entity[0];
for (std::vector<hEntity>::size_type k = 1;k < gs.entity.size(); ++k){
@ -341,20 +355,6 @@ void Constraint::MenuConstrain(Command id) {
c.entityB = gs.entity[1];
c.ptA = gs.point[0];
newcons.push_back(c);
} else if(gs.vectors == 4 && gs.n == 4) {
c.type = Type::EQUAL_ANGLE;
c.entityA = gs.vector[0];
c.entityB = gs.vector[1];
c.entityC = gs.vector[2];
c.entityD = gs.vector[3];
newcons.push_back(c);
} else if(gs.vectors == 3 && gs.n == 3) {
c.type = Type::EQUAL_ANGLE;
c.entityA = gs.vector[0];
c.entityB = gs.vector[1];
c.entityC = gs.vector[1];
c.entityD = gs.vector[2];
newcons.push_back(c);
} else if(gs.circlesOrArcs >= 2 && gs.circlesOrArcs == gs.n) {
c.type = Type::EQUAL_RADIUS;
c.entityA = gs.entity[0];