## TrimCrvCopyList

(trim_lib/trim_gen.c:246)
Prototype:

      TrimCrvStruct *TrimCrvCopyList(TrimCrvStruct *TrimCrvList)

Description:
Allocates and copies a list of trimming curve structures.
Parameters:

TrimCrvList: | To be copied.
--- | ---

Returned Value:

TrimCrvStruct *: A duplicated list of trimming curves.

Keywords:
copy

## TrimCrvFree

(trim_lib/trim_gen.c:275)
Prototype:

      void TrimCrvFree(TrimCrvStruct *TrimCrv)

Description:
Deallocates a trimming curve structure.
Parameters:

TrimCrv: | trimming curve to free.
--- | ---

Returned Value:

void

Keywords:
allocation

## TrimCrvFreeList

(trim_lib/trim_gen.c:295)
Prototype:

      void TrimCrvFreeList(TrimCrvStruct *TrimCrvList)

Description:
Deallocates a list of trimming curve structures.
Parameters:

TrimCrvList: | list of trimming curve to free.
--- | ---

Returned Value:

void

Keywords:
allocation

## TrimCrvNew

(trim_lib/trim_gen.c:219)
Prototype:

      TrimCrvStruct *TrimCrvCopy(TrimCrvStruct *TrimCrv)

Description:
Duplicates a trimming curve structure.
Parameters:

TrimCrv: | A trimming curve to duplicate.
--- | ---

Returned Value:

TrimCrvStruct *: A trimming curve structure.

Keywords:
allocation

## TrimCrvNew

(trim_lib/trim_gen.c:193)
Prototype:

      TrimCrvStruct *TrimCrvNew(TrimCrvSegStruct *TrimCrvSegList)

Description:
Allocates a trimming curve structure.
Parameters:

TrimCrvSegList: | List of trimming curve segments forming the trimming curve.
--- | ---

Returned Value:

TrimCrvStruct *: A trimmig curve.

Keywords:
allocation

## TrimCrvSegCopyList

(trim_lib/trim_gen.c:118)
Prototype:

      TrimCrvSegStruct *TrimCrvSegCopyList(TrimCrvSegStruct *TrimCrvSegList)

Description:
Allocates and copies a list of trimming curve segment structures.
Parameters:

TrimCrvSegList: | To be copied.
--- | ---

Returned Value:

TrimCrvSegStruct *: A duplicated list of trimming curve segments.

Keywords:
copy

## TrimCrvSegFree

(trim_lib/trim_gen.c:147)
Prototype:

      void TrimCrvSegFree(TrimCrvSegStruct *TrimCrvSeg)

Description:
Deallocates a trimming curve segment structure.
Parameters:

TrimCrvSeg: | trimming curve segment to free.
--- | ---

Returned Value:

void

Keywords:
allocation

## TrimCrvSegFreeList

(trim_lib/trim_gen.c:168)
Prototype:

      void TrimCrvSegFreeList(TrimCrvSegStruct *TrimCrvSegList)

Description:
Deallocates a list of trimming curve segment structures.
Parameters:

TrimCrvSegList: | list of trimming curve segments to free.
--- | ---

Returned Value:

void

Keywords:
allocation

## TrimCrvSegNew

(trim_lib/trim_gen.c:29)
Prototype:

      TrimCrvSegStruct *TrimCrvSegNew(CagdCrvStruct *UVCrv, CagdCrvStruct *EucCrv)

Description:
Allocates a trimming curve segment structure. Allows periodic and float end conditions - converts them to open end.
Parameters:

UVCrv: | A UV curve. Must be an E2 curve.
--- | ---
EucCrv: | Optional Euclidean curve. Must be an E3 curve.

Returned Value:

TrimCrvSegStruct *: A trimming curve segment structure.

Keywords:
allocation

## TrimCrvSegNew

(trim_lib/trim_gen.c:88)
Prototype:

      TrimCrvSegStruct *TrimCrvSegCopy(TrimCrvSegStruct *TrimCrvSeg)

Description:
Duplicates a trimming curve segment structure.
Parameters:

TrimCrvSeg: | trimming curve segment to duplicate.
--- | ---

Returned Value:

TrimCrvSegStruct *: A trimming curve segment structure.

Keywords:
allocation

