AlSurface

Interface to Alias NURBS surface geometry.

#include <AlSurface.h>

class AlSurface : public AlObject

AlSurface();

virtual ~AlSurface();

virtual statusCode deleteObject();

virtual AlObject* copyWrapper() const;

statusCode create( int, int, curveFormType, curveFormType, int, int, const double[], const double[], int, int, const double[], const int[], const int[] );

statusCode create( int, int, curveFormType, curveFormType, const double[], const double[], int, int, const double[] );

statusCode createRevolvedSurface(const double[3], const double[3], double, double, const AlCurve* );

statusCode createRevolvedSurface( double [3], double [3], AlCurve* );

statusCode createLinearExtrusionSurface( double [3], double, AlCurve* );

statusCode createTorus(const double[3], const double[3], double, double, const double[3], double, double, double, double);

statusCode createSphere( double [3], double );

statusCode createCylinder( double [3], double [3], double);

statusCode createCone( double[3], double, double[3], double);

virtual AlObjectType type() const;

AlSurfaceNode* surfaceNode() const;

curveFormType uForm() const;

curveFormType vForm() const;

int uDegree() const;

int vDegree() const;

int uNumberOfSpans() const;

int vNumberOfSpans() const;

int uNumberOfCVs() const;

int vNumberOfCVs() const;

AlSurfaceCV* firstCV() const;

AlSurfaceCV* getCV( int, int ) const;

AlAttributes* firstAttribute() const;

boolean isAffectedByViewFrame() const; // Obselete

boolean isConstructionHistoryResultingSurface() const;

// Specific to AlSurface

statusCode setCVsUnaffectedPosition( const double[]);

statusCode setuKnotVector( const double[] );

statusCode setvKnotVector( const double[] );

statusCode setCVsUnaffectedPositionInclMultiples( const double[] );

statusCode setRealuKnotVector( const double[] );

statusCode setRealvKnotVector( const double[] );

statusCode unpileEndKnots( int, const double[] );

boolean isPointActive( double u, double v ) const;

// Common to AlSurface, AlTrimRegion

statusCode CVsWorldPosition( double[], int[], int[])const;

statusCode CVsAffectedPosition( const AlTM&, double[], int[], int[]) const;

statusCode CVsUnaffectedPosition( double[], int[], int[])const;

int uNumberOfKnots() const;

int vNumberOfKnots() const;

statusCode uKnotVector( double[] ) const;

statusCode vKnotVector( double[] ) const;

int uNumberOfCVsInclMultiples() const;

int vNumberOfCVsInclMultiples() const;

statusCode CVsWorldPositionInclMultiples( double[] ) const;

statusCode CVsAffectedPositionInclMultiples( const AlTM&, double[] ) const;

statusCode CVsUnaffectedPositionInclMultiples( double[] )const;

int realuNumberOfKnots() const;

int realvNumberOfKnots() const;

statusCode realuKnotVector( double[] ) const;

statusCode realvKnotVector( double[] ) const;

statusCode area( double& area, boolean worldCoords = TRUE, double tolerance=0.001 );

statusCode circumference( double& circ, boolean worldCoords = TRUE, double tolerance=0.001 );

statusCode eval(double,double,boolean,double P[3], double Pu[3]=NULL, double Pv[3]=NULL, double n[3]=NULL,boolean=FALSE,boolean=FALSE ) const;

// Specific to AlSurface

AlShader* firstShader() const;

AlShader* nextShader( const AlShader* ) const;

statusCode nextShaderD( AlShader* ) const;

statusCode assignShader( AlShader* );

statusCode layerShader( AlShader* );

statusCode renderInfo( AlRenderInfo& ) const;

statusCode setRenderInfo( const AlRenderInfo& ) const;

boolean trimmed() const;

boolean isTargetSurface() const;

statusCode project( AlCurveNode*, double[3], boolean );

statusCode projectNormal( AlCurveNode* curveNode, boolean keep_history );

statusCode trim( int, const double[], const double[], boolean );

statusCode trim( int, const double[], const double[] );

statusCode trim( int, const AlCurveOnSurface*[] );

statusCode uniformRebuild( AlSurfaceNode* &newSurfaceNode, int nu, int nv, boolean inU, boolean inV, boolean=TRUE );

statusCode periodicToNonPeriodic( int, int );

statusCode periodicToNonPeriodic() const;

