Geom Library Functions

 

AllocNurbKntCP IsectLineLine NrmPrjCvToSf2 VxBndBoxGrowPnt
VxBndBoxInit VxBndBoxIsect VxBndBoxMk VxBndBoxMrg
VxBndBoxPntTest VxCrvCpy VxCrvUVtoNrb VxCurvLen
VxMat4Ident VxMat4Rotate VxMat4Scale VxMat4Xlate
VxNrbEvalDist VxNrbEvalGeom VxNrbExtrct VxNrbIsect
VxNrbMin VxNrbMkCrv VxNrbMkSrf VxNrbModGeom
VxPntSameTol2 VxPrjBndBoxLn VxSrfCpy VxTol2Del
VxTol2Get VxTol2Mk VxUnlckNrbKntCP

 


 AllocNurbKntCP

int AllocNurbKntCP(VeGeomType , void *)
VeGeomType type i
Type of geometry to allocate for. 
void *geom i/o
pointer to nurb structure. 

Description

Allocate the knot and control point data for a nurb curve or surface.  Knots and control points are stored together in an area created with a single allocation.

 type        | geom (type *) | Input                Output

-------------+---------------+------------------------------------

 V_CURVE     | VsNurbCurv    | crv->t.num_kt

             |               | crv->cp.dim

             |               | crv->cp.num_cp

             |               |                     crv->t.knots

             |               |                     crv->cp.list

-------------+---------------+------------------------------------

 V_SURFACE   | VsNurbSurf    | srf->u.num_kt

             |               | srf->v.num_kt

             |               | srf->cp.dim

             |               | srf->cp.num_cp

             |               |                     srf->u.knots

             |               |                     srf->v.knots

             |               |                     srf->cp.list

-------------+---------------+------------------------------------

Memory-Management

 

Caveats

 

 Top


 IsectLineLine

int IsectLineLine(const VsPoint *, const VsPoint *, const VsPoint *, const VsPoint *, int *, double *, double *, VsPoint *)
const VsPoint *l1_pnt i
Point on first line. 
const VsPoint *l1_vec i
Direction vector for first line. 
const VsPoint *l2_pnt i
Point on second line. 
const VsPoint *l2_vec i
Direction vector for second line. 
int *parallel_flag o
parallel flag, indicates parallelism between
line and plane.
parallel_flag = 0 : Lines intersect.
parallel_flag = 1 : Parallel.
parallel_flag = 2 : lines are skewed. 
parallel_flag = 3 : zero derivative 
double *l1_t o
parameter value on first line at point
of closest approach.  Where
l1(t) = l1_pnt[] + l1_vec[]*(t). 
double *l2_t o
parameter value on second line at point
of closest approach.  Where
l2(t) = l2_pnt[] + l2_vec[]*(t). 
VsPoint *isect_pnt o
description of output parm2 

Description

   This function computes the closest point between two 3D lines.
   If the lines intersect (i.e. parallel_flag == 0) then isect_pnt
   contains the intersection point.

Memory-Management

 

Caveats

 

 Top


 NrmPrjCvToSf2

int NrmPrjCvToSf2(int, VsNurbCurv **, VsNurbSurf *, double, int, int, int *, VsPrjCvSegDat **)
int nCvsIn i
number of curves to be projected. 
VsNurbCurv **apCvsIn i
array of ptrs to curves to be projected 
VsNurbSurf*pSrf i
surface on which curve is projected 
double dTol i
3D pt conic tol 
int fTrim i
flag (T/F) T=>project onto Trimmed pSrf. 
int fClip i
flag (T/F) T=>clip off segments not above srf,
F=>switch to min dist march. 
int*numPrjCv o
number of curves-of-projection 
VsPrjCvSegDat**aPrjCv o
pointer to array of crvs of projection. 

Description


   Project curves onto a surface normal to the surface
   in the manner of closest point projection.

