HM_ExtAPI::CurveApproximationGetData()

Returns parameters that define curve represented by approximation points.

Syntax

bool CurveApproximationGetData(
const HM_EntityGeometryCurve& curve,
int& num_points,
HM_Point** points,
double** params
);

Type

HyperMesh Ext API

Description

The function expects that the type of curve object is HM_ExtAPI::APPROXIMATION_CURVE(). Application should call the function HM_ExtAPI::GeomCurveGetType() to verify the type before calling CurveApproximationGetData function.

To free arrays allocated for points and parameters during the function call use the function HM_ExtAPI::MemoryFree().

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 returned by the function CurveApproximationGetData.

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

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

curve
[in] - Handle to curve object that was returned by previous calls to API functions.
num_points
[out] - Number of approximation points.
points
[out] - If not NULL on input then returns pointer to array of approximation points representing the curve. The number of points in the returned array is num_points.
params
[out] - If not NULL on input then returns pointer to array of curve parameters corresponding to approximation points. The number of values in the returned array is num_points.

Errors

None.