## TrimCrvs2Polylines

(trim_lib/trim_aux.c:486)
Prototype:

      CagdPolylineStruct *TrimCrvs2Polylines(TrimSrfStruct *TrimSrf,
                                             CagdBType ParamSpace,
                                             CagdRType TolSamples,
                                             SymbCrvApproxMethodType Method)

Description:
Routine to convert the trimming curves of a trimmed surface to polylines. Polyline are always E3 of CagdPolylineStruct type. NULL is returned in case of an error, otherwise list of CagdPolylineStruct.
Parameters:

TrimSrf: | To extract isoparametric curves from.
--- | ---
ParamSpace: | TRUE for curves in parameteric space, FALSE of 3D Euclidean space.
TolSamples: | Tolerance of approximation error (Method = 2) or Number of samples to compute on polyline (Method = 0, 1).
Method: | 0 - TolSamples are set uniformly in parametric space, 1 - TolSamples are set optimally, considering the isocurve's curvature. 2 - TolSamples sets the maximum error allowed between the piecewise linear approximation and original curve.

Returned Value:

CagdPolylineStruct *: List of polylines representing a piecewise linear approximation of the extracted isoparamteric curves or NULL is case of an error.

See Also:
SymbCrv2Polyline
Keywords:
trimming curves

## TrimDbg

(trim_lib/trim_dbg.c:26)
Prototype:

      void TrimDbg(void *Obj)

Description:
Prints trimmed surfaces to stderr. Should be linked to programs for debugging purposes, so trimmed surfaces may be inspected from a debugger.
Parameters:

Obj: | A trimmed surface - to be printed to stderr.
--- | ---

Returned Value:

void

Keywords:
debugging

## TrimDescribeError

(trim_lib/trim_err.c:46)
Prototype:

      char *TrimDescribeError(TrimFatalErrorType ErrorNum)

Description:
Returns a string describing a the given error. Errors can be raised by any member of this trim library as well as other users. Raised error will cause an invokation of TrimFatalError function which decides how to handle this error. TrimFatalError can for example, invoke this routine with the error type, print the appropriate message and quit the program.
Parameters:

ErrorNum: | Type of the error that was raised.
--- | ---

Returned Value:

char *: A string describing the error type.

Keywords:
error handling

## TrimEvalTrimCrvToEuclid

(trim_lib/trim_aux.c:527)
Prototype:

      CagdCrvStruct *TrimEvalTrimCrvToEuclid(TrimSrfStruct *TrimSrf,
                                             CagdCrvStruct *UVCrv)

Description:
Computes the composed Euclidean curve of TrimSrf(UVCrv). The resulting curve is either computed using a piecewise linear approximation or by symbolically composing it onto the surface.
Parameters:

TrimSrf: | To compute the Euclidean UVCrv for.
--- | ---
UVCrv: | A curve in the parametric space of TrimSrf.

Returned Value:

CagdCrvStruct *: A Euclidean curve in TrimSrf, following UVCrv.

Keywords:

## TrimFatalError

(trim_lib/trim_ftl.c:27)
Prototype:

      void TrimFatalError(TrimFatalErrorType ErrID)

Description:
Trap Trim_lib errors right here. Provides a default error handler for the trim library. Gets an error description using TrimDescribeError, prints it and exit the program using exit.
Parameters:

ErrID: | Error type that was raised.
--- | ---

Returned Value:

void

Keywords:
error handling

## TrimGetTrimmingCurves

(trim_lib/trim_aux.c:414)
Prototype:

      CagdCrvStruct *TrimGetTrimmingCurves(TrimSrfStruct *TrimSrf,
                                           CagdBType ParamSpace,
                                           CagdBType EvalEuclid)

Description:
Extracts the trimming curves of the given trimmed surface.
Parameters:

TrimSrf: | Trimmed surface to extract trimming curves from.
--- | ---
ParamSpace: | TRUE for curves in parameteric space, FALSE of 3D Euclidean space.
EvalEuclid: | If TRUE and ParamSpace is FALSE, evaluate Euclidean curve even if one exists.

Returned Value:

CagdCrvStruct *: List of trimming curves of TrimSrf.

Keywords:
trimming curves

## TrimPointInsideTrimmedCrvs