AlSurface* untrimmedToTrimmedSurface() const;

AlTrimRegion* trimSurfaceToRegion() const;

AlTrimRegion* firstTrimRegion() const;

AlCurve* localBoundary( int ) const;

AlCurve* getModelSpaceSurfaceBoundary() const;

AlCurve* parameterBoundary( int ) const;

AlCurve* getParamSpaceSurfaceBoundary() const;

AlCurveOnSurface* firstCurveOnSurface() const;

statusCode addCurveOnSurface( AlCurveOnSurface* );

statusCode removeCurveOnSurface( AlCurveOnSurface* );

boolean isDisplayModeSet( AlDisplayModeType ) const;

statusCode setDisplayMode( AlDisplayModeType, boolean );

statusCode doUpdates( boolean newState = TRUE );

statusCode insert( double, Direction );

statusCode reverseDirection( boolean inU, boolean inV );

AlSurface is the interface to the geometric data of Alias’ NURBS surface objects. To create a surface, first instantiate and create an AlSurface and then instantiate and create an AlSurfaceNode. There is only a limited amount that you can do with an AlSurface that does not have an AlSurfaceNode.

For more information on how to create the surface geometry, see the description for the create() method.

Note: method isAffectedByViewFrame() is now obsolete. The new method to call is isConstructionHistoryResultingSurface() to find out if a surface may be modified based on changes to its constructor objects.

A NURBS surface is described as having two dimensions, u and v. Many of the surface properties (form, multiplicity, and so on) are the same as a NURBS curve but are expressed in both the u and v direction.

The form of a surface in the u or v direction can be one of three types: periodic, closed or open. If a surface is "kPeriodic" in u, then it is tangent continuous in u at all points in that direction. If a surface is "kClosed" in u, it is not periodic but its edges in the u direction are coincident. If the surface is neither closed nor periodic in u, it is considered to be "kOpen". The same applies in the v direction.

There are two ways to delete an AlSurface. If the AlSurface deleteObject() is called, the attached AlSurfaceNode is deleted. If the AlSurfaceNode deleteObject() is called, the attached AlSurface is deleted.

You should always create a surface node for a surface. If you create a surface with no surface node, then the surface is not added to the universe. If you should lose the pointer to the surface, it will become lost memory.

There is one limitation to this class: you cannot add or remove individual CVs (except by changing multiplicity).

If an AlSurface has curves-on-surface, then you can get a pointer to the first curve-on-surface and then traverse the curves using methods in the class AlCurveOnSurface.

If an AlSurface is trimmed, the trim regions on the surface can be accessed using the firstTrimRegion() method and then traversed using methods in the class AlTrimRegion.

All AlSurface objects will have at least one shader attached to them. These can be accessed through the firstShader() and nextShader() methods.

All AlSurface objects have render information attached to them. The AlRenderInfo structure can be used to query the surface’s render parameters.

Surfaces are made of surface control points (or CVs) which you traverse as a list by using the firstCV() in conjunction with the AlSurfaceCV methods. You can also pack the surface information into an array using methods in this class.

An AlSurfaceCV object can actually represent multiple CVs, depending on the AlSurfaceCV’s multiplicity and periodicity. Notice that in this class there are two sets of methods - some "InclMultiples" and some not (namely "numberOfCVs", "CVsWorldPosition", "CVsUnaffectedPosition", etc). The set of methods without multiplicity lets you get all surface CV’s where a surface CV can have multiplicity of 1, 2 or 3. The set of methods "InclMultiples" lets you get ALL surface CVs including multiples due to a multiplicity > 1 and due to periodicity.

Create a surface in the interactive Alias package with 16 CVs, and pick the CV which is second in the u direction and second in the v direction. Set the multiplicity of this CV to 3 in the u direction and 2 in the v direction (using the "multiplicity" tool). Then:

- uNumberOfCVs() will return 4. uNumberOfCVs() will return 4.
- CVsWorldPosition must be passed a 4x4x4 CVs matrix, and the u and v multiplicity vectors must each be of length 4.
- CVsUnaffectedPosition() must be passed the same as item 2.
- setCVsUnaffectedPosition() must be passed the same as item 2.
- uNumberOfCVsInclMultiples() will return 6. vNumberOfCvsInclMultiples() will return 5.
- CVsWorldPositionInclMultiples() must be passed a 6x5x4 CVs matrix. You will notice that in this matrix there are duplicate CVs to indicate multiples due to multiplicity > 1 and periodicity.
- CVsUnaffectedPositionInclMultiples() must be passed the same as item 6. You will notice that in this matrix there are duplicate CVs to indicate multiples due to multiplicity > 1 and periodicity.
- setCVsUnaffectedPositionInclMultiples() must be passed the same as item 6. Similar to items 6 and 7, you should put duplicate CVs to account for multiples although this is not mandatory. You may want to refer to the examples in the AlCurve class description. The way CVs are ignored also applies to this method.

If you create a surface in the interactive Alias package with 16 CVs and "close" the surface in the u direction (using the "close" tool in the Object Tools palette), you create a periodic surface. Then:

- uNumberOfCVs() will return 4. uNumberOfCVs() will return 4.
- CVsWorldPosition must be passed a 4x4x4 CVs matrix, and the u and v multiplicity vectors must each be of length 4.
- CVsUnaffectedPosition() must be passed the same as item 2.
- setCVsUnaffectedPosition() must be passed the same as item 2.
- uNumberOfCVsInclMultiples() will return 7. uNumberOfCVsInclMultiples() will return 4.
- CVsWorldPositionInclMultiples() must be passed a 7x4x4 CVs matrix.
- CVsUnaffectedPositionInclMultiples() must be passed the same as item 6.
- setCVsUnaffectedPositionInclMultiples() must be passed the same as item 6. Similar to items 6 and 7, you should put duplicate CVs to account for multiples although this is not mandatory. You may want to refer to the examples in the AlCurve class description. The way CVs are ignored also applies to this method.

How do I process a matrix of CVs?

Methods in this class store CVs in the V direction first, then in the U direction. Here’s an example of how to get the world positions of the CVs of a surface and print them out in V direction then U direction. (Notice that the outer "for" loop uses the number of CVs in the U direction).

int numUCvs = surface->uNumberOfCVs();

int numVCvs = surface->vNumberOfCVs();

double *cvs = new double [numUCvs * numVCvs * 4];

int *uMult = new int [numUCvs];

int *vMult = new int [numVCvs];

int u, v, index;

surface->CVsWorldPosition( cvs, uMult, vMult );

for( index = 0, u = 0; u < numUCvs; u++ ) {

for( v = 0; v < numVCvs; v++, index+=4 ) {

printf(" %g, %g, %g, %g\n",

cvs[index], cvs[index+1], cvs[index+2], cvs[index+3] );

}

}

statusCode AlSurface::create(int uDeg,int vDeg,curveFormType uForm,curveFormType vForm,int uNumKnots,int vNumKnots,const double uKnotVector[],const double vKnotVector[],int uNumControlPts,int vNumControlPts,const double controlPoints[],const int uMultiplicity[],const int vMultiplicity[] )

Used to create the data used to represent a surface. See the AlCurve::create() method in AlCurve for a general description of how NURBS curves are represented with this interface. Surfaces are a natural extension of curves.

Surfaces contain two one-dimensional arrays of knot values called knot vectors for each of the ’u’ and ’v’ parametric directions of the surface. The form and degree of the surface can be different in both the ’u’ and ’v’ direction. The control points are stored in a two-dimensional array of points so there are a total of uNumControlPts * vNumControlPts control points. The ’controlPoints’ parameter must have the dimensions [uNumControlPts][vNumControlPts][4].

This method may be used in the same way as the AlCurve::create() method, and the conditions that must be met by the input data are the same except that the conditions apply to both the ’u’ and ’v’ directions independently.

For more information on multiplicity, see the Class Description.

< uDeg - the degree of the curve in ’u’

< vDeg - the degree of the curve in ’v’

< uForm - open, closed or periodic in ’u’

< vForm - open, closed or periodic in ’v’

< uNumKnots - the number of knots in the uKnotVector

< vNumKnots - the number of knots in the vKnotVector

< uKnotVector - the sequence of knot values in ’u’

< vKnotVector - the sequence of knot values in ’v’

< uNumControlPts - the number of points in controlPoint in ’u’

< vNumControlPts - the number of points in controlPoint in ’v’

< controlPoints - the array of control points with dimensions controlPoints[uNumControlPts][vNumControlPts][4]

< uMultiplicity - The multiplicity vector in ’u’. This must be of length uNumControlPts

