Synopsis
PDX_MSGT gdx_ModelCurveToParmSpace(long option, int model, MDA_PTR sur, MDA_PTR modcur, double devtol, long maxits, int fdeg, void *parcurs, long *npc, double *moddev, T_GDX_RECT_MESH **rect_mesh)
Purpose
Generate parameter space pre-image of model space curve(s).
Description
Given a GDX surface S(u,v) and a GDX model space curve M(t) which lies on S(u,v) (to within some tolerance), this routine produces the parameter space curve P(s)=(u(s),v(s)), whose image under S(u,v) is the projection of M(t) onto S(u,v) to within the tolerance, devtol. S(u,v) and M(t) must be continuous, M(t) may have cusps, but S(u,v) must be smooth (no sharp ridges). Although P(s) will be a precise pre-image in some simple cases, it is generally an approximation (to within devtol). An iterative least squares curve fitting approach is used. The output curve, P(s), may consist of multiple curves, as it will be split where it crosses seams or poles. P(s) will be in Nurbs form.
The memory to contain parcurs is allocated by this function and must be freed by the caller. If the caller is not part of libgdx, this must be done by calling gdx_Free.
Input
option
GDX_COMMIT
Entity creation option. If set, created entities will be commited to the data base.
GDX_FITDEGMAX
If set, degree of P(s) will not exceed fdeg (see below). This will force the use of approximation in case degree of M(t) is greater than fdeg and S(u,v) is a plane. If not set, then a precise P(s) would be generated in this case (with degree(P(s)) = degree(M(t))).
GDX_OPENCLOSED
If set, the surface will be treated as open in both directions.
GDX_DEGREE_1
If set, the parametric curve generated always will be a Nurb curve of degree one.
model
The GDX model for entity creation.
sur
The GDX surface on which M(t) (modcur) lies.
modcur
The model space curve, M(t), whose projection onto S(u,v) is to be mapped back into the uv-parameter space.
devtol
The deviation of the model space image of P(s) from the projection of M(t) should not be greater than devtol. This tolerance should be larger than MODEL_SPACE_PNT_TOL, at least by 1 to 2 orders of magnitude.
maxits
Maximum number of iterations. Iteration will be stopped if this number is exceeded.
fdeg
Degree used for fitting the parameter space curve, P(s). See option GDX_FITDEGMAX above. If P(s) is a straight line, degree=1 will be used.
rect_mesh
pointer to rect_mesh entity used as the temporary rect mesh for the projectsion or NULL. If non NULL is passed in first time, entitiy must be NULL.
Output
parcurs
An array of the Nurbs parameter space curves which make up P(s) (split at seams and poles). This allocated memory must be freed by caller, using gdx_Free if the caller is not part of libgdx.
npc
Number of parameter space curves returned in parcurs.
moddev
The measured deviation of M(t) from S(u,v).
rect_mesh
if not NULL, it returns the rect mesh entity used for projection
Tolerances
MODEL_SPACE_PNT_TOL
PARM_SPACE_PNT_TOL
ANGLE_TOL
ZERO_TOL
.fi
Return
GDX_NOERR
GDX_NOCONVERGE
GDX_NOCURVE
Low level error return
.fi