(trim_lib/trim_aux.c:172)
Prototype:

      CagdRType *TrimPointInsideTrimmedCrvs(TrimCrvStruct *TrimCrvList,
                                            TrimSrfStruct *TSrf)

Description:
Finds a point inside a set of trimmed crvs. Returned is a UV location allocated statically.
Parameters:

TrimCrvList: | To find a location inside it.
--- | ---
TSrf: | If provided, will attempt to find a point inside the trimmed curve on the boundary. If NULL, an interior point will be selected.

Returned Value:

CagdRType *: A location in the parametric space of the surface that is part of the valid trimmed surface domain.

Keywords:

## TrimRemoveCrvSegTrimCrvSegs

(trim_lib/trim_sub.c:424)
Prototype:

      int TrimRemoveCrvSegTrimCrvSegs(TrimCrvSegStruct *TrimCrvSeg,
                                      TrimCrvSegStruct **TrimCrvSegs)

Description:
Removes but not delete the given trimming crv segment from the list of trimming curve segments pointed by TrimCrvSegs.
Parameters:

TrimCrvSeg: | Segment to delete.
--- | ---
TrimCrvSegs: | List of trimming curve segments to delete TrimCrvSeg from.

Returned Value:

int: TRUE if found and removed, FALSE otherwise.

See Also:
TrimRemoveCrvSegTrimCrvs
Keywords:

## TrimRemoveCrvSegTrimCrvs

(trim_lib/trim_sub.c:371)
Prototype:

      int TrimRemoveCrvSegTrimCrvs(TrimCrvSegStruct *TrimCrvSeg,
                                   TrimCrvStruct **TrimCrvs)

Description:
Removes but not delete the given trimming crv segment from the list of trimming curves point by TrimCrvs.
Parameters:

TrimCrvSeg: | Segment to delete.
--- | ---
TrimCrvs: | List of trimming curves to delete TrimCrvSeg from.

Returned Value:

int: TRUE if found and removed, FALSE otherwise.

See Also:
TrimRemoveCrvSegTrimCrvSegs
Keywords:

## TrimSetEuclidComposedFromU

(trim_lib/trim_aux.c:582)
Prototype:

      int TrimSetEuclidComposedFromUV(int EuclidComposedFromUV)

Description:
Sets the way Euclidean trimming curves are computed from parametric trimming curves. Either by symbolic composition (TRUE) or by piecewise linear approximation of trimming curves (FALSE).
Parameters:

EuclidComposedFromUV: | Do we want symbolic composition for Euclidean curves, or should we piecewise linear sample the UV trimming curves.
--- | ---

Returned Value:

int: Old value of way of Euclidean curve's computation

Keywords:

## TrimSetTrimCrvLinearApprox

(trim_lib/trim_iso.c:517)
Prototype:

      SymbCrvApproxMethodType TrimSetTrimCrvLinearApprox(CagdRType UVTolSamples,
                                                 SymbCrvApproxMethodType UVMethod)

Description:
Sets the tolerances to use when approximating higher order trimming curves using piecewise linear approximation, for intersection computation.
Parameters:

UVTolSamples: | Piecewise linear approximation of high order trimming curves - number of samples per curve or tolerance.
--- | ---
UVMethod: | Method of sampling.

Returned Value:

int: Old method of curve sampling.

See Also:
SymbCrv2Polyline
Keywords:

## TrimSrf2Curves

(trim_lib/trim_iso.c:120)
Prototype:

      CagdCrvStruct *TrimSrf2Curves(TrimSrfStruct *TrimSrf, int NumOfIsocurves[2])

Description:
Routine to extract from a trimmed surface NumOfIsoline isocurve list in each param. direction. Iso parametric curves are sampled equally spaced in parametric space. NULL is returned in case of an error, otherwise list of CagdCrvStruct. As the isoparametric curves are trimmed according to the trimming curves the resulting number of curves is arbitrary.
Parameters:

TrimSrf: | To extract isoparametric curves from.
--- | ---
NumOfIsocurves: | In each (U or V) direction.

Returned Value:

CagdCrvStruct *: List of extracted isoparametric curves. These curves inherit the order and continuity of the original Srf. NULL is returned in case of an error.

Keywords:
curves isoparametric curves

## TrimSrf2Polygons

