HM_ExtAPI::CreateCurveNURBS()

Creates NURBS curve object.

Syntax

bool CreateCurveNURBS(
HM_EntityGeometryCurve& new_nurbs,
int degree,
int num_knots,
int num_poles,
const double* knots,
const HM_Point* poles,
const double* weights
);

Type

HyperMesh Ext API Function

Description

The function creates the curve object of the type HM_ExtAPI::NURBS_CURVE.

The NURBS curve is defined by its degree D, the set of poles (also known as control points) {Pα} with index α taking values in the range 0 … N-1 where N is the total number of poles, and the set of parametric "knot" values {τβ} with index β taking values in the range 0 … M-1. In case the curve is rational then also a set of "weights" {wα} corresponding to each pole is required for the NURBS curve definition.

Parametric equation for the NURBS curve is given by

C(t) = ∑wα Pα NαD(t) / ∑ wα NαD(t)

where summation sign ∑ indicates the sum over all values of index α in the range 0 … N-1, and NαD(t) are the B-spline functions of the degree D defined by the knots vector {τβ}.

In the case of non-rational curve (the parameter weights is NULL) all pole weights are assumed to be equal and the parametric equation simplifies to

C(t) = ∑ Pα NαD(t)

Parameters of the NURBS curve for the function CreateCurveNURBS satisfy "open end" boundary conditions. This means that first D +1 knots and last D + 1 knots in the knots array knots must have the same value:

τo = τ1 = … = τD

τM -1 = τM -2 = … = τM -1 - D

The total number of knots M and the total number of poles N must satisfy the relation

M = N + D + 1

The following table clarifies correspondence between parameters used in the equations above and parameter values used by the function CreateCurveNURBS.

Parameters used by CreateCurveNURBS NUBS Curve parameters
degree D
num_knots M
num_poles N
knots {τβ}
poles {Pα}
weights {wα}

If the function succeeds, the return value is true. If the function fails, the return value is false. To get extended value information, call HM_ExtAPI::GetLastErrorCode().

Requires including hm_extapi.h.

Inputs

new_nurbs
[out] - Handle to new curve object.
degree
[in] - NURBS degree.
num_knots
[in] - Number of knots.
num_poles
[in] - Number of poles.
knots
[in] - Points to the array of knot values. The number of values in the array must benum_knots.
poles
[in] - Point to the array of NURBS poles. The number of values in the array must benum_poles.
weight
[in] - If not NULL then points to the array of NURBS weights. The number of values in the array in this case must be num_poles. If the values is NULL then the value of 1.0 is assumed for all poles (non-rational curve).

Errors

None.