Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members

MSBsplineCurve is a "Non uniform, rational Bspline curve". More...

#include <MSBsplineCurve.h>

Inheritance diagram for MSBsplineCurve:
RefCountedMSBsplineCurve

Public Types

enum  KnotPosition {
  KNOTPOS_BEFORE_START = 0, KNOTPOS_START, KNOTPOS_INTERVAL, KNOTPOS_INTERIOR,
  KNOTPOS_FINAL, KNOTPOS_AFTER_FINAL
}
 enumeration of possible classifications of a knot value wrt to the knot array. More...
 

Public Member Functions

MSBsplineCurvePtr CreateCapture ()
 Copy bits into smart pointer. Caller instance zeroed out. More...
 
void ExtractTo (MSBsplineCurveR dest)
 Copy bits into simple structure. Caller instance zeroed. More...
 
MSBsplineCurvePtr CreateCopy () const
 Return copy as smart pointer target. More...
 
MSBsplineCurvePtr CreateCopyOpenAtFraction (double fraction) const
 Return copy as smart pointer target; if closed, open it at fraction. More...
 
MSBsplineCurvePtr CreateCopyOpenAtKnot (double knot) const
 Return copy as smart pointer target; if closed, open it at knot. More...
 
MSBsplineCurvePtr CreateCopyClosed () const
 Return copy as smart pointer target; if physically closed revise poles to be a closed bspline More...
 
MSBsplineCurvePtr CreateCopyBetweenFractions (double fraction0, double fraction1) const
 Copy the portion between specified fractions. More...
 
MSBsplineCurvePtr CreateCopyBetweenKnots (double knot0, double knot1) const
 Copy the portion between specified knots. More...
 
MSBsplineCurvePtr CreateCopyReversed () const
 Complete copy with reversed parameterization. More...
 
MSBsplineCurvePtr CreateCopyTransformed (TransformCR transform) const
 Copy with transform applied to poles. More...
 
MSBsplineCurvePtr CreateCopyBezier () const
 Copy with all knots saturated. More...
 
MSBsplineCurvePtr CreateCopyOffsetXY (double offset0, double offset1, CurveOffsetOptionsCR options) const
 Copy with offset in XY plane. More...
 
void GetDisjointCurves (bvector< MSBsplineCurvePtr > &curves) const
 Create copies of each segment with breaks at disjoint knot points. More...
 
void GetC1DiscontinuousCurves (bvector< double > &fractions, bvector< MSBsplineCurvePtr > &curves) const
 Create copies of each segment with breaks at point or tangent changes. More...
 
bool IsPhysicallyClosed (double tolerance) const
 Check whether the B-spline curve is physically closed. More...
 
bool IsClosed () const
 Check whether the B-spline curve is periodic. More...
 
bool IsParabola (TransformR localToWorld, TransformR worldToLocal, double &vertexFraction, DPoint3dR localStart, DPoint3dR localEnd, double &xSquaredCoefficient) const
 Check if the B-spline curve is a single quadratic that is a parabola. More...
 
bool HasWeights () const
 Check whether the B-spline curve has stored weights (This does not check if any are other than 1.0) More...
 
void Zero ()
 ! More...
 
void SwapContents (MSBsplineCurveR other)
 Exchange all bits with other. Usually used to transfer poles etc and leave zeros behind. More...
 
MSBsplineStatus Allocate ()
 Allocate memory arrays to match the current counts. More...
 
void ReleaseMem ()
 Free memory allocated for the poles, weights and knot vector of a B-spline curve. More...
 
MSBsplineStatus Allocate (int numPoles, int order, bool closed, bool rational)
 Zero all, copy counts to params, allocate: More...
 
MSBsplineStatus AllocatePoles (int count, DPoint3dCP data=NULL)
 Allocate pole pointer to specified count. (Optionally)copy data from callers buffer More...
 
MSBsplineStatus AllocateKnots (int count, double const *data=NULL)
 Allocate knot pointer to specified count. (Optionally)copy data from callers buffer More...
 
MSBsplineStatus AllocateWeights (int count, double const *data=NULL)
 Allocate weight pointer to specified count. (Optionally)copy data from callers buffer More...
 
MSBsplineStatus CopyFrom (MSBsplineCurveCR source)
 Allocate memory for the B-spline curve and copies all data from the input B-spline curve. More...
 
bool ComputeUniformKnots ()
 Compute uniformly spaced knots. More...
 
void FractionToPoint (DPoint3dR xyz, double f) const
 Fraction parameter to point on the B-spline curve. More...
 
void FractionToPoint (DPoint3dR xyz, DVec3dR tangent, double f) const
 Fraction parameter to both point and derivative. Derivative is wrt the fraction parameter. More...
 
void FractionToPoint (DPoint3dR xyz, double &weight, DVec3dR tangent, double f) const
 Fraction parameter to both point and derivative. More...
 
void FractionToPoint (DPoint3dR xyz, DVec3dR dXYZ, DVec3dR ddXYZ, double f) const
 Fraction parameter to point and 2 derivatives. Derivatives are wrt the fraction parameter. More...
 
void FractionToPoints (bvector< DPoint3d > &points, size_t numPoints)
 Evaluate a series of points at numPoints parameters. These parameters are spaced evenly throughout the parameter range. More...
 
void FractionToPoints (bvector< DPoint3d > &points, bvector< double > &fractions)
 Evaluate a series of points at given parametrs. More...
 
MSBsplineStatus GetFrenetFrame (DVec3dP frame, DPoint3dR point, double &curvature, double &torsion, double u) const
 Calculate the Frenet frame, radius of curvature, and torsion of the B-spline curve at a particular fractional parameter value. More...
 
MSBsplineStatus GetFrenetFrame (TransformR frame, double u) const
 Calculate the Frenet frame, radius of curvature, and torsion of the B-spline curve at a particular fractional parameter value. More...
 
MSBsplineStatus ComputeDerivatives (DVec3dP dervs, int numDervs, double fractionParameter) const
 Calculate the number of derivatives specified by numDervs of the B-spline curve at a particular fraction. More...
 
void ClosestPoint (DPoint3dR curvePoint, double &fraction, DPoint3dCR spacePoint) const
 find closest point and its fractional parameter on spline More...
 
void ClosestPointXY (DPoint3dR curvePoint, double &fraction, double &xyDistance, DPoint3dCR spacePoint, DMatrix4dCP viewMatrix) const
 find closest point after (optional) viewing matrix. More...
 
double FractionToKnot (double f) const
 Return the knot value at a fractional parameter ... More...
 
double KnotToFraction (double knot) const
 Return the fractional parameter corresponding to a knot value ... More...
 
void GetKnotRange (double &knotA, double &knotB) const
 Return the knot values corresponding to fraction 0 and fraction 1 ... More...
 
DSegment1d GetKnotRange () const
 Return the knot range as DSegment1d.. More...
 
void GetKnotRange (double &knotA, double &knotB, int &indexA, int &indexB, double &knotTolerance) const
 Return the knot values and indices corresponding to fraction 0 and fraction 1, and also the equal-knot tolerance ... More...
 
double GetKnot (size_t index) const
 return knot by index. returns 0 if out of range. (Use NumberAllocatedKnots to determine index range). More...
 
void KnotToBlendFunctions (double *blend, double *blendDerivative, size_t &knotIndex, double u) const
 Compute blending functions at KNOT value (unnormalized) knotIndex is the index of the knot to the right of u. More...
 
DPoint3d GetPole (size_t index) const
 return pole by index. More...
 
DPoint3d GetPole (int index) const
 
DPoint3d GetReversePole (size_t index) const
 return pole by index, counting from the last pole . More...
 
DPoint3d GetReversePole (int index) const
 
double GetReverseWeight (size_t index) const
 return weight by index, counting from the last weight. More...
 
double GetReverseWeight (int index) const
 
DPoint3d GetUnWeightedPole (size_t index, bool reverse=false) const
 return pole by index. More...
 
DPoint3d GetUnWeightedPole (int index, bool reverse=false) const
 
void TransformPoles (TransformCR transform, size_t index, size_t n)
 Apply a transform to a single pole. More...
 
DPoint3d const * GetPoleCP () const
 return pointer to contiguous poles. More...
 
double const * GetWeightCP () const
 return pointer to contiguous weights More...
 
double const * GetKnotCP () const
 return pointer to contiguous knots. More...
 
DPoint3d * GetPoleP () const
 return pointer to contiguous poles. More...
 
double * GetWeightP () const
 return pointer to contiguous weights More...
 
double * GetKnotP () const
 return pointer to contiguous knots. More...
 
DRange1d GetWeightRange () const
 
bool SetPole (size_t index, DPoint3dCR value)
 set pole by index. More...
 
bool SetPole (int index, DPoint3dCR value)
 
bool SetReWeightedPole (size_t index, DPoint3dCR value, bool reverse=false)
 set pole by index. More...
 
bool SetReWeightedPole (int index, DPoint3dCR value, bool reverse=false)
 
bool SetPole (size_t index, double x, double y, double z)
 set pole by index. More...
 
bool SetWeight (size_t index, double value)
 set weight by index. More...
 
bool SetWeight (int index, double value)
 
bool SetKnot (size_t index, double value)
 set weight by index. More...
 
bool SetPoles (size_t index, DPoint3dCP value, size_t n)
 set pole by index. More...
 
bool SetWeights (size_t index, double const *value, size_t n)
 set weight by index. More...
 
bool SetKnots (size_t index, double const *value, size_t n)
 set weight by index. More...
 
void UnWeightPoles ()
 if the curve is rational, divide (wx,wy,wz) style poles by the weights More...
 
void WeightPoles ()
 if the curve is rational, multiply (wx,wy,wz) style poles by the weights More...
 
DPoint4d GetPoleDPoint4d (size_t index) const
 return pole by index. More...
 
double GetWeight (size_t index) const
 return weight by index. returns 1 if index out of range or curve is unweighted. (Use NumberAllocatedPoles to determine index range). More...
 
double GetWeight (int index) const
 
void GetUnWeightedPoles (bvector< DPoint3d > &outData) const
 Copy all poles out into caller array, dividing each by its weight. More...
 
void GetPoles (bvector< DPoint3d > &outData) const
 Copy all poles out into caller array. More...
 
void GetWeights (bvector< double > &outData) const
 Copy all weights out into caller array. More...
 
void GetKnots (bvector< double > &outData) const
 Copy all knots out into caller array. More...
 
void GetPoles4d (bvector< DPoint4d > &outData) const
 Copy all poles out into caller array. More...
 
int GetIntOrder () const
 return the curve order. More...
 
size_t GetOrder () const
 
size_t GetNumPoles () const
 
size_t GetNumKnots () const
 
int GetIntNumPoles () const
 
int GetIntNumKnots () const
 
bool AreKnotsValid (bool clampingRequired=true) const
 Return false if knot counts or values are invalid. More...
 