(trim_lib/trim2ply.c:56)
Prototype:

      CagdPolygonStruct *TrimSrf2Polygons(TrimSrfStruct *TrimSrf,
                                          int FineNess,
                                          CagdBType ComputeNormals,
                                          CagdBType ComputeUV)

Description:
Routine to convert a single trimmed surface to set of triangles approximating it. FineNess is a fineness control on result and the larger it is more triangles may result. A value of 10 is a good starting value. NULL is returned in case of an error, otherwise list of CagdPolygonStruct.
Parameters:

Srf: | To approximate into triangles.
--- | ---
FineNess: | Control on accuracy, the higher the finer.
ComputeNormals: | If TRUE, normal information is also computed.
ComputeUV: | If TRUE, UV values are stored and returned as well.

Returned Value:

CagdPolygonStruct *: A list of polygons with optional normal and/or UV parametric information. NULL is returned in case of an error.

Keywords:
polygonization surface approximation

## TrimSrf2Polylines

(trim_lib/trim_iso.c:82)
Prototype:

      CagdPolylineStruct *TrimSrf2Polylines(TrimSrfStruct *TrimSrf,
                                            int NumOfIsocurves[2],
                                            CagdRType TolSamples,
                                            SymbCrvApproxMethodType Method)

Description:
Routine to convert a single trimmed surface to NumOfIsolines polylines in each parametric direction with TolSamples samples/tolerance in each isoparametric curve. Polyline are always E3 of CagdPolylineStruct type. NULL is returned in case of an error, otherwise list of CagdPolylineStruct. Attempt is made to extract isolines along C1 discontinuities first.
Parameters:

TrimSrf: | To extract isoparametric curves from.
--- | ---
NumOfIsocurves: | n each (U or V) direction.
TolSamples: | Tolerance of approximation error (Method = 2) or Number of samples to compute on polyline (Method = 0, 1).
Method: | 0 - TolSamples are set uniformly in parametric space, 1 - TolSamples are set optimally, considering the isocurve's curvature. 2 - TolSamples sets the maximum error allowed between the piecewise linear approximation and original curve.

Returned Value:

CagdPolylineStruct *: List of polylines representing a piecewise linear approximation of the extracted isoparamteric curves or NULL is case of an error.

See Also:
SymbCrv2Polyline
Keywords:
isoparametric curves

## TrimSrfCopy

(trim_lib/trim_gen.c:415)
Prototype:

      TrimSrfStruct *TrimSrfCopy(TrimSrfStruct *TrimSrf)

Description:
Duplicates a trimming surface structure.
Parameters:

TrimSrf: | A trimming surface to duplicate.
--- | ---

Returned Value:

TrimSrfStruct *: A trimming surface structure.

Keywords:
allocation

## TrimSrfCopyList

(trim_lib/trim_gen.c:443)
Prototype:

      TrimSrfStruct *TrimSrfCopyList(TrimSrfStruct *TrimSrfList)

Description:
Allocates and copies a list of trimming surface structures.
Parameters:

TrimSrfList: | To be copied.
--- | ---

Returned Value:

TrimSrfStruct *: A duplicated list of trimming surfaces.

Keywords:
copy

## TrimSrfDegreeRaise

(trim_lib/trim_aux.c:83)
Prototype:

      TrimSrfStruct *TrimSrfDegreeRaise(TrimSrfStruct *TrimSrf, CagdSrfDirType Dir)

Description:
Returns a new trimmed surface representing the same surface as TrimSrf but with its degree raised by one.
Parameters:

TrimSrf: | To raise its degree.
--- | ---

Returned Value:

TrimSrfStruct *: A surface with same geometry as Srf but with one degree higher.

Keywords:
degree raising

## TrimSrfDomain

(trim_lib/trim_aux.c:37)
Prototype:

      void TrimSrfDomain(TrimSrfStruct *TrimSrf,
                         CagdRType *UMin,
                         CagdRType *UMax,
                         CagdRType *VMin,
                         CagdRType *VMax)

Description:
Returns the parametric domain of a trimmed surface.
Parameters:

TrimSrf: | To get its parametric domain.
--- | ---
UMin: | Where to put the minimal U domain's boundary.
UMax: | Where to put the maximal U domain's boundary.
VMin: | Where to put the minimal V domain's boundary.
VMax: | Where to put the maximal V domain's boundary.

