Skip to content

gen_contour_nurbs_xldgen_contour_nurbs_xldGenContourNurbsXldGenContourNurbsXldgen_contour_nurbs_xldT_gen_contour_nurbs_xldπŸ”—

Short descriptionπŸ”—

gen_contour_nurbs_xldgen_contour_nurbs_xldGenContourNurbsXldGenContourNurbsXldgen_contour_nurbs_xldT_gen_contour_nurbs_xld β€” Transform a NURBS curve into an XLD contour.

SignatureπŸ”—

gen_contour_nurbs_xld( out xld_cont Contour, coordinates.y Rows, coordinates.x Cols, string Knots, string Weights, integer Degree, real MaxError, real MaxDistance )gen_contour_nurbs_xld( : Contour : Rows, Cols, Knots, Weights, Degree, MaxError, MaxDistance : )void GenContourNurbsXld( HObject* Contour, const HTuple& Rows, const HTuple& Cols, const HTuple& Knots, const HTuple& Weights, const HTuple& Degree, const HTuple& MaxError, const HTuple& MaxDistance )static void HOperatorSet.GenContourNurbsXld( out HObject contour, HTuple rows, HTuple cols, HTuple knots, HTuple weights, HTuple degree, HTuple maxError, HTuple maxDistance )def gen_contour_nurbs_xld( rows: Sequence[float], cols: Sequence[float], knots: MaybeSequence[Union[str, float]], weights: MaybeSequence[Union[str, float]], degree: int, max_error: Union[float, str], max_distance: Union[float, str] ) -> HObject

Herror T_gen_contour_nurbs_xld( Hobject* Contour, const Htuple Rows, const Htuple Cols, const Htuple Knots, const Htuple Weights, const Htuple Degree, const Htuple MaxError, const Htuple MaxDistance )

void HXLDCont::GenContourNurbsXld( const HTuple& Rows, const HTuple& Cols, const HTuple& Knots, const HTuple& Weights, Hlong Degree, const HTuple& MaxError, const HTuple& MaxDistance )

void HXLDCont::GenContourNurbsXld( const HTuple& Rows, const HTuple& Cols, const HString& Knots, const HString& Weights, Hlong Degree, double MaxError, double MaxDistance )

void HXLDCont::GenContourNurbsXld( const HTuple& Rows, const HTuple& Cols, const char* Knots, const char* Weights, Hlong Degree, double MaxError, double MaxDistance )

void HXLDCont::GenContourNurbsXld( const HTuple& Rows, const HTuple& Cols, const wchar_t* Knots, const wchar_t* Weights, Hlong Degree, double MaxError, double MaxDistance ) (Windows only)

void HXLDCont.GenContourNurbsXld( HTuple rows, HTuple cols, HTuple knots, HTuple weights, int degree, HTuple maxError, HTuple maxDistance )

void HXLDCont.GenContourNurbsXld( HTuple rows, HTuple cols, string knots, string weights, int degree, double maxError, double maxDistance )

DescriptionπŸ”—

gen_contour_nurbs_xldGenContourNurbsXld generates an XLD Contourcontourcontour that approximates a NURBS curve (non-uniform rational B-Spline curve). The NURBS curve is specified by its Degreedegreedegree, a control polygon (via Rowsrowsrows and Colscolscols), a Weightsweightsweights vector and a Knotsknotsknots vector.

The Degreedegreedegree of the curve determines the grade of differentiability of the curve. The curve lies within the convex hull of its control polygon (Rowsrowsrows,Colscolscols). The weights in Weightsweightsweights determine how much the curve is attracted by the individual control points (Rowsrowsrows,Colscolscols). A Weightsweightsweights vector with equal weights for all control points is generated if 'auto'"auto" is chosen. The Knotsknotsknots vector describes the domain of the curve. Typically, this parameter can be set to 'auto'"auto".

The accuracy of the generated Contourcontourcontour depends on the two parameters MaxDistancemaxDistancemax_distance and MaxErrormaxErrormax_error. MaxDistancemaxDistancemax_distance limits the maximum distance of two subsequent Contourcontourcontour points. The maximum distance between the generated Contourcontourcontour and the actual NURBS curve is limited to MaxErrormaxErrormax_error. By default the approximation must fulfill both constraints, but it is possible to set one of these parameters to 'omit'"omit". The lower MaxErrormaxErrormax_error and MaxDistancemaxDistancemax_distance are chosen the better is the approximation of the curve. Note that all Contourcontourcontour points lie exactly on the curve (except for numerical inaccuracies).

Definition

A NURBS curve \(C\) of degree \(p\) is given by

\[\begin{eqnarray*} C(u) = \frac{\sum\limits_{i=0}^{n} N_{i,p}(u)w_{i}P_{i}} {\sum\limits_{i=0}^{n}N_{i,p}(u)w_{i}}, u \in [u_{p},u_{n}]. \end{eqnarray*}\]

The basis functions \(N_{i,p}\) are defined by

\[\begin{eqnarray*} N_{i,0}(u) = \left\{ \begin{array}{ll} 1 & \mathrm{if} \, u_{i} \leq u < u_{i+1} \\ 0 & \mathrm{otherwise} \\ \end{array} \right. \end{eqnarray*}\]
\[\begin{eqnarray*} N_{i,p}(u) = \frac{u - u_{i}}{u_{i+p}-u_{i}}N_{i,p-1}(u) + \frac{u_{i+p+1} - u}{u_{i+p+1}-u_{i+1}}N_{i+1,p-1}(u) \end{eqnarray*}\]

Thus, each NURBS curve is determined by its Degreedegreedegree \(p\), its control Polygon \(P_{0},...,P_{n-1}\) (Rowsrowsrows and Colscolscols), its weight vector \(w = (w_{0}, ..., w_{n-1})\) (Weightsweightsweights), and its knot vector \(u = (u_{0},..., u_{n+p})\) (Knotsknotsknots).

The grade of differentiability of the curve is set via the degree \(p\). At least \(p+1\) control points \(P_{i}\) are required to form a valid curve. The knot vector \(u\) describes the domain of the curve. Its length must be \(n+p+1\) and its entries must be monotonically increasing. Every entry \(u_{i}\) stands for a knot between the curve segments \([u_{i-1}, u_{i})\) and \([u_{i},u_{i+1})\). Each curve segment \([u_{i},u_{i+1})\) lies within the convex hull of the control points \(P_{i-p}, .., P_{i}\). For every curve segment of length zero, the differentiability at knot \(k\) decreases. The number of occurrences of each knot in the knot vector is called multiplicity. The maximum multiplicity of one knot is \(p\). Only the start and the end point’s multiplicity can be \(p+1\) (which in fact is the case for most curves, because in this case start and end point of the curve correspond to the first respectively last point of the control polygon). If start and/or end point do not have full multiplicity, the domain of the curve is restricted to \([u_{p},u_{n}]\). The weights \(w_{i}\) determine the influence of the individual control points \(P_{i}\) on the curve.

Closed Curves: If start and end point are equal (\(P_{0}=P_{n-1}\)) and Knotsknotsknots is set to 'auto'"auto", the curve is closed automatically such that all knots feature multiplicity one. Note that in this case the length of Weightsweightsweights is required to be \(n-1\).

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

Contourcontourcontour (output_object) xld_cont β†’ objectobjectHObjectHXLDContHObjectHobject *

The contour that approximates the NURBS curve.

Rowsrowsrows (input_control) coordinates.y-array β†’ (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Row coordinates of the control polygon.

Number of elements: Rows == Cols && Rows >= Degree + 1

Colscolscols (input_control) coordinates.x-array β†’ (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Column coordinates of the control polygon.

Number of elements: Cols == Rows && Cols >= Degree + 1

Knotsknotsknots (input_control) string(-array) β†’ (string / real)(string / real)HTuple (HString / double)HTuple (string / double)MaybeSequence[Union[str, float]]Htuple (char* / double)

The knot vector \(u\).

Default: 'auto'"auto"
Suggested values: 'auto'"auto"

Weightsweightsweights (input_control) string(-array) β†’ (string / real)(string / real)HTuple (HString / double)HTuple (string / double)MaybeSequence[Union[str, float]]Htuple (char* / double)

The weight vector \(w\).

Number of elements: Weights == Rows
Default: 'auto'"auto"
Suggested values: 'auto'"auto"
Restriction: Weights > 0.0

Degreedegreedegree (input_control) integer β†’ (integer)(integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

The degree \(p\) of the NURBS curve.

Default: 33
Suggested values: 2, 3, 4, 52, 3, 4, 5
Restriction: Degree >= 2

MaxErrormaxErrormax_error (input_control) real β†’ (real / string)(real / string)HTuple (double / HString)HTuple (double / string)Union[float, str]Htuple (double / char*)

Maximum distance between the NURBS curve and its approximation.

Default: 1.01.0
Suggested values: 'omit', 1.0, 2.0, 3.0, 4.0, 5.0"omit", 1.0, 2.0, 3.0, 4.0, 5.0
Restriction: MaxError > 0.0

MaxDistancemaxDistancemax_distance (input_control) real β†’ (real / string)(real / string)HTuple (double / HString)HTuple (double / string)Union[float, str]Htuple (double / char*)

Maximum distance between two subsequent Contourcontourcontour points.

Default: 5.05.0
Suggested values: 'omit', 1.0, 2.0, 3.0, 4.0, 5.0"omit", 1.0, 2.0, 3.0, 4.0, 5.0
Restriction: MaxDistance > 0.0

ExampleπŸ”—

(HDevelop)


* use a polygon XLD contour as control polygon and approximate
* the NURBS curve as contour

get_contour_xld(Polygon, Row, Col)
gen_contour_nurbs_xld(NURBSContour, Row, Col, 'auto', 'auto', 3, 1.0, 10.0)

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

gen_nurbs_interpGenNurbsInterp

Possible successors

gen_polygons_xldGenPolygonsXld

ReferencesπŸ”—

L. Piegl, W. Tiller: β€˜β€™The NURBS Bookβ€™β€˜, 2nd Edition, Springer, 1997.

ModuleπŸ”—

Foundation