bool GetCurveDisplay () const
 Return curve display flag. More...
 
bool GetPolygonDisplay () const
 Return polygon display flag. More...
 
void SetCurveDisplay (bool value)
 Set the curve display flag. More...
 
void SetPolygonDisplay (bool value)
 Set the polygon display flag. More...
 
bool MapKnots (double a, double b)
 rewrite knot values in a..b. Return true if a,b and current start,end define a valid scale factor More...
 
MSBsplineStatus AddKnot (double unnormalizedKnotValue, int newMultiplicity)
 Add a given knot value to the B-spline curve. More...
 
void NormalizeKnots ()
 Normalize knots to 01. More...
 
void ComputeGrevilleAbscissa (bvector< double > &averageKnots) const
 
MSBsplineStatus CopyOpen (MSBsplineCurveCR source, double unnormalizedKnot)
 Create B-spline curve by opening a closed B-spline curve. More...
 
MSBsplineStatus CopyClosed (MSBsplineCurveCR source)
 Create B-spline curve by closing a open B-spline curve. More...
 
MSBsplineStatus CopyReversed (MSBsplineCurveCR source)
 Create B-spline curve by reserving the direction of a B-spline curve. More...
 
MSBsplineStatus CopySegment (MSBsplineCurveCR source, double unnormalizedKnotA, double unnormalizedKnotB)
 Create B-spline curve by extracting a part of a B-spline curve. More...
 
MSBsplineStatus CopyFractionSegment (MSBsplineCurveCR source, double fractionA, double fractionB)
 Create B-spline curve by extracting a part of a B-spline curve. More...
 
MSBsplineStatus CopyTransformed (MSBsplineCurveCR source, TransformCR trans)
 Create B-spline curve by transforming a B-spline curve. More...
 
bool GetSupport (bvector< DPoint4d > &outPoles, bvector< double > &outKnots, size_t bezierSelect) const
 Extract the {order} poles and {2*(order-1)} knots that support a single bezier interval ... More...
 
bool GetSupport (BCurveSegmentR segment, size_t bezierSelect) const
 Extract the {order} poles and {2*(order-1)} knots that support a single bezier interval ... More...
 
bool GetBezier (BCurveSegment &segment, size_t bezierSelect) const
 Get poles for a single bezier poles from the curve. More...
 
size_t CountDistinctBeziers () const
 Count the number of beziers that have non-null knot intervals. More...
 
size_t FindKnotInterval (double knotValue) const
 Return the index of the knot at the left of the interval containing specified knot. More...
 
bool AdvanceToBezier (BCurveSegment &segment, size_t &bezierSelect, bool saturateKnots=true) const
 Move forward looking for a bezier segment of the curve. More...
 
bool AdvanceToBezierInKnotInterval (BCurveSegment &segment, size_t &bezierSelect, DRange1dCR interval) const
 Move forward looking for a bezier segment that overlaps a knot interval. More...
 
bool AdvanceToBezierInFractionInterval (BCurveSegment &segment, size_t &bezierSelect, DRange1dCR interval) const
 Move forward looking for a bezier segment that overlaps a knot interval. More...
 
size_t GetTailBezierSelect () const
 return an index to use to start "Retreat" order bezier access. More...
 
bool RetreatToBezierInKnotInterval (BCurveSegment &segment, size_t &bezierSelect, DRange1dCR interval) const
 
KnotPosition SearchKnot (double unnormalizedKnotValue, int &k0, int &k1, double &correctedKnotValue) const
 Search for a knot value. More...
 
double Length () const
 compute the length of the B-spline curve. More...
 
double Length (RotMatrixCP worldToLocal) const
 compute the length of the transformed bspline curve More...
 
double LengthBetweenKnots (double startKnot, double endKnot) const
 compute the length of the B-spline curve at a given knot interval [startKnot, endKnot]. More...
 
double LengthBetweenKnots (RotMatrixCP worldTolocal, double startKnot, double endKnot) const
 compute the length of the B-spline curve at a given knot interval [startKnot, endKnot]. More...
 
double LengthBetweenFractions (double startFraction, double endFraction) const
 compute the length of the B-spline curve at a given fraction interval [startFraction, endFraction]. More...
 
double LengthBetweenFractions (RotMatrixCP worldTolocal, double startFraction, double endFraction) const
 compute the length of the B-spline curve at a given fraction interval [startFraction, endFraction]. More...
 
bool FractionAtSignedDistance (double startParam, double signedDistance, double &endParam, double &actualSignedDistance) const
 Move by (up to !!) signedDistance along the curve. More...
 
bool FractionAtSignedDistance (RotMatrixCP worldToLocal, double startParam, double signedDistance, double &endParam, double &actualSignedDistance) const
 Move by (up to !!) signedDistance along the curve. More...
 
MSBsplineStatus ComputeInflectionPoints (DPoint3dP &points, double *&params, int &numPoints)
 Calculate the parameters and location of the all inflection points of a B-spline curve. More...
 
MSBsplineStatus ComputeInflectionPoints (bvector< DPoint3d > &points, bvector< double > &params)
 Calculate the parameters and location of the all inflection points of a B-spline curve. More...
 
MSBsplineStatus ComputeInflectionPointsXY (bvector< DPoint3d > &points, bvector< double > &params, RotMatrixCP transform)
 Calculate the parameters and location of the all inflection points of a B-spline curve. More...
 
void AddPlaneIntersections (bvector< DPoint3d > *points, bvector< double > *fractionParameters, DPlane3dCR plane) const
 Compute intersections with plane. More...
 
void AddPlaneIntersections (bvector< DPoint3d > *points, bvector< double > *fractionParameters, DPoint4dCR planeCoffs) const
 Compute intersections with plane (plane in homogeneous form) More...
 
void AddLineIntersectionsXY (bvector< DPoint3d > *curvePoints, bvector< double > *curveFractions, bvector< DPoint3d > *linePoints, bvector< double > *lineFractions, DSegment3dCR segment, bool extendSegment, DMatrix4dCP matrix) const
 Compute intersections with line segment, as viewed in xy plane. More...
 
void AddLinestringIntersectionsXY (bvector< DPoint3d > *curveAPoints, bvector< double > *curveAFractions, bvector< DPoint3d > *curveBPoints, bvector< double > *curveBFractions, bvector< DPoint3d > const &linestring, DMatrix4dCP matrix) const
 Compute intersections with a linestring, as viewed in xy plane. More...
 
void AddLinestringIntersectionsXY (bvector< DPoint3d > *curveAPoints, bvector< double > *curveAFractions, bvector< DPoint3d > *curveBPoints, bvector< double > *curveBFractions, bvector< DPoint3d > const &linestring, bool extendLinestring, DMatrix4dCP matrix) const
 Compute intersections with a linestring, as viewed in xy plane. More...
 
void AddArcIntersectionsXY (bvector< DPoint3d > *curvePoints, bvector< double > *curveFractions, bvector< DPoint3d > *ellipsePoints, bvector< double > *ellipseFractions, DEllipse3dCR arc, bool extendConic, DMatrix4dCP matrix) const
 Compute intersections with ellipse, as viewed in xy plane. More...
 
void AddCurveIntersectionsXY (bvector< DPoint3d > *curveAPoints, bvector< double > *curveAFractions, bvector< DPoint3d > *curveBPoints, bvector< double > *curveBFractions, MSBsplineCurveCR curveB, DMatrix4dCP matrix) const
 Compute intersections with ellipse, as viewed in xy plane. More...
 
void AddCusps (bvector< DPoint3d > *points, bvector< double > *fractionParameters) const
 Find full 3d cusps. More...
 
void AddCuspsXY (bvector< DPoint3d > *points, bvector< double > *fractionParameters, DMatrix4dCP matrix) const
 Find full cusps as viewed in xy. More...
 
MSBsplineStatus MakeOpen (double u)
 Open the closed B-spline curve. More...
 
MSBsplineStatus MakeClosed ()
 Close the open B-spline curve. More...
 
MSBsplineStatus MakeReversed ()
 Reverse the direction of the B-spline curve. More...
 
MSBsplineStatus MakeRational ()
 Make an equivalent rational B-spline curve. More...
 
MSBsplineStatus ExtractSegmentBetweenKnots (MSBsplineCurveR target, double unnormalizedKnotA, double unnormalizedKnotB)
 Exteact the curve from the B-spline curve at the interval [unnormalizedKnotA, unnormalizedKnotB]. More...
 
void ExtractEndPoints (DPoint3dR start, DPoint3dR end) const
 Extract the start or end point of the B-spline curve. More...
 
MSBsplineStatus ExtractCurveNormal (DVec3dR normal, DPoint3dR position, double &planarDeviation) const
 Calculate the normal and center of a plane containing the B-spline curve. More...
 
void AddStrokes (bvector< DPoint3d > &points, double chordTol=0.0, double angleTol=0.20, double maxEdgeLength=0.0, bool includeStartPoint=true) const
 Compute stroke approximation. More...
 
void PointsAtUniformFractions (bvector< DPoint3d > &points, bvector< double > &fractions, size_t numPoints) const
 Compute strokes at uniform fraction step. More...
 
bool PointsAtUniformArcLength (bvector< DPoint3d > &points, bvector< double > &fractions, size_t numPoints) const
 Compute points at uniform arclength steps. More...
 
void AddStrokes (bvector< DPoint3d > &points, bvector< DVec3d > *derivatives=NULL, bvector< double > *params=NULL, double chordTol=0.0, double angleTol=0.20, double maxEdgeLength=0.0, bool includeStartPoint=true, CurveParameterMapping parameterSelect=CURVE_PARAMETER_MAPPING_CurveKnot) const
 Compute stroke approximation. More...
 
void AddStrokes (IFacetOptionsCR options, bvector< DPoint3d > &points, bvector< DVec3d > *derivatives=NULL, bvector< double > *params=NULL, bool includeStart=true) const
 Compute stroke approximation. More...
 
void AddStrokes (size_t numPoints, bvector< DPoint3d > &points, bvector< DVec3d > *derivatives=NULL, bvector< double > *params=NULL, bool includeStartPoint=true, CurveParameterMapping parameterSelect=CURVE_PARAMETER_MAPPING_CurveKnot) const
 Compute a fixed number of points at regularly spaced fractional parameters. More...
 
size_t GetStrokeCount (double chordTol=0.0, double angleTol=0.20, double maxEdgeLength=0.0) const
 Compute stroke count. More...
 
void AllTangentsXY (bvector< DPoint3d > &points, bvector< double > &fractions, DPoint3dCR spacePoint, DMatrix4dCP matrix) const
 For space point Q (spacePoint), find all curve points X where line XQ is tangent to the curve. More...
 
void AllTangents (bvector< DPoint3d > &points, bvector< double > &fractions, DPoint3dCR spacePoint) const
 For space point Q, find all curve points X where line XQ is tangent to the curve. More...
 