Returned Value:

void

Keywords:
domain parametric domain

## TrimSrfEval

(trim_lib/trim_aux.c:63)
Prototype:

      CagdRType *TrimSrfEval(TrimSrfStruct *TrimSrf, CagdRType u, CagdRType v)

Description:
Given a trimmed surface and parameter values u, v, evaluate the surface at (u, v).
Parameters:

TrimSrf: | o evaluate at the given parametric location (u, v).
--- | ---
u, v: | The parameter values at which TrimSrf is to be evaluated.

Returned Value:

CagdRType *: A vector holding all the coefficients of all components of surface TrimSrf's point type. If, for example, TrimSrf's point type is P2, the W, X, and Y will be saved in the first three locations of the returned vector. The first location (index 0) of the returned vector is reserved for the rational coefficient W and XYZ always starts at second location of the returned vector (index 1).

Keywords:
evaluation

## TrimSrfFree

(trim_lib/trim_gen.c:472)
Prototype:

      void TrimSrfFree(TrimSrfStruct *TrimSrf)

Description:
Deallocates a trimmed surface structure.
Parameters:

TrimSrf: | trimmed surface to free.
--- | ---

Returned Value:

void

Keywords:
allocation

## TrimSrfFreeList

(trim_lib/trim_gen.c:493)
Prototype:

      void TrimSrfFreeList(TrimSrfStruct *TrimSrfList)

Description:
Deallocates a list of trimmed surface structures.
Parameters:

TrimSrfList: | list of trimmed surface to free.
--- | ---

Returned Value:

void

Keywords:
allocation

## TrimSrfMatTransform

(trim_lib/trim_gen.c:561)
Prototype:

      void TrimSrfMatTransform(TrimSrfStruct *TrimSrf, CagdMType Mat)

Description:
Transforms, in place, the given trimmed surface as specified by a homogeneous matrix Mat.
Parameters:

TrimSrf: | Trimmed surface to transform.
--- | ---
Mat: | Homogeneous transformation to apply to trimmed surface.

Returned Value:

void

Keywords:
Trimmed surface

## TrimSrfNew

(trim_lib/trim_gen.c:323)
Prototype:

      TrimSrfStruct *TrimSrfNew(CagdSrfStruct *Srf,
                                TrimCrvStruct *TrimCrvList,
                                CagdBType HasTopLvlTrim)

Description:
Constructor for a trimmed surface.
Parameters:

Srf: | Surface to make into a trimmed surface.
--- | ---
TrimCrvList: | A list of trimming curves.
HasTopLvlTrim: | Do we have a top level outer most trimming curve?

Returned Value:

TrimSrfStruct *: The trimmed surface.

Keywords:
allocation

## TrimSrfNew2

(trim_lib/trim_gen.c:383)
Prototype:

      TrimSrfStruct *TrimSrfNew2(CagdSrfStruct *Srf,
                                 CagdCrvStruct *TrimCrvList,
                                 CagdBType HasTopLvlTrim)

Description:
Constructor for a trimmed surface.
Parameters:

Srf: | Surface to make into a trimmed surface.
--- | ---
CagdCrvStruct: | A list of trimming curves, as regular curves.
HasTopLvlTrim: | Do we have a top level outer most trimming curve?

Returned Value:

TrimSrfStruct *: The trimmed surface.

Keywords:
allocation

## TrimSrfRefineAtParams

(trim_lib/trim_aux.c:299)
Prototype:

      TrimSrfStruct *TrimSrfRefineAtParams(TrimSrfStruct *TrimSrf,
                                           CagdSrfDirType Dir,
                                           CagdBType Replace,
                                           CagdRType *t,
                                           int n)

Description:
Given a trimmed surface - refines it at the given n knots as defined by vector t. If Replace is TRUE, the values in t replaces current knot vector. Returns pointer to refined surface (Note a Bezier surface will be converted into a Bspline surface).
Parameters:

TrimSrf: | To refine.
--- | ---
Dir: | Direction of refinement. Either U or V.
Replace: | If TRUE, t holds knots in exactly the same length as the length of the knot vector of Srf and t simply replaces the knot vector.
t: | Vector of knots with length of n.
n: | Length of vector t.