Memory-Management


   Caller must deallocate *aPrjCv which is returned by this routine
   as well as the  curves inside each structure.

Caveats

 

 Top


 VxBndBoxGrowPnt

void VxBndBoxGrowPnt(int , VsLim1 *, double *, VsLim1 *)
intdim i
Dimension. 
VsLim1*box i
Bounding box. 
double*pnt i
Point to grow box with. 
VsLim1*grow_box o
The resulting box (can be the same as input box). 

Description

   This routine grows a bounding box to include the given point.

Memory-Management

 

Caveats

 

 Top


 VxBndBoxInit

void VxBndBoxInit(int , VsLim1 *)
intdim i
Dimension. 
VsLim1*box i
Bounding box. 

Description

 This routine initializes the bounding box, so that it can be merged with
 other boxes/points.

Memory-Management

 

Caveats

 

 Top


 VxBndBoxIsect

int VxBndBoxIsect(int , VsLim1 *, VsLim1 *, double )
int dim i
Number of min/max entries per box. 
VsLim1 *box1 i
First bounding box. 
VsLim1 *box2 i
Second bounding box. 
double tol i
Coincidence tolerance. 

Description

   Check if two bounding boxes intersect.

Memory-Management

 

Caveats

 

 Top


 VxBndBoxMk

int VxBndBoxMk(int , int , double *, VsLim1 *)
int num_coord i
Dimension of input points.
if num_coord <0 it
				is
				assumed
				that
				points
				are
				weighted
				and
				must
				be
				divided
				by
				their
				weights
				before
				computing
				box.
				[num_coord=-3
				implies
				(wx,wy,w)
				which
				converts
				to
				(x,y),
				num_coord=3
				inplies
				(x,y,z)].
				</pre>
int num_pnts i
Number of points in list. 
double *list i
List of coordinates. (Format depends on num_coord)  
VsLim1 *box o
Array of max/min structs (1 per dimension). 

Description

   Compute the (model space) bounding box of a list of points.

Memory-Management

 

Caveats

 

 Top


 VxBndBoxMrg

void VxBndBoxMrg(int , VsLim1 *, VsLim1 *, VsLim1 *)
int dim i
Number of min/max entries per box. 
VsLim1 *box1 i
First bounding box. 
VsLim1 *box2 i
Second bounding box. 
VsLim1 *merg_box o
The box resulting from merging box1 & box2. 

Description

   Merge two bounding boxes to form a new bounding box.

Memory-Management

 

Caveats

 

 Top


 VxBndBoxPntTest

int VxBndBoxPntTest(int , const VsLim1 *, const double *, double )
int dim i
Number of min/max entries per box. 
const VsLim1 *box1 i
Bounding box. 
const double *pnt i
Point to test. 
double tol i
Point coincidence tolerance. 

Description

   Merge two bounding boxes to form a new bounding box.

Memory-Management

 

Caveats

 

 Top


 VxCrvCpy

VsNurbCurv *VxCrvCpy(const VsNurbCurv *)
const VsNurbCurv *cur i
Curve to be copied. 

Description

 

Memory-Management

 

Caveats

 

 Top


 VxCrvUVtoNrb

int VxCrvUVtoNrb(const VsNurbSurf *, const VsNurbCurv *, double , int , VsNurbCurv **)
const VsNurbSurf *surf i
underlying surface 
const VsNurbCurv *uvcv i
uv curve 
double tolerance i
max deviation between and curve & surface 
int degree i
degree of resulting nurb curve 
VsNurbCurv **new_curv o
output nurb curve 

Description

   Generate a 3-D nurb curve (to tolerance) from a uv curve and an
   associated surface.

Memory-Management

 

Caveats

 

 Top


 VxCurvLen

int VxCurvLen(VsNurbCurv *, double , double , double *)
VsNurbCurv*crv i
input NURBS curve 
doubleleft i
left side parameter value 
doubleright i
right side parameter value 
double*length o
approximate curve length 