< vMultiplicity - The multiplicity vector in ’v’. This must be of length vNumControlPts

sSuccess - surface was created

sInsufficientMemory - ran out of memory

sAlreadyCreated - the AlSurface has already been created

sInvalidArgument - this return code can be generated in many ways

- number of spans <= 0 either in U or V { if periodic, number of spans = number of control points, if open or closed, number of spans = number of control points - degree. Substitute parameters for either the U or V direction. }
- number of knots != number of spans + 1 in either U or V
- the U or V knot vectors are not a non-decreasing sequence of values
- knots that delimit the first and last spans are non -zero, ie. ( knotVector[1] - knotVector[0] ) and ( knotVector[numKnots-1] - knotVector[numKnots-2] ) are not both zero for either U or V
- if U is closed, the first and last CVs in U are not identical for all V’s
- if V is closed, the first and last CVs in V are not identical for all U’s
- if U is periodic, the number of spans in U is less than 3 or the U degree is greater than the number of spans in U
- if V is periodic, the number of spans in V is less than 3 or the V degree is greater than the number of spans in V

statusCode AlSurface::create(int uDeg,int vDeg,curveFormType uForm,curveFormType vForm,const double uKnotVector[],const double vKnotVector[],int uNumControlPts,int vNumControlPts,const double controlPoints[] )

Used to create the data used to represent a surface. See the AlCurve::create() method for a general description of how NURBS curves are represented with this interface. Surfaces are a natural extension of curves.

Surfaces contain two one-dimensional arrays of knot values called knot vectors for each of the ’u’ and ’v’ parametric directions of the surface. The form and degree of the surface can be different in both the ’u’ and ’v’ direction. The control points are stored in a two-dimensional array of points so there are a total of uNumControlPts * vNumControlPts control points. The ’controlPoints’ parameter must have the dimensions [uNumControlPts][vNumControlPts][4].

This method may be used in the same way as the AlCurve::create() method, and the conditions that must be met by the input data are the same except that the conditions apply to both the ’u’ and ’v’ directions independently.

Note: this method requires that redundant knots be specified.

< uDeg - the degree of the curve in ’u’

< vDeg - the degree of the curve in ’v’

< uForm - open, closed or periodic in ’u’

< vForm - open, closed or periodic in ’v’

< uKnotVector - the sequence of knot values in ’u’. Size of this array is uNumControlPts + uDeg + 1

< vKnotVector - the sequence of knot values in ’v’. Size of this array is vNumControlPts + vDeg + 1

< uNumControlPts - the number of points in controlPoint in ’u’

< vNumControlPts - the number of points in controlPoint in ’v’

< controlPoints - the array of control points with dimensions controlPoints[uNumControlPts][vNumControlPts][4]

sSuccess - surface was created

sInsufficientMemory - ran out of memory

sAlreadyCreated - the AlSurface has already been created

sInvalidArgument - this return code can be generated in many ways

- the number of spans is <= 0 in either U or V { number of spans = number of control points - degree in either U or V. Substitute parameters for either the U or V direction. }
- the U or V knot vectors are not a non-decreasing sequence of values
- the difference between the first ’degree’ { U or V } and difference between the last degree { U or V } number of knots is not 0

for (i = 0; i < deg; i++)

( knotVector[i+1] - knotVector[i] != 0) ||

( knotVector[numKnots-i-1] - knotVector[numKnots-i-2] != 0 )

- for a periodic surface in U or V, the knot deltas for a periodic dimension are not correct. If the knot deltas are correct, the following is true:

For i = 0 to 2*deg-1 (n = numberSpans)

T[i+1] - T[i] = T[i+n+1] - T[i+n]

- if U is closed, the first and last CVs in U are not identical for all points in V
- if V is closed, the first and last CVs in V are not identical for all points in U
- if U is periodic, the number of spans in U is less than 3 or the U degree is greater than the number of spans in U
- if V is periodic, the number of spans in V is less than 3 or the V degree is greater than the number of spans in V
- for a periodic surface in U, the first uDegree number of CVs must match the last uDegree number of CVs for all V dimensions.
- for a periodic surface in V, the first vDegree number of CVs must match the last vDegree number of CVs for all U dimensions

statusCode AlSurface::createRevolvedSurface( const double startPoint[3], const double endPoint[3], double startAngle, double endAngle, const AlCurve* generatrix )

