Synopsis

PDX_MSGT gdx_ApproxG1CurveWithG1Nurb(long option, int model, PDX_MSGT (*eval_curv)(), double t_start, double t_end, int degree, double dev_tol, double pts_tol, long method, MDA_PTR *gdx_nc_ptr)

Purpose

Approximate a G1-continuous curve with a G1-continuous Nurb curve.

Description

Approximate a G1-continuous curve (or segment thereof) with a G1-continuous nonrational Nurb curve of 2 <= degree <= 5. The output Nurb curve is parameterized on [0,1]. It is not checked whether the input curve is G1, but if it is not, then the approximating Nurb curve may not be within the specified tolerance.

Input

option

GDX_LEAVE_LOCKED

If set, the returned entity will be left locked; in this case it is up to the caller to call mda_UnlockEntity for each entity returned. Note: the entity structure can be accessed via mda_GetLockedAddr.

model

The model to create GDX entity in.

eval_curv

A function which evaluates points and first derivative vectors on the curve to be approximated. This function must be declared as: PDX_MSGT eval_curv(double t, int nder, double *ders) nder = 0 or 1 must hold. ders[0]-ders[2] is the curve point, ders[3]-ders[5] is the first derivative if nders = 1.

t_start

Start parameter of curve segment to be approximated.

t_end

End parameter of curve segment to be approximated.

degree

Degree of the output Nurb curve (must be >= 2 and <= 5).

dev_tol

Maximum desired absolute deviation error between the curve segment and the Nurb curve.

pts_tol

Tolerance representing zero distance between two points on the curve; i.e. coincident points tolerance for the space in which the curve lies.

method

GDX_UNI_PARAMS

This method approximates the geometry to within tolerance, and also tries to maintain roughly the parameterization of the original curve segment (scaled to [0,1]).

GDX_UNI_PNTS

This method approximates only the geometry of the original curve segment. Parameterization is roughly uniform.

Output

gdx_nc_ptr

Nurb curve fitting the curve segment.

Return

      GDX_NOERR
      GDX_BADDATA
      Low level error return
      .fi