Returned Value:

TrimSrfStruct *: A refined surface of TrimSrf after insertion of all the knots as specified by vector t of length n.

Keywords:
refinement subdivision

## TrimSrfRegionFromTrimSrf

(trim_lib/trim_aux.c:109)
Prototype:

      TrimSrfStruct *TrimSrfRegionFromTrimSrf(TrimSrfStruct *TrimSrf,
                                              CagdRType t1,
                                              CagdRType t2,
                                              CagdSrfDirType Dir)

Description:
Given a trimmed surface - extracts a sub-region within the domain specified by t1 and t2, in the direction Dir.
Parameters:

TrimSrf: | To extract a sub-region from.
--- | ---
t1, t2: | Parametric domain boundaries of sub-region.
Dir: | Direction of region extraction. Either U or V.

Returned Value:

TrimSrfStruct *: Sub-region extracted from TrimSrf from t1 to t2.

Keywords:
regions subdivision

## TrimSrfReverse

(trim_lib/trim_aux.c:367)
Prototype:

      TrimSrfStruct *TrimSrfReverse2(TrimSrfStruct *TrimSrf)

Description:
Returns a new trimmed surface that is the reversed surface of Srf by flipping the U and the V directions of the surface, as well as flipping them in the trimming curves. See also BspKnotReverse.
Parameters:

TrimSrf: | To be reversed.
--- | ---

Returned Value:

TrimSrfStruct *: Reversed surface of TrimSrf.

Keywords:
reverse

## TrimSrfReverse

(trim_lib/trim_aux.c:321)
Prototype:

      TrimSrfStruct *TrimSrfReverse(TrimSrfStruct *TrimSrf)

Description:
Returns a new trimmed surface that is the reversed surface of TrimSrf by reversing the control mesh and the knot vector (if Bspline surface) of TrimSrf in the U direction, as well as its trimming curves. See also CagdSrfReverse and BspKnotReverse.
Parameters:

TrimSrf: | To be reversed.
--- | ---

Returned Value:

TrimSrfStruct *: Reversed surface of TrimSrf.

Keywords:
reverse

## TrimSrfSubdivAtParam

(trim_lib/trim_sub.c:63)
Prototype:

      TrimSrfStruct *TrimSrfSubdivAtParam(TrimSrfStruct *TrimSrf,
                                          CagdRType t,
                                          CagdSrfDirType Dir)

Description:
Given a trimmed surface - subdivides it into two sub-surfaces at given parametric value t in the given direction Dir. Returns pointer to a list of two trimmed surfaces, at most. It can very well may happen that the subdivided surface is completely trimmed out and hence nothing is returned for it.
Parameters:

TrimSrf: | To subdivide at the prescibed parameter value t.
--- | ---
t: | The parameter to subdivide the curve Crv at.
Dir: | Direction of subdivision. Either U or V.

Returned Value:

TrimSrfStruct *: The subdivided surfaces. Usually two, but can have only one, if other is totally trimmed away.

Keywords:
subdivision

## TrimSrfTransform

(trim_lib/trim_gen.c:522)
Prototype:

      void TrimSrfTransform(TrimSrfStruct *TrimSrf,
                            CagdRType *Translate,
                            CagdRType Scale)

Description:
Linearly transforms, in place, given trimmed surface as specified by Translate and Scale.
Parameters:

TrimSrf: | Trimmed surface to transform.
--- | ---
Translate: | Translation factor.
Scale: | Scaling factor.

Returned Value:

void

Keywords:

## TrimSrfsFromContours

(trim_lib/trimcntr.c:78)
Prototype:

      TrimSrfStruct *TrimSrfsFromContours(CagdSrfStruct *Srf,
                                          IPPolygonStruct *Cntrs)

Description:
Creats a set of trimmed surfaces as defined by the given set of contours than can contain either closed or open contours. Open contours must terminate at the boundary of the parameteric domain of the surface. Closed contours must be completely contained in the parametric domain with last point equals first.
Parameters:

Srf: | To trim into pieces.
--- | ---
Cntrs: | Polylines to use as seperating edges.

Returned Value:

TrimSrfStruct *: List of trimmed surface pieces.

See Also:
Keywords: