DGKC Control Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
What is new
Licensing
Expand ModelsModels
Expand DG Kernel ControlDG Kernel Control
Collapse API ReferenceAPI Reference
Interface List
Vector Space
Collapse General GeometryGeneral Geometry
Expand ModelModel
Expand ViewView
Expand General ComputingGeneral Computing
Expand ViewsViews
Expand Samples and TutorialsSamples and Tutorials
Expand GraphicsGraphics
Expand Math ObjectsMath Objects
Expand DeprecatedDeprecated
Redistribution
Model Viewer
Support
Skip Navigation LinksHome Page > API Reference > General Geometry > Curves > 2D > IBSplineCurve2d_DG Go to ActiveX docs Search Documentation


IBSplineCurve2d_DG Interface

Properties

int Degree

Methods

Init
Init
InitFromPoints
InitFromPoints
InitFromPoints
Interpolate
Interpolate
Interpolate
Interpolate
GetKnotCount
GetKnot
GetKnots
SetKnot
SetKnot
SetKnots
GetMultiplicity
GetMultiplicities
SetMultiplicity
SetMultiplicity
GetPoleCount
GetPole
GetPoles
SetPole
SetPole
GetWeight
SetWeight
GetWeights
IsClosed
IsPeriodic
SetPeriodic
IsRational
GetPoint
GetJet1
GetJet2
GetJetN
GetContinuity
GetEndParameter
GetEndPoint
InsertKnot
InsertKnots
RemoveKnot
Reverse
SetRange
NormalizePeriodic
SetOrigin
ModifyPoint
ModifyPointAndTangent
GetEndKnotIndex
GetKnotSequence
GetKnotDistributionType
FindParameter

Indices are 0-based

A standalone 2D bspline curve can be created via IObjectGenerator_DG.Create<IBSplineCurve2d_DG>() > IBSplineCurve2d_DG query.

Implements also: ICurve2d_DG, IObject_DG.


void Init(I2DPointArray_DG poles, IArrayDouble_DG knots, IArrayInt_DG multiplicities, int degree, bool periodic)


void Init(I2DPointArray_DG poles, IArrayDouble_DG weights, IArrayDouble_DG knots, IArrayInt_DG multiplicities, int degree, bool periodic)

Creates a rational or non-rational 2D B-spline curve. Raises an exception if the following conditions are not met:
0 < degree <= MaxDegree(=14 in this version)
weights.GetCount() = poles.GetCount()
knots.GetCount() = multiplicities.GetCount() >= 2
knots[i] < knots[i+1] (Knots are increasing)
1 <= multiplicities[i] <= degree
On a non periodic curve the first and last multiplicities are not greater than degree+1 (Set them to degree+1 to make ends of the curve coinside with the  the first and the last poles).
On a periodic curve the first and the last multicities must be the same.
On non-periodic curves poles.GetCount() == Sum(multiplicities[i]) - degree - 1 >= 2
On periodic curves poles.GetCount == Sum(multiplicities[i]), except the first and the last.


void InitFromPoints(I2DPointArray_DG points, int degreeMin, int degreeMax, Continuity_DG continuity, double tolerance)

Approximates a 2D BSpline Curve passing through an array of points. The resulting BSpline will have: Degree will in the range [Degmin,Degmax]; Continuity at least continuity; Distance from the points lower than tolerance.

Defaults: degreeMin=4. degreeMax=8, continuity=eCont_C2, tolerance=1.0e-3


void InitFromPoints(I2DPointArray_DG points, IArrayDouble_DG parameters, int degreeMin, int degreeMax, Continuity_DG continuity, double tolerance)

Approximates a 2D BSpline Curve passing through an array of points at the specified parameters. The resulting BSpline will have: Degree will in the range [Degmin,Degmax]; Continuity at least continuity; Distance from the points lower than tolerance.

Defaults: degreeMin=4. degreeMax=8, continuity=eCont_C2, tolerance=1.0e-3


void InitFromPoints(I2DPointArray_DG points, double smoothingWeight0, double smoothingWeight1, double smoothingWeight2, int degreeMax, Continuity_DG continuity, double tolerance)

Approximates a 2D BSpline Curve passing through an array of points using variational smoothing algorithm, which minimizes function: smoothingWeight0*CurveLength + smoothingWeight1*Curvature + smoothingWeight2*Torsion.

