Sketcher: Implement symmetry with respect to a point constraint, aka midpoint constraint
This commit is contained in:
@@ -537,8 +537,13 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
rtn = addEqualConstraint(constraint->First,constraint->Second);
|
||||
break;
|
||||
case Symmetric:
|
||||
rtn = addSymmetricConstraint(constraint->First,constraint->FirstPos,
|
||||
constraint->Second,constraint->SecondPos,constraint->Third);
|
||||
if (constraint->ThirdPos != none)
|
||||
rtn = addSymmetricConstraint(constraint->First,constraint->FirstPos,
|
||||
constraint->Second,constraint->SecondPos,
|
||||
constraint->Third,constraint->ThirdPos);
|
||||
else
|
||||
rtn = addSymmetricConstraint(constraint->First,constraint->FirstPos,
|
||||
constraint->Second,constraint->SecondPos,constraint->Third);
|
||||
break;
|
||||
case None:
|
||||
break;
|
||||
@@ -1522,6 +1527,30 @@ int Sketch::addSymmetricConstraint(int geoId1, PointPos pos1, int geoId2, PointP
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Sketch::addSymmetricConstraint(int geoId1, PointPos pos1, int geoId2, PointPos pos2,
|
||||
int geoId3, PointPos pos3)
|
||||
{
|
||||
geoId1 = checkGeoId(geoId1);
|
||||
geoId2 = checkGeoId(geoId2);
|
||||
geoId3 = checkGeoId(geoId3);
|
||||
|
||||
int pointId1 = getPointId(geoId1, pos1);
|
||||
int pointId2 = getPointId(geoId2, pos2);
|
||||
int pointId3 = getPointId(geoId3, pos3);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size()) &&
|
||||
pointId2 >= 0 && pointId2 < int(Points.size()) &&
|
||||
pointId3 >= 0 && pointId3 < int(Points.size())) {
|
||||
GCS::Point &p1 = Points[pointId1];
|
||||
GCS::Point &p2 = Points[pointId2];
|
||||
GCS::Point &p = Points[pointId3];
|
||||
int tag = ++ConstraintsCounter;
|
||||
GCSsys.addConstraintP2PSymmetric(p1, p2, p, tag);
|
||||
return ConstraintsCounter;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool Sketch::updateGeometry()
|
||||
{
|
||||
int i=0;
|
||||
|
||||
Reference in New Issue
Block a user