Description

   Calculate the length of the curve between the 2 parameter values.

Memory-Management

 

Caveats

 

 Top


 VxMat4Ident

void VxMat4Ident(VsMatrix )
VsMatrix zMat o
(4x4) identity matrix 

Description

   Get a (4x4) identity matrix.

Memory-Management

 

Caveats

 

 Top


 VxMat4Rotate

void VxMat4Rotate(VsPoint *, VsPoint *, double , VsMatrix )
VsPoint *pzPnt i
Point which axis of rotation is passing
through or V_NULL if (0,0,0) 
VsPoint *pzAxis i
Axis of rotation 
double dAngle i
Angle of rotation (in radians) 
VsMatrix zMat o
(4x4) rotation matrix 

Description

   Get the (4x4) transformation matrix to rotate objects with respect to the
   specified axis passing through the given point.
   Note that this routine is more efficient than VxMat4RotPnt() because
   VxMat4RotPnt() uses matrix multiplication.

Memory-Management

 

Caveats

 

 Top


 VxMat4Scale

void VxMat4Scale(VsPoint *, double , double , double , VsMatrix )
VsPoint *pzPnt i
Fixed point or V_NULL if (0,0,0) 
double sx i
Scale factor in x direction 
double sy i
Scale factor in y direction 
double sz i
Scale factor in z direction 
VsMatrix zMat o
(4x4) scale matrix 

Description

   Get a (4x4) scale matrix.

Memory-Management

 

Caveats

 

 Top


 VxMat4Xlate

void VxMat4Xlate(double , double , double , VsMatrix )
VsMatrix zMat o
(4x4) translation matrix 

Description

   Get a (4x4) translation matrix.

Memory-Management

 

Caveats

 

 Top


 VxNrbEvalDist

int VxNrbEvalDist(VsGeomEnt *, VsGeomEnt *, int , VsEntLoc *, VsEntLoc *, double *)
VsGeomEnt *ety_1 i
First geometric entity data. 
VsGeomEnt *ety_2 i
Second geometric entity data. 
int trim_domain i
Trim flag indicating if the entity trim
boundarys are to be considered. 1-trim first ent,
2-trim second ent, 3-trim both, 0-neither. 
VsEntLoc *loc_1 o
Location on first ent at pnt of closest contact. 
VsEntLoc *loc_2 o
Location on second ent at pnt of closest contact. 
double *dist o
Shortest distance between entities. 

Description

This function is used for evaluating distance between two geometric entities. The table below indicates the allowable pairs of entities that may be considered.

      \ety_2 |  

 ety_1 \     | V_POINT   | V_CURVE    | V_CURV_ON_SURF |   V_SURFACE

-------------+-----------+------------+----------------+----------

V_POINT      |      X    |      X     |      X         |     X

-------------+-----------+------------+----------------+----------

V_CURVE      |      X    |      X     |                |     X

-------------+-----------+------------+----------------+----------

V_SURFACE    |      X    |      X     |                |     X

-------------+-----------+------------+----------------+----------

Memory-Management

 

Caveats

 

 Top


 VxNrbEvalGeom

int VxNrbEvalGeom(const VsGeomEnt *, const double [2], const int , void *)
const VsGeomEnt *ent i
Geometry to be evaluated. 
const double pnt[2] i
Evaluation location. 
const int level i
Level of evaluation. 
void *result o
Results. 

Description

Evaluate geometry at the specified point "level" specifies the level of evaluation. The higher the level the more data gets returned (at the expense of greater computation).  "result" is a VsEvalCurv, or VsEvalSurf structure depending on the type of geometry being evaluated.

geom

result

pnt

level

0

1

2

3

V_CURVE

VsEvalCurv

[0] : t

pnt

deriv_1

deriv_2

deriv_3

V_SURFACE

VsEvalSurf

[0] : u,