bool ClosestTangentXY (DPoint3dR curvePoint, double &curveFraction, DPoint3dCR spacePoint, DPoint3dCR biasPoint, DMatrix4dCP matrix) const
 For space point Q (spacePoint), find a curve point X where line XQ is tangent to the curve. More...
 
bool ClosestTangent (DPoint3dR curvePoint, double &curveFraction, DPoint3dCR spacePoint, DPoint3dCR biasPoint) const
 For space point Q (spacePoint), find a curve point X where line XQ is tangent to the curve. More...
 
void AllParallellTangentsXY (bvector< DPoint3d > &points, bvector< double > &fractions, DVec3d vector) const
 Find all curve points X where the tangents is parallel to the given vector. More...
 
MSBsplineStatus CreateFromPointsAndOrder (DPoint3dCP pPoints, int numPoints, int order, bool closed=false)
 Create the B-spline curve from point array and order. More...
 
MSBsplineStatus Populate (bvector< DPoint3d > const &pointVector, bvector< double > const *weightVector, bvector< double > const *knotVector, int order, bool closed, bool inputPolesAlreadyWeighted)
 Populate the B-spline curve with the given parameters. More...
 
MSBsplineStatus Populate (DPoint3dCP pPoints, double const *pWeights, int numPoints, double const *pKnots, int numKnots, int order, bool closed, bool inputPolesAlreadyWeighted)
 Populate the B-spline curve with the given parameters. More...
 
MSBsplineStatus AppendCurve (MSBsplineCurveCR inCurve)
 Change the B-spline curve by appending a given curve. More...
 
bool IsSameGeometry (MSBsplineCurveCR other) const
 Check if the B-spline curves has same parameters with the given curve. More...
 
MSBsplineStatus ElevateDegree (int newDegree)
 Elevate the degree (increases the order) of the B-spline curve. More...
 
MSBsplineStatus MakeBezier (MSBsplineCurveR bezierCurve)
 Create equivalent Bézier curve for the B-spline curve. More...
 
MSBsplineStatus MakeBeziers (bvector< MSBsplineCurve > &beziers) const
 Create a series of Bézier curve for the B-spline curve. More...
 
void GetC1DiscontinuousFractions (bvector< double > &fractions) const
 Get all C1 fractional Discontinuities. More...
 
double PolygonLength () const
 Compute the length of the control polygon of the B-spline curve. More...
 
double Resolution () const
 Get a (fairly tight) tolerance for the B-spline curve. More...
 
double Resolution (double abstol, double reltol) const
 Get a tolerance of the B-spline curve. More...
 
void GetPoleRange (DRange3dR range) const
 Get the range of the poles of the B-spline curve. More...
 
DRange3d GetRange () const
 Get the range of the B-spline curve. More...
 
