Sketcher: Bspline solver knot support - unfinished
This commit is contained in:
@@ -68,7 +68,8 @@ enum InternalAlignmentType {
|
||||
HyperbolaMinor = 6,
|
||||
HyperbolaFocus = 7,
|
||||
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
|
||||
BSplineControlPoint = 9,
|
||||
BSplineKnotPoint = 10,
|
||||
};
|
||||
|
||||
/// define if you want to use the end or start point
|
||||
|
||||
@@ -1244,6 +1244,8 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
break;
|
||||
case BSplineControlPoint:
|
||||
rtn = addInternalAlignmentBSplineControlPoint(constraint->First,constraint->Second, constraint->InternalAlignmentIndex);
|
||||
case BSplineKnotPoint:
|
||||
rtn = addInternalAlignmentKnotPoint(constraint->First,constraint->Second, constraint->InternalAlignmentIndex);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -2469,6 +2471,32 @@ int Sketch::addInternalAlignmentBSplineControlPoint(int geoId1, int geoId2, int
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Sketch::addInternalAlignmentKnotPoint(int geoId1, int geoId2, int knotindex)
|
||||
{
|
||||
std::swap(geoId1, geoId2);
|
||||
|
||||
geoId1 = checkGeoId(geoId1);
|
||||
geoId2 = checkGeoId(geoId2);
|
||||
|
||||
if (Geoms[geoId1].type != BSpline)
|
||||
return -1;
|
||||
if (Geoms[geoId2].type != Point)
|
||||
return -1;
|
||||
|
||||
int pointId1 = getPointId(geoId2, start);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size())) {
|
||||
GCS::Point &p = Points[pointId1];
|
||||
|
||||
GCS::BSpline &b = BSplines[Geoms[geoId1].index];
|
||||
|
||||
int tag = ++ConstraintsCounter;
|
||||
GCSsys.addConstraintInternalAlignmentBSplineKnot(b, p, knotindex, tag);
|
||||
return ConstraintsCounter;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
double Sketch::calculateAngleViaPoint(int geoId1, int geoId2, double px, double py)
|
||||
{
|
||||
geoId1 = checkGeoId(geoId1);
|
||||
|
||||
@@ -315,6 +315,7 @@ public:
|
||||
int addInternalAlignmentHyperbolaFocus(int geoId1, int geoId2);
|
||||
int addInternalAlignmentParabolaFocus(int geoId1, int geoId2);
|
||||
int addInternalAlignmentBSplineControlPoint(int geoId1, int geoId2, int poleindex);
|
||||
int addInternalAlignmentKnotPoint(int geoId1, int geoId2, int knotindex);
|
||||
//@}
|
||||
public:
|
||||
//This func is to be used during angle-via-point constraint creation. It calculates
|
||||
|
||||
@@ -1014,6 +1014,12 @@ int System::addConstraintInternalAlignmentBSplineControlPoint(BSpline &b, Circle
|
||||
return addConstraintEqual(b.weights[poleindex], c.rad, tagId);
|
||||
}
|
||||
|
||||
int System::addConstraintInternalAlignmentBSplineKnot(BSpline &b, Point &p, int knotindex, int tagId)
|
||||
{
|
||||
// not yet implemented
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//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
|
||||
|
||||
@@ -234,6 +234,7 @@ namespace GCS
|
||||
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);
|
||||
int addConstraintInternalAlignmentBSplineKnot(BSpline &b, Point &p, int knotindex, int tagId=0);
|
||||
|
||||
double calculateAngleViaPoint(Curve &crv1, Curve &crv2, Point &p);
|
||||
double calculateAngleViaPoint(Curve &crv1, Curve &crv2, Point &p1, Point &p2);
|
||||
|
||||
Reference in New Issue
Block a user