pnt

normal

partial_uu

 

 

 

[1] : v

 

partial_u

partial_uv

 

 

 

 

 

partial_v

partial_vv

 

V_CURV_ON_SURF

VsEvalCurv

[0] : t

pnt

deriv_1

deriv_2

deriv_3

Memory-Management

 

Caveats

 

 Top


VxNrbExtrct

int VxNrbExtrct(const VsTol2 *, const int , const void *, const double [4], int *, void *[2])
const VsTol2 *ent_tol i
Pointer to entity tolerance data. 
const int method i
Method of extraction. (see table) 
const void *geom i
Curve, or surf entity 
const double bnds[4] i
Array describing parameter space boundarys 
int *num_ent o
Number of entities in arry_ents. 
void *arry_ent[2] o
Output array containing pointers to new
geom. 

Description

   This function creates a new curve or surface by extracting a portion 
from a specified geometric entity.


method             |  Notes -------------------+-------------------------------------------------------- V_CRV_CLIP        |  Extract subcurve having parameter                   |    t bounds: (bnds[0],bnds[1]) V_CRV_DIVIDE      |  Divide curve at t=bnds[0], return both parts. V_CRV_MASK        |  Remove subcurve (bnds[0],bnds[1]) return end segments. V_SFU_CLIP        |  Extract subsurface having parameter                   |    u bounds: (bnds[0],bnds[1]) V_SFU_DIVIDE      |  Divide surface along u=bnd[0] isoline.  Keep both sides. V_SFV_CLIP        |  Extract subsurface having parameter                   |    v bounds: (bnds[0],bnds[1]) V_SFV_DIVIDE      |  Divide surface along v=bnd[0] isoline.  Keep both sides. V_SRF_CLIP        |  Extract subsurface having parameter                   |    u bounds: (bnds[0],bnds[1])                   |    v bounds: (bnds[2],bnds[3]) -------------------+------------------+-------------------------------------

Memory-Management

   This function allocates memory for one or more curves or surfaces.  It
   is the responsibility of the calling function to deallocate these.  

Caveats

 

 Top


VxNrbIsect

int VxNrbIsect(int , VsGeomEnt *, int , VsGeomEnt *, int , double , int *, VsGenIsect **)
int num_1 i
Number of entities in lst_1. 
VsGeomEnt *lst_1 i
First curve or surface entity. 
int num_2 i
Number of entities in lst_2. 
VsGeomEnt *lst_2 i
Second curve or surface entity. 
int trim_domain i
Flag (V_TRUE/V_FALSE) indicating if the entity
trim boundarys are to be considered. V_TRUE implies
only the trimmed parameter space is valid 
double tol i
Intersection tolerance. 
int *num_isect o
Number of intersection structures in lst_isect. 
VsGenIsect **lst_isect o
array of intersection entities. 

Description

   Intersect two Nurb entities.

Memory-Management

   The calling function must deallocate the list lst_isect (assuming
   num_isect > 0).

Caveats

   To avoid a potential data explosion from subdividing too many entities
   at once, surfaces are processed one against another, all others are
   processed in groups with at most MAX_GRP_SIZE entities.

 Top


VxNrbMin

int VxNrbMin(int, VsGeomEnt *, int, VsGeomEnt *, double, int *, VsGenIsect **)
int num_1 i
Number of entities in lst_1. 
VsGeomEnt *lst_1 i
First curve entity. 
int num_2 i
Number of entities in lst_2. 
VsGeomEnt *lst_2 i
Second curve entity. 
double tol i
Intersection tolerance. 
int *num_isect o
Number of intersection structures in lst_isect. 
VsGenIsect **lst_isect o
array of intersection entities. 

Description

   Intersect two Nurb curves at the min distance between them.

Memory-Management

   The calling function must deallocate the list lst_isect (assuming
   num_isect > 0).