DRange1d GetRangeOfProjectionOnRay (DRay3dCR ray, double fraction0=0.0, double fraction1=1.0) const
 Get the range of parameters of the projection of (a fractional portion of the curve onto a ray return range whose low and high values are the extreme parameters (in ray fractions) of the projection of the curve onto the ray. More...
 
MSBsplineStatus RotateCurve (RotMatrixCR rMatrix)
 Rotate the B-spline curve. More...
 
MSBsplineStatus TransformCurve (TransformCR transform)
 Transform the B-spline curve. More...
 
MSBsplineStatus TransformCurve4d (DMatrix4dCR transform4d)
 Transform the B-spline curve using a 4d transformation. More...
 
void ProjectToZFocalPlane (double focalLength)
 convert to a weighted curve whose normalized points fall on a focal plane More...
 
MSBsplineStatus RemoveKnotsBounded (double tol, int startPreservation, int endPreservation)
 Remove all removable knots with the tolerance and end condition constraints. More...
 
MSBsplineStatus CleanKnots ()
 Clean all unnecessary knots. More...
 
MSBsplineStatus AppendCurves (MSBsplineCurveCR inCurve1, MSBsplineCurveCR inCurve2, bool forceContinuity, bool reparam)
 Create the B-spline curve by appending two input curves with continuity and reparameterization constraints. More...
 
void WireCentroid (double &length, DPoint3dR centroid, double fraction0, double fraction1) const
 Return the centroid of the (uniformly distributed) wire mass. More...
 
MSBsplineStatus InitEllipticArc (DPoint3d &center, double rX, double rY, double startRadians=0.0, double sweepRadians=msGeomConst_2pi, RotMatrixP axes=NULL)
 Create the B-spline curve from the parameters of an elliptic arc. More...
 
MSBsplineStatus InitFromDEllipse3d (DEllipse3dCR ellipse)
 Initialize the B-spline curve for an ellipse. More...
 
MSBsplineStatus InitFromDConic4d (DConic4dCR conic)
 Initialize the B-spline curve for a conic. More...
 
MSBsplineStatus InitFromPoints (DPoint3dCP points, int nPoints)
 Create the B-spline curve from point array and order. More...
 
MSBsplineStatus InitAkima (DPoint3dCP points, size_t nPoints)
 Create bspline equivalent of Akima curve. More...
 
MSBsplineStatus InitAkima (bvector< DPoint3d > const &points)
 Create bspline equivalent of Akima curve. More...
 
MSBsplineStatus InitFromBeziers (bvector< MSBsplineCurve > const &beziers)
 Create a B-spline curve from a series of Bézier curve. More...
 
MSBsplineStatus InitFromDPoint4dArray (DPoint4dCP pPoleArray, int numPoles, int order)
 Create a B-spline curve from an array of DPoint4d ponts. More...
 
MSBsplineStatus ApproximateAnyCurve (MSBsplineCurveCP pIn, double tolerance, int order, int parametrization, bool bMaintainEndTangents)
 This routine computes a B-spline curve approximated the old one. More...
 
MSBsplineStatus InitFromLeastSquaresFit (DPoint3dCP points, int numPoints, bool endControl, DVec3dCP sTangent, DVec3dCP eTangent, bool keepTanMag, int iterDegree, int reqDegree, bool singleKnot, double tolerance)
 This routine computes a B-spline curve approximated the give points set. More...
 
MSBsplineStatus InitFromGeneralLeastSquares (double *avgDistance, double *maxDistance, BsplineParam info, bvector< double > *knts, DPoint3d *pnts, double *uValues, int numPnts)
 This routine computes a B-spline curve with given numPoles and order approximated the give points set. More...
 
MSBsplineStatus InitFromInterpolatePoints (DPoint3dCP points, int numPoints, int parametrization, bool endControl, DVec3dCP sTangent, DVec3dCP eTangent, bool keepTanMag, int order)
 This routine computes a B-spline curve interpolated the give points set. More...
 
bool AlmostEqual (MSBsplineCurveCR other) const
 Compare curves. More...
 
bool AlmostEqual (MSBsplineCurveCR other, double tolerance) const
 Compare curves. More...
 
bool HasValidPoleAllocation () const
 
bool HasValidWeightAllocation () const
 
bool HasValidKnotAllocation () const
 
bool HasValidOrder () const
 
bool HasValidPoleCounts () const
 
bool HasValidCountsAndAllocations () const
 

Static Public Member Functions

static MSBsplineCurvePtr CreatePtr ()
 Returns a smart pointer to an MSBsplineCurve on the heap. More...
 
static MSBsplineCurvePtr CreateFromPolesAndOrder (bvector< DPoint3d > const &poles, bvector< double > const *weights, bvector< double > const *knots, int order, bool closed, bool inputPolesAlreadyWeighted)
 Allocate smart pointer target with directly supplied poles, weights, and knots. More...
 
static MSBsplineCurvePtr CreateFromPolesAndOrder (DPoint3dCP poles, int numPoles, int order, bool closed=false)
 Allocate smart pointer target with directly supplied poles, weights, and knots. More...
 
static MSBsplineCurvePtr CreateFromPolesAndOrder (DPoint2dCP poles, int numPoles, int order, bool closed=false)
 Allocate smart pointer target with directly supplied poles, weights, and knots. More...
 
static MSBsplineCurvePtr CreateFromInterpolationAtBasisFunctionPeaks (bvector< DPoint3d >const &xyz, size_t order, int selector=0)
 Create a spline curve with Lim's fit conditions or related. More...
 
static MSBsplineCurvePtr CreateFromInterpolationAtGrevilleKnots (ICurvePrimitiveCR curve, size_t numPoles, int order, bool normalizeKnots, int knotSelector=0)
 Create a spline curve that approximates a CurvePrimitive. More...
 
static MSBsplineCurvePtr CreateFromInterpolationPointsWithKnots (bvector< DPoint3d >const &xyz, bvector< double > const &interpolationKnots, bvector< double > curveKnots, int order)
 Create a spline with given. More...
 
static MSBsplineCurvePtr CreateInterpolationBetweenCurves (MSBsplineCurveCR curveA, double fraction, MSBsplineCurveCR curveB)
 Create a curve whose poles are interpolated between the poles of two curves. More...
 
static bool AreCompatible (MSBsplineCurveCR curveA, MSBsplineCurveCR curveB)
 Test if two curves have compatible knots, order, and pole count More...
 
static void MapFractions (bvector< double > *params, bvector< DVec3d > *derivatives, size_t i0, double knot0, double knot1, CurveParameterMapping select, MSBsplineCurveCP curve)
 
static void CompressKnots (bvector< double > const &inKnot, int order, bvector< double > &outKnot, bvector< size_t > &multiplicities, size_t &lowActiveIndex, size_t &highActiveIndex)
 compress knot values and mark active range. More...
 
static void ComputeUniformKnotGrevilleAbscissa (bvector< double > &averageKnots, size_t numInterval, int order)
 
static double GetRemovalKnotBound (MSBsplineCurveCP pCurve, int r, int s)
 Compute the bound of remove r-th knot s times. More...
 
static MSBsplineStatus SampleG1CurveByPoints (bvector< DPoint3d > &P, bvector< double > &up, bvector< double > &uq, MSBsplineCurveCP pCurve, int par, double Eg, double ptol)
 This approximation routine computes a set of sample points of a G1 continuous B-spline curve. More...
 
static MSBsplineStatus GeneralLeastSquaresApproximation (MSBsplineCurveP pOut, bvector< DPoint3d > const &Q, bvector< double > const &u, bvector< double > const &knots, int numPoles, int order)
 This routine computes a least square B-spline curve to the sample points. More...
 
static MSBsplineStatus WeightedLeastSquaresFit (MSBsplineCurveP pOut, bvector< DPoint3d > const Q, bvector< double > const u, bool endControl, DVec3dCP sTangent, DVec3dCP eTangent, int numPoles, int order)
 This routine computes a least square B-spline curve to the sample points. More...
 
static MSBsplineStatus KnotRefinement (bvector< double > const &X, MSBsplineCurveP pCurve)
 Insert a set of knot to given B-spline curve. More...
 
static MSBsplineStatus ApproximateG1Curve (MSBsplineCurveP pOut, MSBsplineCurveCP pIn, int degree, bool keepTangent, int parametrization, double geomTol, double paramTol, double pointTol)
 This routine computes a non-rational B-spline curve approximated the old one. More...
 
static MSBsplineStatus ApproximateNurbsCurve (MSBsplineCurveP pOut, MSBsplineCurveCP pIn, int degree, bool keepTangent, int parametrization, double tol)
 This routine computes a non-rational B-spline curve approximated the old one. More...
 
static bool AreSameWeights (double w0, double w1)
 Compare weights with arbitrary but consistent tolerance. More...
 
static bool AreSameKnots (double knot0, double knot1)
 Compare knots. More...
 
static bool AddRuleSurfaceRayIntersections (bvector< struct SolidLocationDetail > &pickData, MSBsplineCurveCR curveA, MSBsplineCurveCR curveB, DRay3dCR ray)
 Compute intersections of a ray with a ruled surface between two curves. More...
 
static bool RuledSurfaceClosestPoint (SolidLocationDetail &pickData, MSBsplineCurveCR curveA, MSBsplineCurveCR curveB, DPoint3dCR spacePoint)
 Compute the closest point on the ruled surface between two curves. More...
 

Public Attributes

int32_t type
 Type code. Not maintained More...
 
int32_t rational
 True if the curve has weights. More...
 
BsplineDisplay display
 Display control parameters. More...
 
BsplineParam params
 count and order data. Use NumberAllocatedKnots and NumberAllocatedPoles to query. More...
 
DPoint3d * poles
 array of poles, already multiplied by corresponding weights More...
 
double * knots
 Full knot array (all clamping and wrap contents expanded) More...
 
double * weights
 weight array. Same length as poles. More...
 

Detailed Description

MSBsplineCurve is a "Non uniform, rational Bspline curve".

Pole and knot counts

Open curve knots = poles + order
Closed (periodc) curve knots = poles + 2 * order - 1

Parametric position along a bspline curve

There are two conventions for identifying positions within the splines parameter space:

Conventionstart value end value remarks
Fraction position always 0.0 always 1.0 this is the easiest (prefered) way for any app that is not directly manipulating the knot vector.
Knot postion first active knot value last active knot value "active" knots are the "mid section" knots ignoring (order-1) leading and trailing knots

The word Fraction or Knot in a method name indicates how the arguments for that method are interpreted.

Clamping convention

Open knot vectors follow the "clamping convention":

!

Member Enumeration Documentation

enumeration of possible classifications of a knot value wrt to the knot array.

Enumerator
KNOTPOS_BEFORE_START 
KNOTPOS_START 
KNOTPOS_INTERVAL 
KNOTPOS_INTERIOR 
KNOTPOS_FINAL 
KNOTPOS_AFTER_FINAL 

Member Function Documentation

void AddArcIntersectionsXY ( bvector< DPoint3d > *  curvePoints,
bvector< double > *  curveFractions,
bvector< DPoint3d > *  ellipsePoints,
bvector< double > *  ellipseFractions,
DEllipse3dCR  arc,
bool  extendConic,
DMatrix4dCP  matrix 
) const

Compute intersections with ellipse, as viewed in xy plane.

Parameters
[out]curvePointspoints on curve
[out]curveFractionsfractions on curve
[out]ellipsePointspoints on ellipse
[out]ellipseFractionsfractions on ellipse.
[in]arcarc to intersect
[in]extendConictrue to consider the extended ellipse.
[in]matrix(optional) matrix to apply to both the curve and arc to get to as-viewed coordinates for xy calculations.
void AddCurveIntersectionsXY ( bvector< DPoint3d > *  curveAPoints,
bvector< double > *  curveAFractions,
bvector< DPoint3d > *  curveBPoints,
bvector< double > *  curveBFractions,
MSBsplineCurveCR  curveB,
DMatrix4dCP  matrix 
) const

Compute intersections with ellipse, as viewed in xy plane.

Parameters
[out]curveAPointspoints on instances curve
[out]curveAFractionsfractions on instance curve
[out]curveBPointspoints on second curve
[out]curveBFractionsfractions on second curve
[in]curveBsecond bspline curve
[in]matrix(optional) matrix to apply to both the two curves to get to as-viewed coordinates for xy calculations.
void AddCusps ( bvector< DPoint3d > *  points,
bvector< double > *  fractionParameters 
) const

Find full 3d cusps.

Parameters
[out]pointsarray to receive xyz of cusps.
[out]fractionParametersarray to receive fraction parameters of cusps.
void AddCuspsXY ( bvector< DPoint3d > *  points,
bvector< double > *  fractionParameters,
DMatrix4dCP  matrix 
) const

Find full cusps as viewed in xy.

Parameters
[out]pointsarray to receive xyz of cusps.
[out]fractionParametersarray to receive fraction parameters of cusps.
[in]matrixoptional transformation into viewing space.
MSBsplineStatus AddKnot ( double  unnormalizedKnotValue,
int  newMultiplicity 
)

Add a given knot value to the B-spline curve.

that newMultiplicity is the desired final multiplicity of a knot that may already exist.

void AddLineIntersectionsXY ( bvector< DPoint3d > *  curvePoints,
bvector< double > *  curveFractions,
bvector< DPoint3d > *  linePoints,
bvector< double > *  lineFractions,
DSegment3dCR  segment,
bool  extendSegment,
DMatrix4dCP  matrix 
) const

Compute intersections with line segment, as viewed in xy plane.

Parameters
[out]curvePointspoints on curve
[out]curveFractionsfractions on curve
[out]linePointspoints on line
[out]lineFractionsfractions on line.
[in]segmentline segment to intersect
[in]extendSegmenttrue to consider the extended line.
[in]matrix(optional) matrix to apply to both the curve and segment to get to as-viewed coordinates for xy calculations.
void AddLinestringIntersectionsXY ( bvector< DPoint3d > *  curveAPoints,
bvector< double > *  curveAFractions,
bvector< DPoint3d > *  curveBPoints,
bvector< double > *  curveBFractions,
bvector< DPoint3d > const &  linestring,
DMatrix4dCP  matrix 
) const

Compute intersections with a linestring, as viewed in xy plane.

Parameters
[out]curveAPointspoints on curve
[out]curveAFractionsfractions on curve
[out]curveBPointspoints on linestring
[out]curveBFractionsfractions on linestring.
[in]linestringLineString to intersect
[in]matrix(optional) matrix to apply to both the curve and linestring to get to as-viewed coordinates for xy calculations.
void AddLinestringIntersectionsXY ( bvector< DPoint3d > *  curveAPoints,
bvector< double > *  curveAFractions,
bvector< DPoint3d > *  curveBPoints,
bvector< double > *  curveBFractions,
bvector< DPoint3d > const &  linestring,
bool  extendLinestring,
DMatrix4dCP  matrix 
) const

Compute intersections with a linestring, as viewed in xy plane.

Parameters
[out]curveAPointspoints on curve
[out]curveAFractionsfractions on curve
[out]curveBPointspoints on linestring
[out]curveBFractionsfractions on linestring.
[in]linestringLineString to intersect
[in]extendLinestringtrue to extend ends of the linestring.
[in]matrix(optional) matrix to apply to both the curve and linestring to get to as-viewed coordinates for xy calculations.
void AddPlaneIntersections ( bvector< DPoint3d > *  points,
bvector< double > *  fractionParameters,
DPlane3dCR  plane 
) const

Compute intersections with plane.

Parameters
[out]pointsoptional array to receive points.
[out]fractionParametersoptional array to receive fractional params
[in]plane
void AddPlaneIntersections ( bvector< DPoint3d > *  points,
bvector< double > *  fractionParameters,
DPoint4dCR  planeCoffs 
) const

Compute intersections with plane (plane in homogeneous form)

Parameters
[out]pointsoptional array to receive points.
[out]fractionParametersoptional array to receive fractional params
[in]planeCoffshomogeneous plane coefficients
static bool AddRuleSurfaceRayIntersections ( bvector< struct SolidLocationDetail > &  pickData,
MSBsplineCurveCR  curveA,
MSBsplineCurveCR  curveB,
DRay3dCR  ray 
)
static

Compute intersections of a ray with a ruled surface between two curves.

Returns
false if curves are not compatible.
Parameters
[in,out]pickDataaccumulating intersection data.
[in]curveAbase curve of ruled surface.
[in]curveBtop curve of ruled surface.
[in]rayray to intersect
void AddStrokes ( bvector< DPoint3d > &  points,
double  chordTol = 0.0,
double  angleTol = 0.20,
double  maxEdgeLength = 0.0,
bool  includeStartPoint = true 
) const

Compute stroke approximation.

Parameters
[out]pointsarray to receive points.
[in]chordToltarget distance from stokes to curve
[in]angleToltarget angle between strokes
[in]maxEdgeLengthtarget edge length
[in]includeStartPointfalse to skip the start point, e.g. when this spline is chained after another curve.
void AddStrokes ( bvector< DPoint3d > &  points,
bvector< DVec3d > *  derivatives = NULL,
bvector< double > *  params = NULL,
double  chordTol = 0.0,
double  angleTol = 0.20,
double  maxEdgeLength = 0.0,
bool  includeStartPoint = true,
CurveParameterMapping  parameterSelect = CURVE_PARAMETER_MAPPING_CurveKnot 
) const

Compute stroke approximation.

Parameters
[out]pointsarray to receive points.
[out]derivativesoptional array to receive derivative vectors
[out]paramsoptional array to receive parameters
[in]parameterSelectparameter mapping control
[in]chordToltarget distance from stokes to curve
[in]angleToltarget angle between strokes
[in]maxEdgeLengthtarget edge length
[in]includeStartPointfalse to skip the start point, e.g. when this spline is chained after another curve.
void AddStrokes ( IFacetOptionsCR  options,
bvector< DPoint3d > &  points,
bvector< DVec3d > *  derivatives = NULL,
bvector< double > *  params = NULL,
bool  includeStart = true 
) const

Compute stroke approximation.

Parameters
[out]pointsarray to receive points.
[out]derivativesoptional array to receive derivative vectors
[out]paramsoptional array to receive parameters
[in]optionstolerance options.
[in]includeStartfalse to omit start point.
void AddStrokes ( size_t  numPoints,
bvector< DPoint3d > &  points,
bvector< DVec3d > *  derivatives = NULL,
bvector< double > *  params = NULL,
bool  includeStartPoint = true,
CurveParameterMapping  parameterSelect = CURVE_PARAMETER_MAPPING_CurveKnot 
) const

Compute a fixed number of points at regularly spaced fractional parameters.

bool AdvanceToBezier ( BCurveSegment &  segment,
size_t &  bezierSelect,
bool  saturateKnots = true 
) const

Move forward looking for a bezier segment of the curve.

Skip over nulls. return false if no bezier found.

Parameters
segmentreturned bezier
[in,out]bezierSelecton input, first bezier to examine. On output, this is advanced to the "next" bezier to examine.
[in]saturateKnotstrue to saturate knots to proper bezier, false to leave raw support and knots.
bool AdvanceToBezierInFractionInterval ( BCurveSegment &  segment,
size_t &  bezierSelect,
DRange1dCR  interval 
) const

Move forward looking for a bezier segment that overlaps a knot interval.

Skip over nulls and "earlier" knot intervals. return false if no bezier found.

Parameters
segmentreturned saturated bezier, subdivided to match a portion of the knot interval.
[in,out]bezierSelecton input, first bezier to examine. On output, this is advanced to the "next" bezier to examine.
[in]intervallive knot interval.
bool AdvanceToBezierInKnotInterval ( BCurveSegment &  segment,
size_t &  bezierSelect,
DRange1dCR  interval 
) const

Move forward looking for a bezier segment that overlaps a knot interval.

Skip over nulls and "earlier" knot intervals. return false if no bezier found.

Parameters
segmentreturned saturated bezier, subdivided to match a portion of the knot interval.
[in,out]bezierSelecton input, first bezier to examine. On output, this is advanced to the "next" bezier to examine.
[in]intervallive knot interval.
MSBsplineStatus Allocate ( )

Allocate memory arrays to match the current counts.

MSBsplineStatus Allocate ( int  numPoles,
int  order,
bool  closed,
bool  rational 
)

Zero all, copy counts to params, allocate:

MSBsplineStatus AllocateKnots ( int  count,
double const *  data = NULL 
)

Allocate knot pointer to specified count. (Optionally)copy data from callers buffer

MSBsplineStatus AllocatePoles ( int  count,
DPoint3dCP  data = NULL 
)

Allocate pole pointer to specified count. (Optionally)copy data from callers buffer

MSBsplineStatus AllocateWeights ( int  count,
double const *  data = NULL 
)

Allocate weight pointer to specified count. (Optionally)copy data from callers buffer

void AllParallellTangentsXY ( bvector< DPoint3d > &  points,
bvector< double > &  fractions,
DVec3d  vector 
) const

Find all curve points X where the tangents is parallel to the given vector.

Parameters
[out]pointsarray to receive points.
[out]fractionsarray to receive fraction parameters.
[in]vectorgiven direction.
void AllTangents ( bvector< DPoint3d > &  points,
bvector< double > &  fractions,
DPoint3dCR  spacePoint 
) const

For space point Q, find all curve points X where line XQ is tangent to the curve.

Parameters
[out]pointsarray to receive points.
[out]fractionsarray to receive fraction parameters.
[in]spacePointspace point.
void AllTangentsXY ( bvector< DPoint3d > &  points,
bvector< double > &  fractions,
DPoint3dCR  spacePoint,
DMatrix4dCP  matrix 
) const

For space point Q (spacePoint), find all curve points X where line XQ is tangent to the curve.

Parameters
[out]pointsarray to receive points.
[out]fractionsarray to receive fraction parameters.
[in]spacePointspace point.
[in]matrixoptional transformation into viewing space.
bool AlmostEqual ( MSBsplineCurveCR  other) const

Compare curves.

bool AlmostEqual ( MSBsplineCurveCR  other,
double  tolerance 
) const

Compare curves.

MSBsplineStatus AppendCurve ( MSBsplineCurveCR  inCurve)

Change the B-spline curve by appending a given curve.

MSBsplineStatus AppendCurves ( MSBsplineCurveCR  inCurve1,
MSBsplineCurveCR  inCurve2,
bool  forceContinuity,
bool  reparam 
)

Create the B-spline curve by appending two input curves with continuity and reparameterization constraints.

MSBsplineStatus ApproximateAnyCurve ( MSBsplineCurveCP  pIn,
double  tolerance,
int  order,
int  parametrization,
bool  bMaintainEndTangents 
)

This routine computes a B-spline curve approximated the old one.

return ERROR if no results.

Parameters
[in]pInInput G1 curve.
[in]toleranceGeometric tolerance, this should be in general the chord height tol.
[in]orderDesired degree of the pOut, 4 is recommended.
[in]parametrizationCHORDLENGTH = 2, CENTRIPETAL = 3.
[in]bMaintainEndTangentstrue to maintain the end tangents.
static MSBsplineStatus ApproximateG1Curve ( MSBsplineCurveP  pOut,
MSBsplineCurveCP  pIn,
int  degree,
bool  keepTangent,
int  parametrization,
double  geomTol,
double  paramTol,
double  pointTol 
)
static

This routine computes a non-rational B-spline curve approximated the old one.

return ERROR if no results.

Parameters
[out]pOutNon-rational curve created (may be the same as pIn).
[in]pInInput G1 curve.
[in]degreeDesired degree of the pOut, 3 is recommended.
[in]keepTangenttrue to maintain the end tangents.
[in]parametrizationCHORDLENGTH = 2, CENTRIPETAL = 3.
[in]geomTolGeometric tolerance, this should be in general the chord height tol.
[in]paramTolParametric tolerance, recommand set to 10.0*geomTol.
[in]pointTolPoint equal tolerance, recommand set to 0.01*geomTol.
static MSBsplineStatus ApproximateNurbsCurve ( MSBsplineCurveP  pOut,
MSBsplineCurveCP  pIn,
int  degree,
bool  keepTangent,
int  parametrization,
double  tol 
)
static

This routine computes a non-rational B-spline curve approximated the old one.

return ERROR if no results.

Parameters
[out]pOutNon-rational curve created (may be the same as pIn).
[in]pInInput G1 curve.
[in]degreeDesired degree of the pOut, 3 is recommended.
[in]keepTangenttrue to maintain the end tangents.
[in]parametrizationCHORDLENGTH = 2, CENTRIPETAL = 3.
[in]tolGeometric tolerance, this should be in general the chord height tol.
static bool AreCompatible ( MSBsplineCurveCR  curveA,
MSBsplineCurveCR  curveB 
)
static

Test if two curves have compatible knots, order, and pole count

bool AreKnotsValid ( bool  clampingRequired = true) const

Return false if knot counts or values are invalid.

static bool AreSameKnots ( double  knot0,
double  knot1 
)
static

Compare knots.

Absolute tolerance 1e-8 for knots in -1..1. Relative tolerance 1e-8 outside.

static bool AreSameWeights ( double  w0,
double  w1 
)
static

Compare weights with arbitrary but consistent tolerance.

MSBsplineStatus CleanKnots ( )

Clean all unnecessary knots.

void ClosestPoint ( DPoint3dR  curvePoint,
double &  fraction,
DPoint3dCR  spacePoint 
) const

find closest point and its fractional parameter on spline

void ClosestPointXY ( DPoint3dR  curvePoint,
double &  fraction,
double &  xyDistance,
DPoint3dCR  spacePoint,
DMatrix4dCP  viewMatrix 
) const

find closest point after (optional) viewing matrix.

bool ClosestTangent ( DPoint3dR  curvePoint,
double &  curveFraction,
DPoint3dCR  spacePoint,
DPoint3dCR  biasPoint 
) const

For space point Q (spacePoint), find a curve point X where line XQ is tangent to the curve.

Point X is close to biasPoint.

Parameters
[out]curvePointtangential point.
[out]curveFractionfraction parameter of tangential point.
[in]spacePointspace point.
[in]biasPointbias point.
bool ClosestTangentXY ( DPoint3dR  curvePoint,
double &  curveFraction,
DPoint3dCR  spacePoint,
DPoint3dCR  biasPoint,
DMatrix4dCP  matrix 
) const

For space point Q (spacePoint), find a curve point X where line XQ is tangent to the curve.

Point X is close to biasPoint.

Parameters
[out]curvePointtangential point.
[out]curveFractionfraction parameter of tangential point.
[in]spacePointspace point.
[in]biasPointbias point.
[in]matrixoptional transformation into viewing space.
static void CompressKnots ( bvector< double > const &  inKnot,
int  order,
bvector< double > &  outKnot,
bvector< size_t > &  multiplicities,
size_t &  lowActiveIndex,
size_t &  highActiveIndex 
)
static

compress knot values and mark active range.

Parameters
[in]inKnotinput knot values.
[in]ordercurve order, used for analyzing active interval.
[out]outKnotcompressed knot values
[out]multiplicitiesnumber of occurrences
[out]lowActiveIndexindex (in outKnots) of left end of active range.
[out]highActiveIndexindex (in outKnots) of right end of active range.
Remarks
A "Clamped and open" knot vector will have trivial indices 0 and {outKnots.size ()-1}. Periodic or unclamped will have other indices.
This uses the MSBsplineCurve::AreSameKnots for tolerancing.
This metohd does not try to "correct" issues like excess multiplicity and clamping. It just counts the multiplicity according to AreSameKnots.
The input and output knot vectors must be distinct arrays !!!
MSBsplineStatus ComputeDerivatives ( DVec3dP  dervs,
int  numDervs,
double  fractionParameter 
) const

Calculate the number of derivatives specified by numDervs of the B-spline curve at a particular fraction.

void ComputeGrevilleAbscissa ( bvector< double > &  averageKnots) const
MSBsplineStatus ComputeInflectionPoints ( DPoint3dP &  points,
double *&  params,
int &  numPoints 
)

Calculate the parameters and location of the all inflection points of a B-spline curve.

MSBsplineStatus ComputeInflectionPoints ( bvector< DPoint3d > &  points,
bvector< double > &  params 
)

Calculate the parameters and location of the all inflection points of a B-spline curve.

MSBsplineStatus ComputeInflectionPointsXY ( bvector< DPoint3d > &  points,
bvector< double > &  params,
RotMatrixCP  transform 
)

Calculate the parameters and location of the all inflection points of a B-spline curve.

static void ComputeUniformKnotGrevilleAbscissa ( bvector< double > &  averageKnots,
size_t  numInterval,
int  order 
)
static
bool ComputeUniformKnots ( )

Compute uniformly spaced knots.

This uses counts from params.

Returns
false if param counts are not set.
MSBsplineStatus CopyClosed ( MSBsplineCurveCR  source)

Create B-spline curve by closing a open B-spline curve.

MSBsplineStatus CopyFractionSegment ( MSBsplineCurveCR  source,
double  fractionA,
double  fractionB 
)

Create B-spline curve by extracting a part of a B-spline curve.

MSBsplineStatus CopyFrom ( MSBsplineCurveCR  source)

Allocate memory for the B-spline curve and copies all data from the input B-spline curve.

MSBsplineStatus CopyOpen ( MSBsplineCurveCR  source,
double  unnormalizedKnot 
)

Create B-spline curve by opening a closed B-spline curve.

MSBsplineStatus CopyReversed ( MSBsplineCurveCR  source)

Create B-spline curve by reserving the direction of a B-spline curve.

MSBsplineStatus CopySegment ( MSBsplineCurveCR  source,
double  unnormalizedKnotA,
double  unnormalizedKnotB 
)

Create B-spline curve by extracting a part of a B-spline curve.

MSBsplineStatus CopyTransformed ( MSBsplineCurveCR  source,
TransformCR  trans 
)

Create B-spline curve by transforming a B-spline curve.

size_t CountDistinctBeziers ( ) const

Count the number of beziers that have non-null knot intervals.

MSBsplineCurvePtr CreateCapture ( )

Copy bits into smart pointer. Caller instance zeroed out.

MSBsplineCurvePtr CreateCopy ( ) const

Return copy as smart pointer target.

MSBsplineCurvePtr CreateCopyBetweenFractions ( double  fraction0,
double  fraction1 
) const

Copy the portion between specified fractions.

MSBsplineCurvePtr CreateCopyBetweenKnots ( double  knot0,
double  knot1 
) const

Copy the portion between specified knots.

MSBsplineCurvePtr CreateCopyBezier ( ) const

Copy with all knots saturated.

MSBsplineCurvePtr CreateCopyClosed ( ) const

Return copy as smart pointer target; if physically closed revise poles to be a closed bspline

MSBsplineCurvePtr CreateCopyOffsetXY ( double  offset0,
double  offset1,
CurveOffsetOptionsCR  options 
) const

Copy with offset in XY plane.

MSBsplineCurvePtr CreateCopyOpenAtFraction ( double  fraction) const

Return copy as smart pointer target; if closed, open it at fraction.

MSBsplineCurvePtr CreateCopyOpenAtKnot ( double  knot) const

Return copy as smart pointer target; if closed, open it at knot.

MSBsplineCurvePtr CreateCopyReversed ( ) const

Complete copy with reversed parameterization.

MSBsplineCurvePtr CreateCopyTransformed ( TransformCR  transform) const

Copy with transform applied to poles.

static MSBsplineCurvePtr CreateFromInterpolationAtBasisFunctionPeaks ( bvector< DPoint3d >const &  xyz,
size_t  order,
int  selector = 0 
)
static

Create a spline curve with Lim's fit conditions or related.

ul> li>Pole count matches point count. li>selector = 0 is Lim's condition: interpolation points are matched at knot values for basis function peaks. li>selector = 1: intepolation points are matched at Greville moving average knot values. /ul>

Parameters
[in]xyzxyz interpolation points
[in]orderorder bspline order.
[in]selectorselector – see description.
static MSBsplineCurvePtr CreateFromInterpolationAtGrevilleKnots ( ICurvePrimitiveCR  curve,
size_t  numPoles,
int  order,
bool  normalizeKnots,
int  knotSelector = 0 
)
static

Create a spline curve that approximates a CurvePrimitive.

ul> li>Knots are constructed with uniform or Chebyshev points accordinat to knotSelector. li>The Greville average knots are then computed. li>The curve primitive is evaluated at the Greville knots. li>For example, if the uniform knots for a cubic are [0 0 0 0 1 2 3 4 5 6 7 8 9 10 10 10 10] the Greville averages are [0 1/3 1 2 3 4 5 6 7 8 9 9+2/3 10] li>the curve fit interpolates at all those points. li>If the CurvePrimitives exact parameterization is by true distances, this provides a strong match between bspline knots and true distance. li>This makes this a strong interpolation for catenary and spiral curves. li>The only CurvePrimitive method called is FractionToPoint. /ul>

static MSBsplineCurvePtr CreateFromInterpolationPointsWithKnots ( bvector< DPoint3d >const &  xyz,
bvector< double > const &  interpolationKnots,
bvector< double >  curveKnots,
int  order 
)
static

Create a spline with given.

ul> li>Returns nullptr if count conditions are not met. li>Must have (xyz.size () == interpolationKnots.size ()) must have same size. li>Must have (xyz.size () + order = curveKnots.size ()) li>Curve knots are the usual "full" knot vector (e.g. replication for clamping) /ul>

Parameters
[in]xyzxyz interpolation points
[in]interpolationKnotsknot values where interpolation occurs
[in]curveKnotsknots for the curve
ordercurve order
MSBsplineStatus CreateFromPointsAndOrder ( DPoint3dCP  pPoints,
int  numPoints,
int  order,
bool  closed = false 
)

Create the B-spline curve from point array and order.

static MSBsplineCurvePtr CreateFromPolesAndOrder ( bvector< DPoint3d > const &  poles,
bvector< double > const *  weights,
bvector< double > const *  knots,
int  order,
bool  closed,
bool  inputPolesAlreadyWeighted 
)
static

Allocate smart pointer target with directly supplied poles, weights, and knots.

static MSBsplineCurvePtr CreateFromPolesAndOrder ( DPoint3dCP  poles,
int  numPoles,
int  order,
bool  closed = false 
)
static

Allocate smart pointer target with directly supplied poles, weights, and knots.

static MSBsplineCurvePtr CreateFromPolesAndOrder ( DPoint2dCP  poles,
int  numPoles,
int  order,
bool  closed = false 
)
static

Allocate smart pointer target with directly supplied poles, weights, and knots.

static MSBsplineCurvePtr CreateInterpolationBetweenCurves ( MSBsplineCurveCR  curveA,
double  fraction,
MSBsplineCurveCR  curveB 
)
static

Create a curve whose poles are interpolated between the poles of two curves.

This will only succeed if the curves have the same pole, knot, and order structure

static MSBsplineCurvePtr CreatePtr ( )
static

Returns a smart pointer to an MSBsplineCurve on the heap.

MSBsplineStatus ElevateDegree ( int  newDegree)

Elevate the degree (increases the order) of the B-spline curve.

MSBsplineStatus ExtractCurveNormal ( DVec3dR  normal,
DPoint3dR  position,
double &  planarDeviation 
) const

Calculate the normal and center of a plane containing the B-spline curve.

void ExtractEndPoints ( DPoint3dR  start,
DPoint3dR  end 
) const

Extract the start or end point of the B-spline curve.

MSBsplineStatus ExtractSegmentBetweenKnots ( MSBsplineCurveR  target,
double  unnormalizedKnotA,
double  unnormalizedKnotB 
)

Exteact the curve from the B-spline curve at the interval [unnormalizedKnotA, unnormalizedKnotB].

void ExtractTo ( MSBsplineCurveR  dest)

Copy bits into simple structure. Caller instance zeroed.

size_t FindKnotInterval ( double  knotValue) const

Return the index of the knot at the left of the interval containing specified knot.

When knotValue exactly matches a knot, the returned index is of the knot to the left - i.e. knotValue appears at the RIGHT of the returned interval. (favor knot[index] < knotValue <= knot[index + 1])

bool FractionAtSignedDistance ( double  startParam,
double  signedDistance,
double &  endParam,
double &  actualSignedDistance 
) const

Move by (up to !!) signedDistance along the curve.

Stop at endpoint if encountered before the distance. return true if full movement.

Parameters
[in]startParamstarting position (in 0..1 parameter space)
[in]signedDistancerequested distance (sign indictes direction relative to parameter space)
[out]endParamparameter where movement stopped.
[out]actualSignedDistancedistance to actual stopping place.
bool FractionAtSignedDistance ( RotMatrixCP  worldToLocal,
double  startParam,
double  signedDistance,
double &  endParam,
double &  actualSignedDistance 
) const

Move by (up to !!) signedDistance along the curve.

Stop at endpoint if encountered before the distance. return true if full movement.

Parameters
[in]worldToLocaltransformation for tangent vectors.
[in]startParamstarting position (in 0..1 parameter space)
[in]signedDistancerequested distance (sign indictes direction relative to parameter space)
[out]endParamparameter where movement stopped.
[out]actualSignedDistancedistance to actual stopping place.
double FractionToKnot ( double  f) const

Return the knot value at a fractional parameter ...

void FractionToPoint ( DPoint3dR  xyz,
double  f 
) const

Fraction parameter to point on the B-spline curve.

void FractionToPoint ( DPoint3dR  xyz,
DVec3dR  tangent,
double  f 
) const

Fraction parameter to both point and derivative. Derivative is wrt the fraction parameter.

void FractionToPoint ( DPoint3dR  xyz,
double &  weight,
DVec3dR  tangent,
double  f 
) const

Fraction parameter to both point and derivative.

Derivative is wrt the fraction parameter. the point and derivative are UNWEIGHTED.

void FractionToPoint ( DPoint3dR  xyz,
DVec3dR  dXYZ,
DVec3dR  ddXYZ,
double  f 
) const

Fraction parameter to point and 2 derivatives. Derivatives are wrt the fraction parameter.

void FractionToPoints ( bvector< DPoint3d > &  points,
size_t  numPoints 
)

Evaluate a series of points at numPoints parameters. These parameters are spaced evenly throughout the parameter range.

void FractionToPoints ( bvector< DPoint3d > &  points,
bvector< double > &  fractions 
)

Evaluate a series of points at given parametrs.

static MSBsplineStatus GeneralLeastSquaresApproximation ( MSBsplineCurveP  pOut,
bvector< DPoint3d > const &  Q,
bvector< double > const &  u,
bvector< double > const &  knots,
int  numPoles,
int  order 
)
static

This routine computes a least square B-spline curve to the sample points.

return ERROR if no results.

Parameters
[out]pOutResulted curve.
[in]QData points.
[in]uParameters corresponding to data points.
[in]knotsKnot vector of approximating curve.
[in]numPolesThe number of resulted curve.
[in]orderThe order of resulted curve.
bool GetBezier ( BCurveSegment &  segment,
size_t  bezierSelect 
) const

Get poles for a single bezier poles from the curve.

return false if invalid bezierSelect. Note that the bezierSelect for a high multiplicity knot returns true for the function but marks the interval as null. Normal usage is to loop over all beziers in a bspline but skip processing the null intervals.

Parameters
[out]segmenta filled BCurveSegment.
[in]bezierSelectselects a bezier interval within the bspline
void GetC1DiscontinuousCurves ( bvector< double > &  fractions,
bvector< MSBsplineCurvePtr > &  curves 
) const

Create copies of each segment with breaks at point or tangent changes.

void GetC1DiscontinuousFractions ( bvector< double > &  fractions) const

Get all C1 fractional Discontinuities.

This inspects xyz and tangent at each knot break. (It does not look for intraknot cusps)

bool GetCurveDisplay ( ) const

Return curve display flag.

void GetDisjointCurves ( bvector< MSBsplineCurvePtr > &  curves) const

Create copies of each segment with breaks at disjoint knot points.

MSBsplineStatus GetFrenetFrame ( DVec3dP  frame,
DPoint3dR  point,
double &  curvature,
double &  torsion,
double  u 
) const

Calculate the Frenet frame, radius of curvature, and torsion of the B-spline curve at a particular fractional parameter value.

MSBsplineStatus GetFrenetFrame ( TransformR  frame,
double  u 
) const

Calculate the Frenet frame, radius of curvature, and torsion of the B-spline curve at a particular fractional parameter value.

int GetIntNumKnots ( ) const
int GetIntNumPoles ( ) const
int GetIntOrder ( ) const

return the curve order.

double GetKnot ( size_t  index) const

return knot by index. returns 0 if out of range. (Use NumberAllocatedKnots to determine index range).

double const* GetKnotCP ( ) const

return pointer to contiguous knots.

double* GetKnotP ( ) const

return pointer to contiguous knots.

void GetKnotRange ( double &  knotA,
double &  knotB 
) const

Return the knot values corresponding to fraction 0 and fraction 1 ...

DSegment1d GetKnotRange ( ) const

Return the knot range as DSegment1d..

void GetKnotRange ( double &  knotA,
double &  knotB,
int &  indexA,
int &  indexB,
double &  knotTolerance 
) const

Return the knot values and indices corresponding to fraction 0 and fraction 1, and also the equal-knot tolerance ...

void GetKnots ( bvector< double > &  outData) const

Copy all knots out into caller array.

size_t GetNumKnots ( ) const
size_t GetNumPoles ( ) const
size_t GetOrder ( ) const
DPoint3d GetPole ( size_t  index) const

return pole by index.

returns 0 point if out of range. (Use NumberAllocatedPoles to determine index range).

DPoint3d GetPole ( int  index) const
DPoint3d const* GetPoleCP ( ) const

return pointer to contiguous poles.

DPoint4d GetPoleDPoint4d ( size_t  index) const

return pole by index.

returns 0 point if out of range. (Use NumberAllocatedPoles to determine index range).

DPoint3d* GetPoleP ( ) const

return pointer to contiguous poles.

void GetPoleRange ( DRange3dR  range) const

Get the range of the poles of the B-spline curve.

void GetPoles ( bvector< DPoint3d > &  outData) const

Copy all poles out into caller array.

void GetPoles4d ( bvector< DPoint4d > &  outData) const

Copy all poles out into caller array.

bool GetPolygonDisplay ( ) const

Return polygon display flag.

DRange3d GetRange ( ) const

Get the range of the B-spline curve.

DRange1d GetRangeOfProjectionOnRay ( DRay3dCR  ray,
double  fraction0 = 0.0,
double  fraction1 = 1.0 
) const

Get the range of parameters of the projection of (a fractional portion of the curve onto a ray return range whose low and high values are the extreme parameters (in ray fractions) of the projection of the curve onto the ray.

Parameters
[in]rayray to project to
[in]fraction0start of active part of the curve
[in]fraction1end of active part of the curve
static double GetRemovalKnotBound ( MSBsplineCurveCP  pCurve,
int  r,
int  s 
)
static

Compute the bound of remove r-th knot s times.

DPoint3d GetReversePole ( size_t  index) const

return pole by index, counting from the last pole .

(i.e. index 0 is the final weight) Returns 0 point if out of range. (Use NumberAllocatedPoles to determine index range).

DPoint3d GetReversePole ( int  index) const
double GetReverseWeight ( size_t  index) const

return weight by index, counting from the last weight.

(i.e. index 0 is the final weight) Returns 1.0 if out of range. (Use NumberAllocatedPoles to determine index range).

double GetReverseWeight ( int  index) const
size_t GetStrokeCount ( double  chordTol = 0.0,
double  angleTol = 0.20,
double  maxEdgeLength = 0.0 
) const

Compute stroke count.

bool GetSupport ( bvector< DPoint4d > &  outPoles,
bvector< double > &  outKnots,
size_t  bezierSelect 
) const

Extract the {order} poles and {2*(order-1)} knots that support a single bezier interval ...

Parameters
[out]outPolespoles
[out]outKnotsknots
[in]bezierSelectindex of bezier to extract.
bool GetSupport ( BCurveSegmentR  segment,
size_t  bezierSelect 
) const

Extract the {order} poles and {2*(order-1)} knots that support a single bezier interval ...

Parameters
[out]segmentextracted data.
[in]bezierSelectindex of bezier to extract.
size_t GetTailBezierSelect ( ) const

return an index to use to start "Retreat" order bezier access.

DPoint3d GetUnWeightedPole ( size_t  index,
bool  reverse = false 
) const

return pole by index.

returns 0 point if out of range. If spline is weighted, the weight is divided out. If weight zero, no division happens. (Use NumberAllocatedPoles to determine index range).

DPoint3d GetUnWeightedPole ( int  index,
bool  reverse = false 
) const
void GetUnWeightedPoles ( bvector< DPoint3d > &  outData) const

Copy all poles out into caller array, dividing each by its weight.

double GetWeight ( size_t  index) const

return weight by index. returns 1 if index out of range or curve is unweighted. (Use NumberAllocatedPoles to determine index range).

double GetWeight ( int  index) const
double const* GetWeightCP ( ) const

return pointer to contiguous weights

double* GetWeightP ( ) const

return pointer to contiguous weights

DRange1d GetWeightRange ( ) const
void GetWeights ( bvector< double > &  outData) const

Copy all weights out into caller array.

bool HasValidCountsAndAllocations ( ) const
bool HasValidKnotAllocation ( ) const
bool HasValidOrder ( ) const
bool HasValidPoleAllocation ( ) const
bool HasValidPoleCounts ( ) const
bool HasValidWeightAllocation ( ) const
bool HasWeights ( ) const

Check whether the B-spline curve has stored weights (This does not check if any are other than 1.0)

MSBsplineStatus InitAkima ( DPoint3dCP  points,
size_t  nPoints 
)

Create bspline equivalent of Akima curve.

MSBsplineStatus InitAkima ( bvector< DPoint3d > const &  points)

Create bspline equivalent of Akima curve.

MSBsplineStatus InitEllipticArc ( DPoint3d &  center,
double  rX,
double  rY,
double  startRadians = 0.0,
double  sweepRadians = msGeomConst_2pi,
RotMatrixP  axes = NULL 
)

Create the B-spline curve from the parameters of an elliptic arc.

MSBsplineStatus InitFromBeziers ( bvector< MSBsplineCurve > const &  beziers)

Create a B-spline curve from a series of Bézier curve.

MSBsplineStatus InitFromDConic4d ( DConic4dCR  conic)

Initialize the B-spline curve for a conic.

MSBsplineStatus InitFromDEllipse3d ( DEllipse3dCR  ellipse)

Initialize the B-spline curve for an ellipse.

MSBsplineStatus InitFromDPoint4dArray ( DPoint4dCP  pPoleArray,
int  numPoles,
int  order 
)

Create a B-spline curve from an array of DPoint4d ponts.

MSBsplineStatus InitFromGeneralLeastSquares ( double *  avgDistance,
double *  maxDistance,
BsplineParam  info,
bvector< double > *  knts,
DPoint3d *  pnts,
double *  uValues,
int  numPnts 
)

This routine computes a B-spline curve with given numPoles and order approximated the give points set.

return ERROR if no results.

Parameters
[out]avgDistanceaverage error, or NULL.
[out]maxDistancemaximum error, or NULL.
[in]infothe params of resulted curve.
[in]kntsthe knot vector of curve (optional).
[in]pntsdata to be approximated.
[in]uValuesthe parameterization of data (optional).
[in]numPntsNumber of points.
MSBsplineStatus InitFromInterpolatePoints ( DPoint3dCP  points,
int  numPoints,
int  parametrization,
bool  endControl,
DVec3dCP  sTangent,
DVec3dCP  eTangent,
bool  keepTanMag,
int  order 
)

This routine computes a B-spline curve interpolated the give points set.

return ERROR if no results.

Parameters
[in]pointsdata to be Interpolated.
[in]numPointsNumber of points.
[in]parametrizationCHORDLENGTH = 2, CENTRIPETAL = 3.
[in]endControltrue: pass both ends, false: do not require both end points.
[in]sTangentStart tangent (optional).
[in]eTangentEnd tangent (optional).
[in]keepTanMagKeep end tangent's magnitude
[in]orderThe order of resulted curve.
MSBsplineStatus InitFromLeastSquaresFit ( DPoint3dCP  points,
int  numPoints,
bool  endControl,
DVec3dCP  sTangent,
DVec3dCP  eTangent,
bool  keepTanMag,
int  iterDegree,
int  reqDegree,
bool  singleKnot,
double  tolerance 
)

This routine computes a B-spline curve approximated the give points set.

return ERROR if no results.

Parameters
[in]pointsdata to be approximated.
[in]numPointsNumber of points.
[in]endControltrue: pass both ends, false: do not require both end points.
[in]sTangentStart tangent (optional).
[in]eTangentEnd tangent (optional).
[in]keepTanMagKeep end tangent's magnitude
[in]iterDegreeStart iteration degree
[in]reqDegreeRequired degree of output curve
[in]singleKnotUse single interior knots
[in]toleranceFitting tolerance
MSBsplineStatus InitFromPoints ( DPoint3dCP  points,
int  nPoints 
)

Create the B-spline curve from point array and order.

bool IsClosed ( ) const

Check whether the B-spline curve is periodic.

bool IsParabola ( TransformR  localToWorld,
TransformR  worldToLocal,
double &  vertexFraction,
DPoint3dR  localStart,
DPoint3dR  localEnd,
double &  xSquaredCoefficient 
) const

Check if the B-spline curve is a single quadratic that is a parabola.

The conditions for a parabola are (a) order 3, (b) only 3 poles, (c) weights all 1.

This does NOT detect the "weighted" parabola – a varying-weight order 3 but with weights that are never zero

If so return transforms to and from the coordinate system with the vertex at the origin and parabola equation y = c*x^2

Parameters
localToWorldCoordinate frame with origin at the vertex, x axis tangent to the parabola, parabola opens upward along the y axis.
worldToLocalInverse of the localToWorld transform
vertexFractionThe bspline fraction parameter of the vertex (origin) of the parabola
localStartlocal start point of the curve
localEndlocal end point of the curve
xSquaredCoefficientcoefficient for y=c*x^2
bool IsPhysicallyClosed ( double  tolerance) const

Check whether the B-spline curve is physically closed.

A B-spline curve may be non-periodic, but still return true if its first and last poles coincide.

bool IsSameGeometry ( MSBsplineCurveCR  other) const

Check if the B-spline curves has same parameters with the given curve.

static MSBsplineStatus KnotRefinement ( bvector< double > const &  X,
MSBsplineCurveP  pCurve 
)
static

Insert a set of knot to given B-spline curve.

return ERROR if insertion fails.

Parameters
[out]pCurveThe curve after knots insertion.
[in]pCurveThe curve before knots insertion.
[in]XA vector of knots to be insert into pCurve.
void KnotToBlendFunctions ( double *  blend,
double *  blendDerivative,
size_t &  knotIndex,
double  u 
) const

Compute blending functions at KNOT value (unnormalized) knotIndex is the index of the knot to the right of u.

(i.e. the leftmost knot of the upper limits of active windows)

double KnotToFraction ( double  knot) const

Return the fractional parameter corresponding to a knot value ...

double Length ( ) const

compute the length of the B-spline curve.

double Length ( RotMatrixCP  worldToLocal) const

compute the length of the transformed bspline curve

double LengthBetweenFractions ( double  startFraction,
double  endFraction 
) const

compute the length of the B-spline curve at a given fraction interval [startFraction, endFraction].

double LengthBetweenFractions ( RotMatrixCP  worldTolocal,
double  startFraction,
double  endFraction 
) const

compute the length of the B-spline curve at a given fraction interval [startFraction, endFraction].

double LengthBetweenKnots ( double  startKnot,
double  endKnot 
) const

compute the length of the B-spline curve at a given knot interval [startKnot, endKnot].

double LengthBetweenKnots ( RotMatrixCP  worldTolocal,
double  startKnot,
double  endKnot 
) const

compute the length of the B-spline curve at a given knot interval [startKnot, endKnot].

MSBsplineStatus MakeBezier ( MSBsplineCurveR  bezierCurve)

Create equivalent Bézier curve for the B-spline curve.

MSBsplineStatus MakeBeziers ( bvector< MSBsplineCurve > &  beziers) const

Create a series of Bézier curve for the B-spline curve.

MSBsplineStatus MakeClosed ( )

Close the open B-spline curve.

MSBsplineStatus MakeOpen ( double  u)

Open the closed B-spline curve.

MSBsplineStatus MakeRational ( )

Make an equivalent rational B-spline curve.

MSBsplineStatus MakeReversed ( )

Reverse the direction of the B-spline curve.

static void MapFractions ( bvector< double > *  params,
bvector< DVec3d > *  derivatives,
size_t  i0,
double  knot0,
double  knot1,
CurveParameterMapping  select,
MSBsplineCurveCP  curve 
)
static
Parameters
[in,out]paramson inputs, fractions from a bezier known to map from [knot0,knot1].
[in,out]derivativesderivatives to be scaled
[in]i0first index to map
[in]knot0left knot of fraction space.
[in]knot1right knot of fraction space.
[in]selectselects mapping destination. One of CURVE_PARAMETER_MAPPING_BezierFraction, CURVE_PARAMETER_MAPPING_CurveKnot, CURVE_PARAMETER_MAPPING_CurveFraction.
[in]curverequired if if mapping to curve fraction.
bool MapKnots ( double  a,
double  b 
)

rewrite knot values in a..b. Return true if a,b and current start,end define a valid scale factor

void NormalizeKnots ( )

Normalize knots to 01.

bool PointsAtUniformArcLength ( bvector< DPoint3d > &  points,
bvector< double > &  fractions,
size_t  numPoints 
) const

Compute points at uniform arclength steps.

Parameters
[out]pointsarray to receive points.
[out]fractionsarray to receive fractions.
[in]numPointsnumber of points.
void PointsAtUniformFractions ( bvector< DPoint3d > &  points,
bvector< double > &  fractions,
size_t  numPoints 
) const

Compute strokes at uniform fraction step.

Parameters
[out]pointsarray to receive points.
[out]fractionsarray to receive fractions.
[in]numPointsnumber of points.
double PolygonLength ( ) const

Compute the length of the control polygon of the B-spline curve.

MSBsplineStatus Populate ( bvector< DPoint3d > const &  pointVector,
bvector< double > const *  weightVector,
bvector< double > const *  knotVector,
int  order,
bool  closed,
bool  inputPolesAlreadyWeighted 
)

Populate the B-spline curve with the given parameters.

MSBsplineStatus Populate ( DPoint3dCP  pPoints,
double const *  pWeights,
int  numPoints,
double const *  pKnots,
int  numKnots,
int  order,
bool  closed,
bool  inputPolesAlreadyWeighted 
)

Populate the B-spline curve with the given parameters.

void ProjectToZFocalPlane ( double  focalLength)

convert to a weighted curve whose normalized points fall on a focal plane

void ReleaseMem ( )

Free memory allocated for the poles, weights and knot vector of a B-spline curve.

MSBsplineStatus RemoveKnotsBounded ( double  tol,
int  startPreservation,
int  endPreservation 
)

Remove all removable knots with the tolerance and end condition constraints.

double Resolution ( ) const

Get a (fairly tight) tolerance for the B-spline curve.

double Resolution ( double  abstol,
double  reltol 
) const

Get a tolerance of the B-spline curve.

bool RetreatToBezierInKnotInterval ( BCurveSegment &  segment,
size_t &  bezierSelect,
DRange1dCR  interval 
) const
Parameters
[in]bezierSelect"retreat" order bezier index. Initialie with GetTailBezierSelect ()
[in]intervalknot interval that must be overlapped.
[out]segmentsaturated bezier for segment.
MSBsplineStatus RotateCurve ( RotMatrixCR  rMatrix)

Rotate the B-spline curve.

static bool RuledSurfaceClosestPoint ( SolidLocationDetail pickData,
MSBsplineCurveCR  curveA,
MSBsplineCurveCR  curveB,
DPoint3dCR  spacePoint 
)
static

Compute the closest point on the ruled surface between two curves.

Returns
false if curves are not compatible.
Parameters
[out]pickDataaccumulating intersection data.
[in]curveAbase curve of ruled surface.
[in]curveBtop curve of ruled surface.
[in]spacePoint
static MSBsplineStatus SampleG1CurveByPoints ( bvector< DPoint3d > &  P,
bvector< double > &  up,
bvector< double > &  uq,
MSBsplineCurveCP  pCurve,
int  par,
double  Eg,
double  ptol 
)
static

This approximation routine computes a set of sample points of a G1 continuous B-spline curve.

return ERROR if no results.

Parameters
[out]PPoints computed on curve.
[out]upParameters of curve corresponding to the points in vector P.
[out]uqIf par = 2 or par = 3 , then uq is the array of parameters corresponding to the points in P. Otherwise, uq is not allocated.
[in]pCurveThe base curve.
[in]parFlag: 2: chordlength parameterization wanted, 3: centripetal parameterization wanted
[in]EgGeometric error tolerance. The perpendicular distance from curve to corresponding point isn't greater than Eg.
[in]ptolPoint coincidence tolerance. Two points are considered to be equal if the distance between them is less than or equal to ptol. ptol < Eg should hold
KnotPosition SearchKnot ( double  unnormalizedKnotValue,
int &  k0,
int &  k1,
double &  correctedKnotValue 
) const

Search for a knot value.

If the value is strictly between knots (KNOTPOS_INTERVAL), return the immediate surrounding knot indices. In all other cases (KNOTPOS_BEFORE_START, KNOTPOS_START, KNOTPOS_INTERIOR, KNOTPOS_FINAl, KNOTPOS_AFTER_FINAL) return first and last indices of identical knots. Hence k1-k0+1 is the multiplicity of the matched knot.

void SetCurveDisplay ( bool  value)

Set the curve display flag.

bool SetKnot ( size_t  index,
double  value 
)

set weight by index.

returns false if index out of range.

bool SetKnots ( size_t  index,
double const *  value,
size_t  n 
)

set weight by index.

returns false if index out of range.

bool SetPole ( size_t  index,
DPoint3dCR  value 
)

set pole by index.

returns false if index out of range.

bool SetPole ( int  index,
DPoint3dCR  value 
)
bool SetPole ( size_t  index,
double  x,
double  y,
double  z 
)

set pole by index.

returns false if index out of range.

bool SetPoles ( size_t  index,
DPoint3dCP  value,
size_t  n 
)

set pole by index.

returns false if index out of range.

void SetPolygonDisplay ( bool  value)

Set the polygon display flag.

bool SetReWeightedPole ( size_t  index,
DPoint3dCR  value,
bool  reverse = false 
)

set pole by index.

returns false if index out of range. If the curve is weighted, the current weight is multiplied into the input pole.

bool SetReWeightedPole ( int  index,
DPoint3dCR  value,
bool  reverse = false 
)
bool SetWeight ( size_t  index,
double  value 
)

set weight by index.

returns false if index out of range.

bool SetWeight ( int  index,
double  value 
)
bool SetWeights ( size_t  index,
double const *  value,
size_t  n 
)

set weight by index.

returns false if index out of range.

void SwapContents ( MSBsplineCurveR  other)

Exchange all bits with other. Usually used to transfer poles etc and leave zeros behind.

MSBsplineStatus TransformCurve ( TransformCR  transform)

Transform the B-spline curve.

MSBsplineStatus TransformCurve4d ( DMatrix4dCR  transform4d)

Transform the B-spline curve using a 4d transformation.

void TransformPoles ( TransformCR  transform,
size_t  index,
size_t  n 
)

Apply a transform to a single pole.

void UnWeightPoles ( )

if the curve is rational, divide (wx,wy,wz) style poles by the weights

static MSBsplineStatus WeightedLeastSquaresFit ( MSBsplineCurveP  pOut,
bvector< DPoint3d > const  Q,
bvector< double > const  u,
bool  endControl,
DVec3dCP  sTangent,
DVec3dCP  eTangent,
int  numPoles,
int  order 
)
static

This routine computes a least square B-spline curve to the sample points.

return ERROR if no results.

Parameters
[out]pOutResulted curve.
[in]QData points.
[in]uParameters corresponding to data points.
[in]endControltrue: pass both ends, false: do not require both end points.
[in]sTangentStart tangent (optional).
[in]eTangentEnd tangent (optional).
[in]numPolesThe number of resulted curve.
[in]orderThe order of resulted curve.
void WeightPoles ( )

if the curve is rational, multiply (wx,wy,wz) style poles by the weights

void WireCentroid ( double &  length,
DPoint3dR  centroid,
double  fraction0,
double  fraction1 
) const

Return the centroid of the (uniformly distributed) wire mass.

void Zero ( )

!

Zero out the curve. This is customarily applied immediately after allocation on stack or heap. This does NOT free memory from prior contents.

Member Data Documentation

BsplineDisplay display

Display control parameters.

Not used in computations. Beware that if a curve is saved into a file, a zeroed out display structure may lead to non-displayed curve

double* knots

Full knot array (all clamping and wrap contents expanded)

BsplineParam params

count and order data. Use NumberAllocatedKnots and NumberAllocatedPoles to query.

DPoint3d* poles

array of poles, already multiplied by corresponding weights

int32_t rational

True if the curve has weights.

int32_t type

Type code. Not maintained

double* weights

weight array. Same length as poles.


The documentation for this struct was generated from the following file:

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.