Defaults: degreeMax=8, continuity=eCont_C2, tolerance=1.0e-3


void Interpolate(I2DPointArray_DG points, bool periodic, double tolerance)

Defines this curve as a constrained BSpline passing through points. If periodic is true, the curve will be periodic and closed. In this case.

Raises an exception if the following conditions are not met:
Size of points is greater than one.
Points are not closer than tolerance to each other,

Defaults: tolerance=1.0e-3


void Interpolate(I2DPointArray_DG points, IArrayDouble_DG parameters, bool periodic, double tolerance)

Defines this curve as a constrained 2D BSpline passing through points. If periodic is true, the curve will be periodic and closed. In this case.

Raises an exception if the following conditions are not met:
Points are not closer than tolerance to each other,
Size of points is greater than one.
If periodic is false, size of parameters is equal to size of points.
If periodic is true, size of parameters is equal to size of points plus one.

Defaults: tolerance=1.0e-3


void Interpolate(I2DPointArray_DG points, T2DDg tangentStart, T2DDg tangentEnd, IArrayDouble_DG paramsOrNull, bool periodic, double tolerance)


void Interpolate(I2DPointArray_DG points, I2DPointArray_DG tangents, IArrayBool_DG tangentFlags, IArrayDouble_DG paramsOrNull, bool periodic, double tolerance)

Defines this curve as a constrained 2D BSpline passing through points. If periodic is true, the curve will be periodic and closed.

points, tangents and tangentFlags must have the same size as points. Vectors in tangents array specify tangents at points where tangentFlags is true.

if scale is true, only direction of the tangents is important. The tangents will be scaled internally so that they have the length of the size of the derivative of the Lagrange interpolation used in the algorithm.

Raises an exception if the following conditions are not met:
Points are not closer than tolerance to each other,
Size of points is greater than one.
If paramsOrNull is not null:
If periodic is false, size of paramsOrNull is equal to size of points.
If periodic is true, size of paramsOrNull is equal to size of points plus one.

Defaults: tolerance=1.0e-3


int GetKnotCount()


double GetKnot(int index)

The index must be in [0, GetKnotCount()-1] range.


IArrayDouble_DG GetKnots()


void SetKnot(int index, double knot)

The index must be in [0, GetKnotCount()-1] range.


void SetKnot(int index, double knot, int multiplicity)

multiplicity must be <= degree and greater than the previous multiplicity of the knot.

The index must be in [0, GetKnotCount()-1] range.


void SetKnots(IArrayDouble_DG knots)


int GetMultiplicity(int indexKnot)

The indexKnot must be in [0, GetKnotCount()-1] range.


IArrayInt_DG GetMultiplicities()


void SetMultiplicity(int indexKnot, int multiplicity)

Increases multiplicity to the specified number. Nothing is done if multiplicity is lower or equal to the current multiplicity. If multiplicity is greater than degree, degree is used.

The indexKnot must be in [0, GetKnotCount()-1] range.


void SetMultiplicity1(int indexKnot0, int indexKnot1, int multiplicity)

Increases multiplicity of knots with indices in [i0, i1] range to the specified number. Nothing is done if multiplicity is lower or equal to the current multiplicity. If multiplicity is greater than degree, degree is used.

indexKnot0 and indexKnot1 must be in [0, GetKnotCount()-1] range.


int GetPoleCount()


T2DDg GetPole(int index)

The index must be in [0, GetPoleCount()-1] range.


I2DPointArray_DG GetPoles()


void SetPole(int index, T2DDg pt)

The index must be in [0, GetPoleCount()-1] range.


void SetPole1(int index, T2DDg pt, double weight)

The index must be in [0, GetPoleCount()-1] range.


double GetWeight(int indexPole)

The indexPole must be in [0, GetPoleCount()-1] range.


void SetWeight(int indexPole, double weight)

The indexPole must be in [0, GetPoleCount()-1] range.


IArrayDouble_DG GetWeights()


bool IsClosed()


bool IsPeriodic()


void SetPeriodic(bool periodic)


bool IsRational()


T2DDg GetPoint(double u)


void GetJet1(double u, T2DDg pt, T2DDg v1)

Returns point and tangent vector at the specified parameter