Used to create a surface of revolution instead of the more complex AlSurface::create() method.

Angles are measured in degrees with the generatrix being at zero degrees. As well the angles of rotation are measured counter clockwise while looking in the direction of startPoint from endPoint.

statusCode AlSurface::createRevolvedSurface( double pointOnAxis[3], double direction[3], AlCurve *curve )

statusCode AlSurface::createLinearExtrusionSurface( double direction[3], double len, AlCurve *curve )

statusCode AlSurface::createTorus(const double origin[3], const double direction[3], double majorRadius, double minorRadius, const double zero[3], double rot_start, double rot_end, double arc_start, double arc_end)

statusCode AlSurface::createCylinder( double bottomAxisPoint[3], double topAxisPoint[3], double radius )

statusCode AlSurface::createCone( double bottomAxisPoint[3], double bottomRadius, double topAxisPoint[3], double topRadius )

Create a conical surface from a bottom axis point and its radius and a top axis point and its radius.

curveFormType AlSurface::uForm() const

Returns the form of the surface in the ’u’ direction, that is, kOpen, kClosed or kPeriodic. For more information on form, see the AlSurfaceclass description. kInvalidCurve is returned if the surface is invalid.

curveFormType AlSurface::vForm() const

Returns the form of the surface in the ’v’ direction, that is, kOpen, kClosed or kPeriodic. For more information on form, see the AlSurface class description. kInvalidCurve is returned if the surface is invalid.

statusCode AlSurface::CVsWorldPosition(double CVList[], int uMultiplicity[], int vMultiplicity[] ) const

Returns the world position of this surface’s CVs in the given array and the multiplicity of each CV in the multiplicity vector. The CV array must have the size [uNumberOfCVs * vNumberOfCVs * 4]. The multiplicity vector uMultiplicity must be of length uNumberOfCVs and the vector vMultiplicity must be of length vNumberOfCVs.

Note that the positions returned are [ x y z w ] and not [ w*x w*y w*z w ].

The multiplicity vectors returned by this function are the same as the ones returned by CVsUnaffectedPosition().

statusCode AlSurface::CVsAffectedPosition( const AlTM& tm, double CVList[],int uMultiplicity[],int vMultiplicity[] ) const

Returns the affected position of this surface’s CVs in the given array and the multiplicity of each CV in the multiplicity vector. The CV array must have the size [uNumberOfCVs * vNumberOfCVs * 4]. The multiplicity vector uMultiplicity must be of length uNumberOfCVs and the vector vMultiplicity must be of length vNumberOfCVs. The multiplicity vectors returned by this function are the same as the ones returned by CVsUnaffectedPosition().

statusCode AlSurface::CVsUnaffectedPosition( double CVList[],int uMultiplicity[],int vMultiplicity[] ) const

Returns the unaffected positions of this surface’s CVs in the given array and the multiplicity of each CV in the multiplicity vector. The CV array must have the size [uNumberOfCVs * vNumberOfCVs * 4]. The multiplicity vector uMultiplicity must be of length uNumberOfCVs and the vector vMultiplicity must be of length vNumberOfCVs. The multiplicity vectors returned by this function are the same as the ones returned by CVsWorldPosition().

statusCode AlSurface::setCVsUnaffectedPosition( const double CVList[] )

boolean AlSurface::isConstructionHistoryResultingSurface() const

boolean AlSurface::isPointActive( double u, double v ) const

statusCode AlSurface::area( double& area, boolean worldCoordinates, double tolerance )

Determines the area of the surface.

sSuccess will be returned if the evaluation succeeded. sFailure will be returned if the evaluation failed.

statusCode AlSurface::circumference( double& circumference, boolean worldCoordinates, double tolerance )

Determines the circumference of the surface.

This is a meaningless value for a closed surface but it will be attempted anyway. For example, a sphere has four edges that join at the poles, although it does not have a true circumference.

sSuccess will be returned if the evaluation succeeded. sFailure will be returned if the evaluation failed.

statusCode AlSurface::eval(double u, double v, boolean worldCoordinates, double P[3], double Pu[3], double Pv[3], double n[3], boolean uLimitFromBelow, boolean vLimitFromBelow ) const

Determines the 3D coordinate and partial derivatives of the parameter values on the surface. sSuccess will be returned if the evaluation succeeded. sFailure will be returned if the evaluation failed.

