GCS: Diameter constraint emulation through ConstraintEqual
This commit is contained in:
@@ -501,6 +501,14 @@ int System::addConstraintEqual(double *param1, double *param2, int tagId, bool d
|
||||
return addConstraint(constr);
|
||||
}
|
||||
|
||||
int System::addConstraintProportional(double *param1, double *param2, double ratio, int tagId, bool driving)
|
||||
{
|
||||
Constraint *constr = new ConstraintEqual(param1, param2, ratio);
|
||||
constr->setTag(tagId);
|
||||
constr->setDriving(driving);
|
||||
return addConstraint(constr);
|
||||
}
|
||||
|
||||
int System::addConstraintDifference(double *param1, double *param2,
|
||||
double *difference, int tagId, bool driving)
|
||||
{
|
||||
@@ -872,6 +880,16 @@ int System::addConstraintArcRadius(Arc &a, double *radius, int tagId, bool drivi
|
||||
return addConstraintEqual(a.rad, radius, tagId, driving);
|
||||
}
|
||||
|
||||
int System::addConstraintCircleDiameter(Circle &c, double *radius, int tagId, bool driving)
|
||||
{
|
||||
return addConstraintProportional(c.rad, radius, 0.5, tagId, driving);
|
||||
}
|
||||
|
||||
int System::addConstraintArcDiameter(Arc &a, double *radius, int tagId, bool driving)
|
||||
{
|
||||
return addConstraintProportional(a.rad, radius, 0.5, tagId, driving);
|
||||
}
|
||||
|
||||
int System::addConstraintEqualLength(Line &l1, Line &l2, double *length, int tagId, bool driving)
|
||||
{
|
||||
addConstraintP2PDistance(l1.p1, l1.p2, length, tagId, driving);
|
||||
|
||||
@@ -147,6 +147,7 @@ namespace GCS
|
||||
|
||||
// basic constraints
|
||||
int addConstraintEqual(double *param1, double *param2, int tagId=0, bool driving = true);
|
||||
int addConstraintProportional(double *param1, double *param2, double ratio, int tagId, bool driving = true);
|
||||
int addConstraintDifference(double *param1, double *param2,
|
||||
double *difference, int tagId=0, bool driving = true);
|
||||
int addConstraintP2PDistance(Point &p1, Point &p2, double *distance, int tagId=0, bool driving = true);
|
||||
@@ -210,6 +211,8 @@ namespace GCS
|
||||
|
||||
int addConstraintCircleRadius(Circle &c, double *radius, int tagId=0, bool driving = true);
|
||||
int addConstraintArcRadius(Arc &a, double *radius, int tagId=0, bool driving = true);
|
||||
int addConstraintCircleDiameter(Circle &c, double *radius, int tagId=0, bool driving = true);
|
||||
int addConstraintArcDiameter(Arc &a, double *radius, int tagId=0, bool driving = true);
|
||||
int addConstraintEqualLength(Line &l1, Line &l2, double *length, int tagId=0, bool driving = true);
|
||||
int addConstraintEqualRadius(Circle &c1, Circle &c2, int tagId=0, bool driving = true);
|
||||
int addConstraintEqualRadii(Ellipse &e1, Ellipse &e2, int tagId=0, bool driving = true);
|
||||
|
||||
Reference in New Issue
Block a user