Caveats

   To avoid a potential data explosion from subdividing too many entities
   at once, surfaces are processed one against another, all others are
   processed in groups with at most MAX_GRP_SIZE entities.

 Top


VxNrbMkCrv

int VxNrbMkCrv(VeCurvMethod , int , void *, double , VsNurbCurv **)
VeCurvMethod method i
Method for curve creation 
int dim i
dimension of curve (2D or 3D) 
void *data i
Pointer to data that defines curve
(see table below) 
doubletol i
Tolerance. 
VsNurbCurv **curv o
Pointer to new NURB curve 

Description

 

Memory-Management

   This function allocates a Nurb curve which must be deallocated
   by the calling function.

Caveats

 

 Top


VxNrbMkSrf

int VxNrbMkSrf(VeSurfMethod , void *, VsNurbSurf **)
VeSurfMethod method i
Method for surface creation. 
void* data i
Pointer to data that defines surface
(see table below). 
VsNurbSurf** surf o
Pointer to new NURB surface. 

Description

   This function is used for creating a new surface entity.
The method specified determines the type of data that should be passed in.
For example if the method is V_SRF_SPHERE then the function expects data to
be a pointer to a structure of type VsSphere (see table below).  The function
returns a pointer to the new surface.


method             |  data (type *)   |    Notes -------------------+------------------+------------------------------------- V_SRF_PLANE        |  VsPlane         | Create plane on XY plane of xform V_SRF_3PT_PLANE    |  Vs3PtPlane      | Create plane from 3 points V_SRF_SPHERE       |  VsSphere        | Create sphere centered about xform V_SRF_CONE         |  VsCone          | Create a cone, base on plane,                   |                  | center at xform origin, len==>+Z dir V_SRF_GRID         |  VsSurfInterp    | Create a surf which interpolates grid. V_SRF_CYLINDER     |  VsCylinder      | Create a cylinder, base on plane,                   |                  |  center at xform origin,+len<=>+Z dir V_SRF_ELLIPSOID    |  VsEllipsoid     | Create ellipsoid centered about xform V_SRF_EXTRUDE      |  VsSurfExtrusion | Create extrusion Z dir of profile. V_SRF_REVOLVE      |  VsSurfRevolve   | Create surface of revolution from                   |                  |  curve or profile. V_SRF_SWEEP        |  VsSurfSweep     | Create swept surface V_SRF_OFFSET       |  VsSurfOffset    | Create an offset surface. Use                   |                  | ((VsSurfOffset *)data)->srf->offset                   |                  | as the offset distance. V_SRF_CIR_OFF      |  VsSurfOffset    | Create a circular offset surface. Use                   |                  | ((VsSurfOffset *)data)->srf->offset                   |                  | as the offset distance.  Use data->                   |                  | zDir as the normal to the plane. V_SRF_VAR_OFF      |  VsSurfOffset    | Create an offset surface. Use                   |                  | ((VsSurfOffset *)data)->offset                   |                  | as offset distance with variations at                   |                  | ((VsSurfOffset *)data)->pts V_SRF_MESH         |  VsSurfMesh      | Create surface from a mesh of curves. V_SRF_RULED        |  VsSurfRuled     | Create a ruled surface between two                   |                  | curves. V_SRF_DRAFT_NPLN   |  VsSurfDraftNPln | Create a draft surface from the input                   |                  | surface, given the neutral plane. In                   |                  | this case, the neutral uv curve is also                   |                  | returned in the input data struct. V_SRF_DRAFT_NUV    |  VsSurfDraft     | Create a draft surface from the input                   |                  | surface, given the neutral uv curve. V_SRF_DRAFT        |  VsSurfDraft     | Create a draft surface from the input                   |                  | surface, given the neutral uv curve.                   |                  | This is the low level routine which                   |                  | actually creates the draft surface. -------------------+------------------+-------------------------------------

Memory-Management

 

Caveats

 

 Top


VxNrbModGeom