Use isPointActive to determine if the point is in a trim region

uLimitsFromBelow and vLimitsFromBelow are used when determining the normal. These tell which direction limits are used to determine the normal if the gradient is not numerically stable.

< u - the parametric u coordinate of the point on the surface

< v - the parametric v coordinate of the point on the surface

< worldCoordinates - the evaluation is to be in world coordinates

> P - the point on the surface (if not NULL)

> Pu - the partial wrt u of the point on the surface (if not NULL)

> Pv - the partial wrt v of the point on the surface (if not NULL)

> n - the normal to the surface (if not NULL)

< uLimitFromBelow - use u limit from below

< vLimitFromBelow - use v limit from below

statusCode AlSurface::uKnotVector( double knotVector[] ) const

Returns this curve’s knot vector in the given ’knotVector’. The parameter ’knotVector’ must be of length ’uNumberOfKnots()’. This method will only function properly with surfaces with knots piled up on the ends. For surfaces with unpiled end knots use realuKnotVector() instead.

statusCode AlSurface::vKnotVector( double knotVector[] ) const

Returns this curve’s knot vector in the given ’knotVector’. The parameter ’knotVector’ must be of length ’vNumberOfKnots()’. This method will only function properly with surfaces with knots piled up on the ends. For surfaces with unpiled end knots use realvKnotVector() instead.

statusCode AlSurface::setuKnotVector( const double uKnotVector[] )

Sets this curve’s knot vector to the given ’uKnotVector’. The parameter ’knotVector’ must be of length ’uNumberOfKnots()’. If the surface is trimmed this method does nothing. This method will only function properly with surfaces with knots piled up on the ends. For surfaces with unpiled end knots use setRealuKnotVector() instead.

statusCode AlSurface::setvKnotVector( const double vKnotVector[] )

Sets this curve’s knot vector to the given ’vKnotVector’. The parameter ’knotVector’ must be of length ’vNumberOfKnots()’. If the surface is trimmed this method does nothing. This method will only function properly with surfaces with knots piled up on the ends. For surfaces with unpiled end knots use setRealvKnotVector() instead.

int AlSurface::uNumberOfCVsInclMultiples() const

Returns the number of control points in the ’u’ direction (uDegree + uNumberOfSpans). For more information on multiplicity, see the AlSurface class description. This method returns -1 if the surface is invalid.

int AlSurface::vNumberOfCVsInclMultiples() const

Returns the number of control points in the ’v’ direction (vDegree + vNumberOfSpans). For more information on multiplicity, see the AlSurface class description. This method returns -1 if the surface is invalid.

statusCode AlSurface::CVsWorldPositionInclMultiples( double CVList[] ) const

Same as CVsWorldPosition() except that this method includes multiples. The parameter CVList must have dimensions [uNumberOfCVsInclMultiples * vNumberOfCVsInclMultiples * 4]. The surfaceNode must be set or sFailure will be returned For more information on multiplicity, see the AlSurfaceclass description.

NOTE: The data is arranged in the array as cv[u][v][4].

Note that the positions returned are [ x y z w ] and not [ w*x w*y w*z w ].

statusCode AlSurface::CVsAffectedPositionInclMultiples( const AlTM& tm, double CVList[] ) const

Same as CVsAffectedPosition() except that this method includes multiples. The parameter CVList must have dimensions [uNumberOfCVsInclMultiples * vNumberOfCVsInclMultiples * 4]. For more information on multiplicity, see the AlSurface class description.

NOTE: The data is arranged in the array as cv[u][v][4].

Note that the positions returned are [ x y z w ] and not [ w*x w*y w*z w ].

statusCode AlSurface::CVsUnaffectedPositionInclMultiples( double CVList[] ) const

Same as CVsUnaffectedPosition() except that this method includes multiples. The parameter CVList must have dimensions [uNumberOfCVsInclMultiples * vNumberOfCVsInclMultiples * 4]. For more information on multiplicity, see the AlSurface class description. For more information on unaffected position, see the description in the AlSurfaceCV class, method unaffectedPosition().

NOTE: The data is arranged in the array as cv[u][v][4].

statusCode AlSurface::setCVsUnaffectedPositionInclMultiples( const double CVList[] )

Same as setCVsUnaffectedPosition() except that this method includes multiples. The parameter CVList must have dimensions [uNumberOfCVsInclMultiples * vNumberOfCVsInclMultiples * 4]. For more information on multiplicity, see the AlSurface class description. For more information on unaffected position, see the description in the AlSurfaceCV class, method unaffectedPosition(). You cannot give multiples different values. This is best explained in the examples in the AlCurve class description. Some of the values in the given CVList may be ignored, because they specify a redundant point due to multiplicity > 1 or due to periodicity.

NOTE: The data is arranged in the array as cv[u][v][4].

statusCode AlSurface::project( AlCurveNode* curveNode, double vector[3], boolean keep_history )

This method projects a 3D curve along the given vector onto the surface, creating 2D curves on the surface. Several curves can be projected onto the surface which can then be trimmed.

< curveNode - the curve to be projected onto the surface

< vector - the vector to project the curve along

< keep_history - Should the construction history be kept.

sSuccess - successfully projected the curve

sInvalidObject - this surface is not valid

sInvalidArgument - the curve node is not valid, the vector is of zero length, or the surface has no parent surface node

sInsufficientMemory - inadequate memory to run the command

sFailure - failed to project the curve

statusCode AlSurface::unpileEndKnots( int whichEnds, const double interval[] )

NOTE: This operation generates prototype geometry that may not be compatible with all OpenModel or Alias operations. Operations on unpiled surfaces may result in unexpected results including fatal errors. Use unpiled surfaces at your own risk.

Surfaces in Alias have knots that are piled up at the ends so that the surface interpolates the ends. This operation will unpile these knots so that the curve no longer interpolates the ends.

The interval used to space the knots of the unpiled knots will either be taken from the given argument, or if this is NULL the last non-zero knot interval on the given end will be used. All knot intervals must be greater than zero or sInvalidArgument will be returned.

The AlSurface requires an AlSurfaceNode above it for this operation to succeed.

statusCode AlSurface::setRealuKnotVector( const double knotVector[] )

statusCode AlSurface::setRealvKnotVector( const double knotVector[] )

AlShader* AlSurface::nextShader( const AlShader* last_shader ) const

statusCode AlSurface::nextShaderD( AlShader* last_shader ) const

statusCode AlSurface::addCurveOnSurface( AlCurveOnSurface* AlCos )

statusCode AlSurface::removeCurveOnSurface( AlCurveOnSurface* AlCos )

Remove a curve on surface from the list of curves on this surface. It is illegal to attempt to remove a curve on surface from this surface if it is not attached to this surface. It is legal to remove a curve on surface from a surface that is trimmed as long as the curve on surface has not been used for the trimming of the surface.

boolean AlSurface::isDisplayModeSet( AlDisplayModeType mode ) const

statusCode AlSurface::setDisplayMode( AlDisplayModeType mode, boolean on_or_off )

For the given display mode, if the flag is TRUE then the display mode for the surface is set, otherwise it is unset.

The only valid AlDisplayModeTypes for an AlSurface are:

kDisplayGeomHull

kDisplayGeomEditPoints

kDisplayGeomKeyPoints

kDisplayGeomCVs

AlSurface* AlSurface::untrimmedToTrimmedSurface() const

Converts an untrimmed surface to a trimmed surface. NULL is returned if the function fails. The surface is attached to face and therefore may not be separately deleted. A deletion of the face will also force the deletion of the surface. Use the methods in the AlNewTrimRegion class to get trim region information.

statusCode AlSurface::periodicToNonPeriodic( int u, int v )

If a surface is periodic, converts it to a non-periodic surface (closed surface) by making it have multiple end knots in the selected direction (u/v).

Note: This method modifies the surface.

AlCurve* AlSurface::getModelSpaceSurfaceBoundary() const

This method builds and returns the true 3D boundary curve.

This methods builds an edge bspline for each edge of the surface, and appends each of them to the resulting curve. For example, a cylinder would return a singular curve of 4 bsplines: a line, a circle, a line and a circle.

Restrictions:

Edges are numbered counter-clockwise from ne = 0 to 3 where:

- ne=0 at v=v0, ne=1 at u=un,
- ne=2 at v=vn, ne=3 at u=u0

Edges are numbered as follows:

- 0 = edge bspline is u0,v0 to u1,v0
- 1 = edge bspline is u1,v0 to u1,v1
- 2 = edge bspline is u1,v1 to u0,v1
- 3 = edge bspline is u0,v to u0,v0

