void cvxAxisTransform
(
svxMatrix *Mat,   /* I: tranformation matrix */
svxAxis *Axis      /* I/O: axis */
)
/*
DESCRIPTION:
Applies transformation matrix "Mat" to "Axis".
*/
________________________________________________________________________________

void cvxBndBoxAdd
(
svxBndBox *Box,   /* I/O: pointer to bounding box data */
svxPoint *Pnt      /* I: point to add to bounding box */
)
/*
DESCRIPTION:
"Grows" the specified bounding box to envelop the specified point.
*/
________________________________________________________________________________

void cvxBndBoxInit
(
svxBndBox *Box      /* I/O: pointer to bounding box data */
)
/*
DESCRIPTION:
Initializes the specified bounding box.
*/
________________________________________________________________________________

void cvxBndBoxPnts
(
svxBndBox *Box,      /* I: pointer to bounding box data */
svxPoint *Pnts         /* I/O: pointer to array of 8 point structures */
)
/*
DESCRIPTION:
Outputs the corner points of the specified bounding box to the array
referenced by "Pnts".  Memory for the array must be allocated by the
calling procedure.  "Pnts" is a pointer to the start of the memory.
*/
________________________________________________________________________________

double cvxBndBoxSize
(
svxBndBox *Box      /* I: pointer to bounding box data */
)
/*
DESCRIPTION:
Returns the "size" of the specified bounding box -- that is,
the length of its diagonal.
*/
________________________________________________________________________________

int cvxCrvEval
(
int idCurve,      /* I: curve entity id */
double T,         /* I: t parameter value on curve */
svxPoint *Point,   /* O: point on curve */
svxVector *Normal   /* O: normal at point on curve */
)
/*
DESCRIPTION:
Evaluates the NURB representation of the curve entity
specified by "idCurve".  Outputs the point coordinates (Point) 
and normal direction (Normal) at the specified "t" parameter 
value.   Use cvxCrvParam() to get the curve's parameter limits.

Returns 1 if function fails,  0 if it succeeds.
*/
________________________________________________________________________________

int cvxCrvParam
(
int idCurve,      /* I: curve entity id */
svxLimit *T         /* O: min/max T values */
)
/*
DESCRIPTION:
Outputs the minimum and maximum t parameter values of the
NURB representation of the specified curve entity. 

Returns 1 if function fails,  0 if it succeeds.
*/
________________________________________________________________________________

int cvxCrvPntProj
(
int idCurve,      /* I: id of curve entity */
svxPoint *Pnt,      /* I: coordinates of point to project onto curve */
double *T,         /* O: T parameter value of point-on-curve */
svxPoint *ProjPnt   /* O: XYZ coordinates of projected point */
)
/*
DESCRIPTION:
Outputs the T parameter value of the projection of the input XYX
point onto the NURBS representation of the specified curve.  It 
is assumed that "Pnt" lies on or very close to the curve.

Returns 1 if function fails,  0 if it succeeds.
*/
________________________________________________________________________________

int cvxFaceEval
(
int idFace,         /* I: face entity id */
double U,         /* I: U parameter value on face */
double V,         /* I: V parameter value on face */
svxPoint *Point,   /* O: point on face (input NULL to ignore) */
svxVector *Normal /* O: normal at point on face (input NULL to ignore) */
)
/*
DESCRIPTION:
Evaluates the NURB representation of the face entity
specified by "idFace".  Outputs the point coordinates (Point)
and normal direction (Normal) at the specified U,V location
on the surface.  Use cvxFaceParam() to get the face's parameter 
limits.

Note that the direction of "Normal" is set to reflect the outward
normal of the face, where "outward" means the direction that points
towards the outside of the shape that the face is associated with.
This may be opposite the natural normal of the NURB surface associated
with the face.

If you want the natural normal of the NURB surface associated with
the face, call cvxFaceEval2() and take the cross product of "Utan" 
and "Vtan" (cvxVecCross), which are first derivatives of the natural 
surface at the specified U,V location on the surface.

Returns 1 if function fails,  0 if it succeeds.
*/
________________________________________________________________________________

int cvxFaceEval2
(
int idFace,         /* I: face entity id */
double U,         /* I: U parameter value on face */
double V,         /* I: V parameter value on face */
svxPoint *Point,   /* O: point on face (input NULL to ignore) */
svxVector *Normal,/* O: normal at point on face (input NULL to ignore) */
svxVector *Utan,   /* O: U tangent direction (input NULL to ignore) */
svxVector *Vtan    /* O: V tangent direction (input NULL to ignore) */
)
/*
DESCRIPTION:
Evaluates the NURB representation of the face entity
specified by "idFace".  Outputs the point coordinates (Point),
normal direction (Normal) and UV tangent directions at the 
specified U,V location on the surface.   Use cvxFaceParam() to 
get the face's parameter limits.

Note that the direction of "Normal" is set to reflect the outward
normal of the face, where "outward" means the direction that points
towards the outside of the shape that the face is associated with.
This may be opposite the natural normal of the NURB surface associated
with the face.


If you want the natural normal of the NURB surface associated with
the face, take the cross product of "Utan" and "Vtan" (cvxVecCross), 
which are first derivatives of the natural surface at the specified 
U,V location on the surface.

Returns 1 if function fails,  0 if it succeeds.
*/
________________________________________________________________________________

int cvxFaceParam
(
int idFace,         /* I: face entity id */
svxLimit *U,      /* O: min/max U values */
svxLimit *V         /* O: min/max V values */
)
/*
DESCRIPTION:
Outputs the minimum and maximum parameter values of the
NURB representation of the specified face entity. 

Returns 1 if function fails,  0 if it succeeds.
*/
________________________________________________________________________________

int cvxFacePntLoc
(
int idFace,               /* I: face entity id */
double U,               /* I: U parameter value on face */
double V,               /* I: V parameter value on face */
evxPntLocation *Loc      /* O: point location relative to face boundaries */
)
/*
DESCRIPTION:
Determines the location of the specified point on the specified face
relative to the face's trim boundaries.

Returns 1 if function fails,  0 if it succeeds.
*/
________________________________________________________________________________

int cvxFacePntProj
(
int idFace,         /* I: face entity id */
svxPoint *Point,   /* I: XYZ point on/near face */
double *U,         /* O: U coordinate of point-on-face */
double *V         /* O: V coordinate of point-on-face */
)
/*
DESCRIPTION:
Outputs the UV coordinates of the projection of the input XYX
point onto the NURBS representation of the specified face.  
It is assumed that "Point" lies on or very close to the face.

Returns 1 if function fails,  0 if it succeeds.
*/
________________________________________________________________________________

int cvxIsectCrvCrv
(
int idCurve1,      /* I: first curve */
int idCurve2,      /* I: second curve */
int TangentOk,      /* I: 1 to include points of tangency; else 0 */
int *Count,         /* O: number of intersection points */
svxPoint **Points   /* O: list of intersection points */
)
/*
DESCRIPTION:
Outputs a list of the points where the two input curves intersect.
The calling procedure MUST deallocate the output list.

Returns 1 if function fails or no intersection point is found.
Returns 0 if one or more intersection points are found.
*/
________________________________________________________________________________

int cvxIsectRayComp
(
int idComp,         /* I: component id */
evxFaceTrim Trim,   /* I: face trim option */
svxAxis *Ray,      /* I: ray defined by a point and a direction */
svxPoint *Point    /* O: closest intersection point (NULL to ignore) */
)
/*
DESCRIPTION:
Intersects the input ray with the specified component in the
active part and outputs the point closest to the ray 
startpoint (Ray->Pnt). The output point coordinates are given
in the space of the active part.  Note that the ray only extends 
in the specified direction from the startpoint.  Intersections 
in the other direction are not considered. 

The "Trim" option is used to determine what portions of
the component's faces are checked against the ray.

Returns 1 if function fails or no intersection is found.
Returns 0 if intersection point succesfully found.
*/
________________________________________________________________________________

int cvxIsectRayFace
(
int idFace,         /* I: id of face in active file */
evxFaceTrim Trim,   /* I: face trim option */
svxAxis *Ray,      /* I: ray defined by a point and a direction */
svxPoint *Point,   /* O: intersection point (NULL to ignore) */
svxPoint2 *UV      /* O: U,V coordinates (NULL to ignore) */
)
/*
DESCRIPTION:
Intersects the input ray with the input face and outputs the
point closest to the ray startpoint (Ray->Pnt).  Note that the
ray only extends in the specified direction from the startpoint.  
Intersections in the other direction are not considered.

The "Trim" option is used to determine what portions of
the face are checked against the ray.

Returns 1 if function fails or no intersection is found.
Returns 0 if intersection point succesfully found.
*/
________________________________________________________________________________

int cvxIsectRayPart
(
evxFaceTrim Trim,   /* I: face trim option */
svxAxis *Ray,      /* I: ray defined by a point and a direction */
svxPoint *Point,   /* O: closest intersection point (NULL to ignore) */
int *idFace       /* O: id of face that intersection point lies on */
                  /*    (input NULL to ignore this output) */
)
/*
DESCRIPTION:
Intersects the input ray with all faces of the active part and 
outputs the point closest to the ray startpoint (Ray->Pnt).  
Note that the ray only extends in the specified direction from 
the startpoint.  Intersections in the other direction are not 
considered.  If an intersection is found, the id of the intersected 
face is optionally output.  Use cvxPartInqFaceShape() to get the 
id of the face's parent shape.

The "Trim" option is used to determine what portions of
the parts's faces are checked against the ray.

Returns 1 if function fails or no intersection is found.
Returns 0 if intersection point succesfully found.
*/
________________________________________________________________________________

int cvxIsectRayPartVis
(
evxFaceTrim Trim,   /* I: face trim option */
svxAxis *Ray,      /* I: ray defined by a point and a direction */
svxPoint *Point,   /* O: closest intersection point (NULL to ignore) */
int *idFace       /* O: id of face that intersection point lies on */
                  /*    (input NULL to ignore this output) */
)
/*
This function is the same as cvxIsectRayPart(), except that it
only considers visible faces.  That is, it ignores faces that
belong to blanked shapes.
*/
________________________________________________________________________________

int cvxIsectRayPlane
(
svxAxis *Ray,      /* I: ray defined by a point and a direction */
svxMatrix *Plane,   /* I: plane transformation matrix (XY plane) */
svxPoint *Point    /* O: intersection point */
)
/*
DESCRIPTION:
Intersects the input ray with the XY plane of the specified 
transformation matrix and outputs the point of intersection.

Returns 0 if intersection point succesfully found.
Returns 1 if the ray is parallel to, and on the plane.
Returns 2 if the ray is parallel to, but off the plane.
*/
________________________________________________________________________________

int cvxIsectRayShape
(
int idShape,      /* I: id of shape in active part */
evxFaceTrim Trim,   /* I: face trim option */
svxAxis *Ray,      /* I: ray defined by a point and a direction */
svxPoint *Point,   /* O: closest intersection point (NULL to ignore) */
int *idFace         /* O: id of face that intersection point lies on */
                  /*    (input NULL to ignore this output) */
)
/*
DESCRIPTION:
Intersects the input ray with the input shape and outputs the
point closest to the ray startpoint (Ray->Pnt).  Note that the
ray only extends in the specified direction from the startpoint.  
Intersections in the other direction are not considered.  If an
intersection is found, the id of the intersected face is
optionally output.

The "Trim" option is used to determine what portions of
the shapes's faces are checked against the ray.

Returns 1 if function fails or no intersection is found.
Returns 0 if intersection point succesfully found.
*/
________________________________________________________________________________

void cvxMatInit
(
svxMatrix *Mat      /* I/O: transformation matrix */
)
/*
DESCRIPTION:
Initializes "Mat" to the identity matrix.
*/
________________________________________________________________________________

void cvxMatInvert
(
svxMatrix *Mat,      /* I: tranformation matrix */
svxMatrix *InvMat      /* O: inverted tranformation matrix */
)
/*
DESCRIPTION:
Output an inverted version of "Mat" via "InvMat".
*/
________________________________________________________________________________

void cvxMatMult
(
svxMatrix *Mat1,      /* I: first tranformation matrix */
svxMatrix *Mat2,      /* I: second tranformation matrix */
svxMatrix *Mat3      /* O: resulting matrix */
)
/*
DESCRIPTION:
Matrix multiply (Mat3 = Mat1 * Mat2).
*/
________________________________________________________________________________

void cvxMatPntVec
(
svxPoint *Origin,   /* I: origin */
svxVector *zAxis,   /* I: direction of Z axis */
svxMatrix *Mat      /* O: transformation matrix */
)
/*
DESCRIPTION:
Composes a transformation matrix that defines a reference
frame whose origin coincides with "Origin", whose Z axis
points in the direction of "zAxis", with arbitrary X and
Y axes.
*/
________________________________________________________________________________

void cvxMatRotate
(
svxMatrix *Mat,      /* I/O: transformation matrix */
double Angle,         /* I: rotation angle (deg) */
svxAxis *Axis         /* I: axis of rotation */
)
/*
DESCRIPTION:
Initializes a transformation matrix "Mat" to perform rotations
by the specified angle about the specified axis.
*/
________________________________________________________________________________

void cvxMatScale
(
svxMatrix *Mat,   /* I/O: transformation matrix */
svxPoint *Point,   /* I: reference point */
double sX,         /* I: X scale */
double sY,         /* I: Y scale */
double sZ          /* I: Z scale */
)
/*
DESCRIPTION:
Initializes "Mat" so that it will scale points by sX, sY, sZ
relative to "Point".
*/
________________________________________________________________________________

void cvxMatSetIdentity
(
svxMatrix *Mat      /* I/O: transformation matrix */
)
/*
DESCRIPTION:
Make sure "identity" flag associated with "Mat" is set correctly.
*/
________________________________________________________________________________

void cvxMatTranslate
(
svxMatrix *Mat,   /* I/O: transformation matrix */
double dX,         /* I: X distance */
double dY,         /* I: Y distance */
double dZ          /* I: Z distance */
)
/*
DESCRIPTION:
Initializes "Mat" so that it will translate points by dX, dY, dZ.
*/
________________________________________________________________________________

void cvxMatView
(
svxMatrix *Mat,   /* I/O: transformation matrix */
evxViewStd Type   /* I: standard view type */
)
/*
DESCRIPTION:
Initializes "Mat" to the specified standard view.
*/
________________________________________________________________________________

double cvxPntDist
(
svxPoint *Point1,      /* I: first point */
svxPoint *Point2       /* I: second point */
)
/*
DESCRIPTION:
Returns the distance between two points.
*/
________________________________________________________________________________

int cvxPntOnCrv
(
int idCurve,      /* I: id of curve in the active object */
double Fraction,   /* I: fraction of curve length (0.0 to 1.0) */
svxPoint *Point   /* O: point on curve */
)
/*
DESCRIPTION:
Calculates a 3D point on the specified curve entity
(in the active object) at the input fraction of the 
curve's length from its startpoint.

Returns 1 if function fails,  0 if it succeeds.
*/
________________________________________________________________________________

int cvxPntOnFace
(
int idComp,         /* I: id of component that contains face (0 if undefined) */
int idFace,          /* I: id of face in active part or specified component */
double Param[2],   /* O: u,v parameter values */
svxPoint *Point   /* O: point on face */
)
/*
DESCRIPTION:
Calculates a point on the specified face at the midpoint of 
the face's bounding box in UV parameter space.  The 3D point 
coordinates are output in the space of the active part, even 
if the face belongs to a child component of the part (idComp > 0).  
The corresponding U,V parameters are output as Param[0] and Param[1].

Returns 1 if function fails,  0 if it succeeds.
*/
________________________________________________________________________________

int cvxPntProject
(
svxPoint *Pnt,      /* I: point to project */
int idEntity,      /* I: id of face, curve or plane entity */
svxPoint *ProjPnt   /* O: projected point on curve */
)
/*
DESCRIPTION:
Projects "Pnt" onto the specified curve, face or plane 
and outputs the result as "ProjPnt".

Returns 1 if function fails,  0 if it succeeds.
*/
________________________________________________________________________________

void cvxPntTransform
(
svxMatrix *Mat,      /* I: tranformation matrix */
svxPoint *Point      /* I/O: point */
)
/*
DESCRIPTION:
Applies transformation matrix "Mat" to "Point".
*/
________________________________________________________________________________

void cvxPntTransformList
(
svxMatrix *Mat,      /* I: tranformation matrix */
int Count,            /* I: number of points to transform */
svxPoint *Points      /* I: list of points to transform */
)
/*
DESCRIPTION:
Applies transformation matrix "Mat" to "Point".
*/
________________________________________________________________________________

void cvxPntTranslate
(
svxPoint *Point,      /* I/O: point */
svxVector *Vector,   /* I: direction vector */
double Distance      /* I: distance */
)
/*
DESCRIPTION:
Translates "Point" along "Vector" by "Distance".
This function assumes that "Vector" is normalized.
*/
________________________________________________________________________________

void cvxVecCross
(
svxVector *V1,      /* I: first vector */
svxVector *V2,      /* I: second vector */
svxVector *Cross   /* O: cross product of V1 and V2 */
)
/*
DESCRIPTION:
Gets the cross product of two vectors.
*/
________________________________________________________________________________

void cvxVecInit
(
svxPoint *Point1,      /* I: first point */
svxPoint *Point2,      /* I: second point */
svxVector *Vector      /* O: direction vector */
)
/*
DESCRIPTION:
Initializes a normalized "Vector" that points along
the direction from "Point1" to "Point2".
*/
________________________________________________________________________________

void cvxVecNormalize
(
svxVector *Vector      /* I/O: direction vector */
)
/*
DESCRIPTION:
Normalizes a direction vector to unit magnitude (1.0).
*/
________________________________________________________________________________

void cvxVecPerp
(
svxVector *Vector,   /* I: reference vector */
svxVector *Perp      /* O: vector perpendicular to input "Vector" */
)
/*
DESCRIPTION:
Creates a vector that is perpendicular to another vector.
*/
________________________________________________________________________________

void cvxVecReverse
(
svxVector *Vector    /* I: vector */
)
/*
DESCRIPTION:
Reverses the direction of the input vector.
*/
________________________________________________________________________________

void cvxVecTransform
(
svxMatrix *Mat,      /* I: tranformation matrix */
svxVector *Vector      /* I/O: vector */
)
/*
DESCRIPTION:
Applies transformation matrix "Mat" to "Vector".
*/
________________________________________________________________________________