HM_ExtAPI::CreateCurveApproximation()

Creates approximation curve object.

Syntax

bool CreateCurveApproximation(
HM_EntityGeometryCurve& new_curve,
int num_points,
const HM_Point* points,
const double* params
);

Type

HyperMesh Ext API Function

Description

The function creates the curve object of the type HM_ExtAPI::APPROXIMATION_CURVE(). Approximation curve is defined by the set of points {Pα} and corresponding to these points curve parameters {τα}, where index α takes the values in the range 0 … N -1 and N is the number of approximation points. Depending on the value of the curve parameter t the point on the curve is calculated by linear interpolation between corresponding approximation points as

C(t) = [ Pα (τα+1 - t) + Pα+1 (t - τα) ] / (τα+1 - τα),

in the case

τα ≤ t ≤ τα+1.

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

Parameters used by CreateCurveApproximation Approximation curve parameters
num_points N
points {Pα}
params {τα}

The parameter params can be set to NULL. In this case parameters corresponding to approximation points are calculated automatically.

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_curve
[out] - Handle to new curve object.
num_points
[in] - Number of approximation points.
points
[in] - Pointer to array of approximation points representing the curve. The number of points the array must be num_points.
params
[in] - If not NULL then points to array of curve parameters corresponding to approximation points. The number of values in the array in this case must be num_points.

None.