The surface has multiple end knots in u and v. This method misses a bspline segment when an edge has no length (that is, at a pole).

AlCurve* AlSurface::getParamSpaceSurfaceBoundary() const

This methods builds a parameter space (2D) bspline for each edge of the surface, and appends each of them to the resulting 2D curve.

Edges are numbered counter-clockwise from ne = 0 to 3 where

ne=0 at v=v0,

ne=1 at u=un,

ne=2 at v=vn,

ne=3 at u=u0.

The surface has multiple end knots in u and v. This method builds and returns a singular 2D boundary curve.

AlCurve* AlSurface::localBoundary( int ne ) const

Returns the bspline resulting from an edge of a surface. The function extracts the surface 3D boundary bspline corresponding to the edge number ne (0-3).

NULL is returned if the edge boundary cannot be found.

Edges are numbered counter-clockwise 0 to 3 where:

0 = bottom edge (v = *srf->node0->v)

1 = right edge (u = *srf->noden->u)

2 = top edge (v = *srf->noden->v)

3 = left edge (u = *srf->node0->u)

edge 0 is at v0,

edge 1 is at un,

edge 2 is at un and

edge 3 is at u0.

ne=0 at v=v0,

ne=1 at u=un,

ne=2 at v=vn,

ne=3 at u=u0.

The surface has multiple end knots in u and v. This method handles a bspline segment when an edge has no length (that is, at a pole).

AlCurve* AlSurface::parameterBoundary( int ne ) const

Returns the parameter space bspline of an edge of a surface. NULL is returned if the edge boundary cannot be found. The function extracts the surface 2D boundary bspline corresponding to the edge number ne (0-3).

Edges are numbered counter-clockwise 0 to 3 where:

Edge 0 is at v0, edge 1 is at un, edge 2 is at vn and edge 3 is at u0.

ne=0 at v=v0, ne=1 at u=un, ne=2 at v=vn, ne=3 at u=u0.

The surface has multiple end knots in u and v.

statusCode AlSurface::trim( int count, const double u[], const double v[], boolean keepArea )

This method applies the current curves on the surface to this surface. The surface can be trimmed already.

See the descriptions for AlTrimRegion, AlTrimBoundary, and AlTrimCurve for a description of trim geometry.

The surface must have a surface node for this method to succeed.

A trim selector is a point in the region which is to be kept in the trim. The 'count' value must be greater than 1.

statusCode AlSurface::trim( int count, const AlCurveOnSurface* uvTrimCurves[] )

Applies the passed curves on the surface to this (untrimmed) surface. Each curve on surface must be a closed curve. The first curve in the array must by the outer boundary of a trim region. All other curves in the array are disjoint closed inner boundaries that do not intersect the outer boundary. See the descriptions for AlTrimRegion, AlTrimBoundary, and AlTrimCurve for a description of trim geometry. The surface must have a surface node for this method to succeed.

statusCode AlSurface::projectNormal( AlCurveNode* curveNode, boolean keep_history )

< curveNode - The curve to be projected onto the surface.

< keep_history - Should the construction history be kept.

sSuccess - Successfully projected the curve.

sInvalidObject - This surface is not valid.

sInvalidArgument - The curve node is not valid, the vector is of zero length, or the surface has no parent surface node.

sInsufficientMemory - Inadequate memory to run the command.

sFailure - Failed to project the curve.

{

statusCode AlSurface::uniformRebuild( AlSurfaceNode* &newSurfaceNode, int requested_nu, int requested_nv, boolean inU, boolean inV, boolean matchParameterization )

Approximate this rational surface with a uniform non-rational with a given number of spans. This is a "sample and fit" version of the reduction routine. Trim curves and curves on surface are copied and adjusted to the new surface. The parameters requested_nu/v specify the number of spans that are requested.

If the matchParameterization flag is TRUE, then the reduced surface will be reparameterized to match the same parameter space as the original curve. Otherwise, the curve will be parameterized from 0 to the number of requested spans (in integer increments).

> newSurfaceNode - the rebuilt copy of the surface

< requested_nu - number of requested spans in the u direction

< requested_nv - number of requested spans in the v direction

< inU - rebuild in the U direction

< inV - rebuild in the V direction

< matchParameterization - preserve the parameterization space