Sketcher : Circle to Line Distance Constraint

This commit is contained in:
Florian Foinant-Willig
2023-03-23 20:53:20 +01:00
committed by abdullahtahiriyo
parent 691917804f
commit 70eb14ac9c
9 changed files with 217 additions and 23 deletions

View File

@@ -2753,19 +2753,29 @@ int Sketch::addDistanceConstraint(int geoId1, PointPos pos1, int geoId2, PointPo
return -1;
}
// circle-circle offset distance constraint
// circle-(circle or line) distance constraint
int Sketch::addDistanceConstraint(int geoId1, int geoId2, double * value, bool driving)
{
if ((Geoms[geoId1].type == Circle) && (Geoms[geoId2].type == Circle)) {
GCS::Circle &c1 = Circles[Geoms[geoId1].index];
GCS::Circle &c2 = Circles[Geoms[geoId2].index];
int tag = ++ConstraintsCounter;
GCSsys.addConstraintC2CDistance(c1, c2, value, tag, driving);
return ConstraintsCounter;
if (Geoms[geoId1].type == Circle) {
if (Geoms[geoId2].type == Circle) {
GCS::Circle &c1 = Circles[Geoms[geoId1].index];
GCS::Circle &c2 = Circles[Geoms[geoId2].index];
int tag = ++ConstraintsCounter;
GCSsys.addConstraintC2CDistance(c1, c2, value, tag, driving);
return ConstraintsCounter;
} else if (Geoms[geoId2].type == Line) {
GCS::Circle &c = Circles[Geoms[geoId1].index];
GCS::Line &l = Lines[Geoms[geoId2].index];
int tag = ++ConstraintsCounter;
GCSsys.addConstraintC2LDistance(c, l, value, tag, driving);
return ConstraintsCounter;
}
}
return -1;
}
int Sketch::addRadiusConstraint(int geoId, double * value, bool driving)
{
geoId = checkGeoId(geoId);