void GetJet2(double u, T2DDg pt, T2DDg v1, T2DDg v2)

Returns point, tangent vector and the second derivative at the specified parameter


T2DDg GetJetN(double u, int n)

Returns n-th derivative at the specified parameter


Continuity_DG GetContinuity()


double GetEndParameter(bool first)


T2DDg GetEndPoint(bool first)


void InsertKnot(double u, int multiplicity, double tolerance)

If u is an existing knot up to tolerance, the multiplicity is increased by multiplicity if add is true or to multiplicity if add is false. Nothing is done if u is not in the parameter range or <=0. multiplicity must not be greater than the degree.

Defaults: tolerance = 0.0, add = true


void InsertKnots(IArrayDouble_DG knots, IArrayInt_DG multiplicities, double tolerance, bool add)

For each u = knots[i], m = multiplicities[i], if u is an existing knot up to tolerance: If add is true, the multiplicity is increased by m. If add is false, and the current multiplicity is less than m it is increased to m.
If u is not an existing knot, it is inserted as a new knot with multiplicity m.
Nothing is done if u is not on the parameter range or m <= 0 or m > MaxDegree(=14 in this version).

Defaults: tolerance = 0.0, add = true


void RemoveKnot(int index, int multiplicity)

Reduces multiplicity of the knot. If multiplicity is equal to 0, the knot is removed. The array of poles is also modified.

The indexKnot must be in [0, GetKnotCount()-1] range.


void Reverse()

Changes direction of parametrization. The knot sequence is modified. The FirstParameter and the LastParameter are not modified. The StartPoint of the initial curve becomes the EndPoint of the reversed curve and the EndPoint of the initial curve becomes the StartPoint of the reversed curve.


void SetRange(double min, double max)

Segments this curve between min and max. Either of these values can be outside the bounds of the curve, but max must be greater than min. All data structures of this curve are modified, but the knots located between min and max are retained. The degree of the curve is not modified. Warnings : Even if this curve is not closed it can become closed after the segmentation for example if min or max are out of the bounds of the curve or if the curve makes a loop.


void NormalizePeriodic(double u)

No action taken if the curve is not periodic. Otherwise modifies the [in,out] parameter to make it belong to the period.


void SetOrigin(int indexKnot)

Assigns the knot of the index as the origin of this periodic BSpline curve. The knots and poles tables are modified. Raises an exception if this curve is not periodic.

The indexKnot must be in [0, GetKnotCount()-1] range.


void ModifyPoint(double u, T2DDg pt, int indexPoleFrom, int indexPoleTo, out int firstModifiedPole, out int lastModifiedPole)

Moves the point at parameter u on this curve to pt. indexPoleFrom and indexPoleTo are the indexes of the first and the last poles to be moved. The out firstModifiedPole and lastModifiedPole parameters are the indexes of the first and last poles, which were actually modified.

The indexPole* must specify a sub-range of [0, GetPoleCount()-1].


void ModifyPointAndTangent(double u, T2DDg pt, T2DDg tangent, double tolerance, int startingCondition, int endingCondition, int errorStatus)

Moves the point at parameter u on this curve to pt. Modifies shape to ensure that tangent at the point is the specified vector.

startingCondition = -1 means that the first end is allowed to move. endingCondition = -1 means that the last point is allowed move.
startingCondition = 0 means that the first point cannot move. endingCondition = 0 means that the last point cannot move. startingCondition = 1 means the first point and tangent cannot move endingCondition = 1 means the last point and tangent cannot move.
Returns error status != 0 if it is not possible to modify the curve under the specified conditions.


int GetEndKnotIndex(bool first)


IArrayDouble_DG GetKnotSequence()


int GetKnotDistributionType()


void FindParameter(double u, double tolerance, int i0, int i1, bool withKnotRepetition)

If withKnotRepetition is false, returns in i0 index of first knot which is not greater than u. If u counsides with the knot up to the tolerance, i1 will be set equal to i0, otherwise i1 will be set equal to i0 + 1. If u is smaller than the first knot less tolerance, i0 = -1, i1 = 0 is returned. If u is greater than the last knot plus tolerance, i0 = 'size of the knot array', i1 = i0 + 1 is returned.

If withKnotRepetition is true, the knot array in the above is considered modified by inserting copies of knots with multiplicity greater than one.