HM_ExtAPI::CreateCurveComposed()

Creates composed curve object.

Syntax

bool CreateCurveComposed(
HM_EntityGeometryCurve& new_curve,
int num_segs,
const HM_EntityGeometryCurve* curve_segs,
const double* start_params,
const double* end_params,
const double* curve_params,
const bool* curve_dirs
);

Type

HyperMesh Ext API Function

Description

The function creates the curve object of the type HM_ExtAPI::COMPOSED_CURVE().

Use the function HM_ExtAPI::CurveComposedGetSize() to get number of segments in composed curve.

Composed curve geometry is defined by its curve segments. The parametric range of the composed curve is subdivided into parametric segment with each segment corresponding to one of the curve segments of the composed curve. Depending on the location of the composed curve parameter in one of the parametric segments corresponding curve segment is used to calculate the curve point for this parameter.

Subdivision of parametric range of the composed curve is defined by a set of parametric values {tα} with index α taking the values in the range 0 … N and N is the number of curve segments. For parametric value t such that

tα ≤ t ≤ tα+1

the point on the composed curve is calculated as

C(t) = Cα(τ)

where the "local" parameter τ is defined by segment parameterization and the direction flag fα that defines mutual orientation of the composed curve parameterization and the parameterization of the segment curve. The "local" parameter is obtained by mapping from global parameter t as

τ = τα, 0 + (τα, 1 - τα, 0) (t - tα) / (tα+1 - tα) if fα is true

τ = τα, 1 + (τα, 0 - τα, 1) (t - tα) / (tα+1 - tα) if fα is false

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

Parameters used by CreateCurveComposed Composed Curve parameters
num_segs N
curve_segs {Cα}
start_params {τα, 0}
end_params {τα, 1}
curve_params {tα}
seg_dirs {fα}

The values of start_params and end_params parameters must both be NULL or not NULL at the same time. If both of them are NULL then default parameterization of segment curves is used (see HM_ExtAPI::GeomCurveGetParameterBounds for more details).

In case if the value of curve_params parameter is NULL then composed curve parameterization at joints between segments is calculated automatically.

In case if the value of seg_dirs parameter is NULL all values of fα are assumed to be true.

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_segs
[in] - Number of curve segments used to create composed curve.
curve_segs
[in] - Points to array of curve segment handles. The number of entries in the array must be num_segs.
start_params
[in] - If not NULL then points to array of segment start parameters. The number of entries in the array in this case must be num_segs. In case of NULL default parameterization of segment curves is used.
end_params
[in] - If not NULL then points to array of segment end parameters. The number of entries in the array in this case must be num_segs. In case of NULL default parameterization of segment curves is used.
curve_params
[in] - If not NULL then points to array of parameters of the created composed curve corresponding to joints between segments. The number of entries in the array in this case must be num_segs+1. In case of NULL parameterization of the curve is calculated automatically.
seg_dirs
[in] - If not NULL then points to array of flags that define curve segment directions in the composed curve. The number of entries in the array in this case must be num_segs. The value of true corresponds to the direction of the segment parameterization being the same as the composed curve parameterization. The value of false corresponds to opposite directions. In case if the value of seg_dirs is NULL the value of true is assumed for all segments.

Errors

None.