Sketcher: BSpline solver Internal Geometry for poles
This commit is contained in:
parent
07eebb1c52
commit
d949f52878
|
@ -67,7 +67,8 @@ enum InternalAlignmentType {
|
|||
HyperbolaMajor = 5,
|
||||
HyperbolaMinor = 6,
|
||||
HyperbolaFocus = 7,
|
||||
ParabolaFocus = 8
|
||||
ParabolaFocus = 8,
|
||||
BSplineControlPoint = 9 // in this constraint "Third" is used to indicate the index of the control point (0-poles), it is not a GeoId
|
||||
};
|
||||
|
||||
/// define if you want to use the end or start point
|
||||
|
|
|
@ -1197,6 +1197,8 @@ int Sketch::addConstraint(const Constraint *constraint)
|
|||
case ParabolaFocus:
|
||||
rtn = addInternalAlignmentParabolaFocus(constraint->First,constraint->Second);
|
||||
break;
|
||||
case BSplineControlPoint:
|
||||
rtn = addInternalAlignmentBSplineControlPoint(constraint->First,constraint->Second, constraint->Third);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2396,6 +2398,32 @@ int Sketch::addInternalAlignmentParabolaFocus(int geoId1, int geoId2)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int Sketch::addInternalAlignmentBSplineControlPoint(int geoId1, int geoId2, int poleindex)
|
||||
{
|
||||
std::swap(geoId1, geoId2);
|
||||
|
||||
geoId1 = checkGeoId(geoId1);
|
||||
geoId2 = checkGeoId(geoId2);
|
||||
|
||||
if (Geoms[geoId1].type != BSpline)
|
||||
return -1;
|
||||
if (Geoms[geoId2].type != Circle)
|
||||
return -1;
|
||||
|
||||
int pointId1 = getPointId(geoId2, mid);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size())) {
|
||||
GCS::Circle &c = Circles[Geoms[geoId2].index];
|
||||
|
||||
GCS::BSpline &b = BSplines[Geoms[geoId1].index];
|
||||
|
||||
int tag = ++ConstraintsCounter;
|
||||
GCSsys.addConstraintInternalAlignmentBSplineControlPoint(b, c, poleindex, tag);
|
||||
return ConstraintsCounter;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
double Sketch::calculateAngleViaPoint(int geoId1, int geoId2, double px, double py)
|
||||
{
|
||||
geoId1 = checkGeoId(geoId1);
|
||||
|
|
|
@ -314,6 +314,7 @@ public:
|
|||
int addInternalAlignmentHyperbolaMinorDiameter(int geoId1, int geoId2);
|
||||
int addInternalAlignmentHyperbolaFocus(int geoId1, int geoId2);
|
||||
int addInternalAlignmentParabolaFocus(int geoId1, int geoId2);
|
||||
int addInternalAlignmentBSplineControlPoint(int geoId1, int geoId2, int poleindex);
|
||||
//@}
|
||||
public:
|
||||
//This func is to be used during angle-via-point constraint creation. It calculates
|
||||
|
|
|
@ -1007,6 +1007,12 @@ int System::addConstraintInternalAlignmentParabolaFocus(Parabola &e, Point &p1,
|
|||
return addConstraintEqual(e.focus1.y, p1.y, tagId);
|
||||
}
|
||||
|
||||
int System::addConstraintInternalAlignmentBSplineControlPoint(BSpline &b, Circle &c, int poleindex, int tagId)
|
||||
{
|
||||
addConstraintEqual(b.poles[poleindex].x, c.center.x, tagId);
|
||||
return addConstraintEqual(b.poles[poleindex].y, c.center.y, tagId);
|
||||
}
|
||||
|
||||
|
||||
//calculates angle between two curves at point of their intersection p. If two
|
||||
//points are supplied, p is used for first curve and p2 for second, yielding a
|
||||
|
|
|
@ -233,6 +233,7 @@ namespace GCS
|
|||
int addConstraintInternalAlignmentHyperbolaMinorDiameter(Hyperbola &e, Point &p1, Point &p2, int tagId=0);
|
||||
int addConstraintInternalAlignmentHyperbolaFocus(Hyperbola &e, Point &p1, int tagId=0);
|
||||
int addConstraintInternalAlignmentParabolaFocus(Parabola &e, Point &p1, int tagId=0);
|
||||
int addConstraintInternalAlignmentBSplineControlPoint(BSpline &b, Circle &c, int poleindex, int tag=0);
|
||||
|
||||
double calculateAngleViaPoint(Curve &crv1, Curve &crv2, Point &p);
|
||||
double calculateAngleViaPoint(Curve &crv1, Curve &crv2, Point &p1, Point &p2);
|
||||
|
|
Loading…
Reference in New Issue
Block a user