AlSurface

Interface to Alias NURBS surface geometry.

Synopsis

#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* );
virtual AlObjectType type() const;
virtual AlSurface* asSurfacePtr();
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;
AlAttributes* firstAttribute() const;
boolean isAffectedByViewFrame() 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 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 );
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 );

Description

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: In V5.0 multifillet operations may be animated. This can cause geometry to be deleted and recreated during a viewframe operation. The method isAffectedByViewFrame() will return TRUE if the viewframe may delete the surface CVs, and FALSE if it will not. See the firstCV() method for additional information.

A NURBS surface is described as having two dimensions, u and v. Many of the surface properties (form, multiplicity, etc.) 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 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.

What is multiplicity?

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.

Example 1:

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:

  1. uNumberOfCVs() will return 4. uNumberOfCVs() will return 4.

  2. CVsWorldPosition must be passed a 4x4x4 CVs matrix, and the u and v multiplicity vectors must each be of length 4.

  3. CVsUnaffectedPosition() must be passed the same as item 2.

  4. setCVsUnaffectedPosition() must be passed the same as item 2.

  5. uNumberOfCVsInclMultiples() will return 6. vNumberOfCvsInclMultiples() will return 5.

  6. CVsWorldPositionInclMultiples() must be passed a 6x5x4 CVs matrix. You will notice that in this matrix there are duplicate CVs to indicate multiples due to mutiplicity > 1 and periodicity.

  7. 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 mutiplicity > 1 and periodicity.

  8. 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.

Example 2:

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:

  1. uNumberOfCVs() will return 4. uNumberOfCVs() will return 4.

  2. CVsWorldPosition must be passed a 4x4x4 CVs matrix, and the u and v multiplicity vectors must each be of length 4.

  3. CVsUnaffectedPosition() must be passed the same as item 2.

  4. setCVsUnaffectedPosition() must be passed the same as item 2.

  5. uNumberOfCVsInclMultiples() will return 7. uNumberOfCVsInclMultiples() will return 4.

  6. CVsWorldPositionInclMultiples() must be passed a 7x4x4 CVs matrix.

  7. CVsUnaffectedPositionInclMultiples() must be passed the same as item 6.

  8. 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] );
}
}

Summary

AlSurface::AlSurface()

Description

Constructs an AlSurface wrapper object.

AlSurface::~AlSurface()

Description

Deletes an AlSurface wrapper object.

AlObject *AlSurface::copyWrapper() const

Description

This method returns an exact duplicate of this AlSurface wrapper.

statusCode AlSurface::deleteObject()

Description

This method deletes the AlSurface, its AlSurfaceCVs, and any AlCurveOnSurface attached to the surface. If this surface has an attached AlSurfaceNode, this node is also deleted.

Return codes

sSuccess - the surface was deleted

sFailure - the surface couldn't be deleted

sInvalidObject - the surface is invalid

AlObjectType AlSurface::type() const

Description

Returns the class identifier kSurfaceType.

AlSurface* AlSurface::asSurfacePtr()

Description

This virtual function returns a non-null pointer to itself, indicating that it is safe to cast to an object of this class.

AlSurfaceNode* AlSurface::surfaceNode() const

Description

Returns a pointer to the AlSurfaceNode for this surface. Returns NULL if there is not attached surface node.

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[] )

Description

This method is used to create the data used to represent a surface. See the AlCurve::create() method in AlCurve for a general desciption 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.

Arguments

< 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.

Return code

sSuccess - surface was created.

sInsufficientMemory - Ran out of memory.

sAlreadyCreated - the AlSurface has already been created

sInvalidArgument - bad parameter passed in

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

Description

This method is used to create the data used to represent a surface. See the AlCurve::create() method for a general desciption 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.

Arguments

< 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].

Return code

sSuccess - surface was created.

sInsufficientMemory - Ran out of memory.

sAlreadyCreated - the AlSurface has already been created

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

Description

This method is used to create a surface of revolution. It is used 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.

Arguments

< startPoint - one end of axis of revolution.

< endPoint - other end of axis of revolution.

< startAngle - the starting angle in degrees

< endAngle - the ending angle in degrees

< generatrix - the curve to be spun about the axis

Return code

sSuccess - the surface was created

sInvalidArgument - a NULL argument was supplied

sInsufficientMemory - Ran out of memory.

sAlreadyCreated - the AlSurface has already been created

curveFormType AlSurface::uForm() const

Description

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

Description

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 desription. kInvalidCurve is returned if the surface is invalid.

int AlSurface::uDegree() const

Description

Returns the degree of the surface in the 'u' direction. -1 is returned if the surface is not valid.

int AlSurface::vDegree() const

Description

Returns the degree of the surface in the 'v' direction. -1 is returned if the surface is not valid.

int AlSurface::uNumberOfSpans() const

Description

Returns the number of spans in the 'u' direction of the surface. If the surface is not valid -1 will be returned.

int AlSurface::vNumberOfSpans() const

Description

Returns the number of spans in the 'v' direction of the surface. If the surface is not valid -1 will be returned.

int AlSurface::uNumberOfCVs() const

Description

Returns the number of CVs in the 'u' direction of the surface. If the surface is not valid -1 will be returned.

int AlSurface::vNumberOfCVs() const

Description

Returns the number of CVs in the 'v' direction of the surface. If the surface is not valid -1 will be returned.

AlSurfaceCV* AlSurface::firstCV() const

Description

Returns a pointer to the first CV in this surface. To traverse the CVs of this surface, use the methods in the AlSurfaceCV class. With the 6.1 release of OpenModel it is no longer necessary to specify whether a permanent pointer is necessary as was done in earlier releases.

AlAttributes* AlSurface::firstAttribute() const

Description

Returns the first attribute on this surface if any, otherwise NULL is returned. Note that if CV positions are modified through any of the AlSurface, AlSurfaceCV, AlCluster, AlSet, etc. methods then the attributes are removed from the surface.

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

Description

Returns the world position of this surface's CVs in the given array and the multiplicity of each CV in the 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().

Arguments

> CVList - contains all the CVs' world positions upon return

> uMultiplicity - contains each CV's multiplicity in u

> vMultiplicity - contains each CV's multiplicity in v

Return codes

sSuccess - the CVs' world positions were retrieved

sInvalidArgument - one of the parameters was NULL

sFailure - the world positions were not retrieved

sInvalidObject - the surface is invalid

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

Description

Returns the affected position of this surface's CVs in the given array and the multiplicity of each CV in the 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().

Arguments

< tm - the transformation matrix generated while walking the dag.

> CVList - contains all the CVs' world positions upon return

> uMultiplicity - contains each CV's multiplicity in u

> vMultiplicity - contains each CV's multiplicity in v

Return codes

sSuccess - the CVs' affected positions were retrieved

sInvalidArgument - one of the parameters was NULL

sFailure - the affected positions were not retrieved

sInvalidObject - the surface is invalid

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

Description

Returns the unaffected positions of this surface's CVs in the given array and the multiplicity of each CV in the 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().

Arguments

> CVList - contains all the CVs' unaffected positions upon return

> uMultiplicity - contains each CV's multiplicity in u

> vMultiplicity - contains each CV's multiplicity in v

Return codes

sSuccess - the CVs' unaffected positions were retrieved

sInvalidArgument - one of the parameters was NULL

sFailure - the unaffected positions were not retrieved

sInvalidObject - the surface is invalid

statusCode AlSurface::doUpdates( boolean newState )

Description

See AlDagNode for info

statusCode AlSurface::insert( double param, Direction dir )

Description

Insert an isoparam into the surface.

Arguments

< param - parametric value of the new isoparam on the surface

< dir - direction of the new isoparam (either kU or kV)

Return codes

sSuccess -normal completion

sInvalidArgument - one of the parameters is out of range

sFailure - an error occurred

sInvalidObject - the surface is invalid

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

Description

Sets the unaffected positions of this surface's CVs to the given array. The passed-in CV array must have the size [uNumberOfCVs * vNumberOfCVs * 4].

Arguments

< CVList - contains all the CVs' unaffected positions upon return

Return codes

sSuccess - the unaffected positions were set

sInvalidArgument - one of the parameters was NULL

sFailure - the unaffected positions were not set

sInvalidObject - the surface is invalid

boolean AlSurface::isAffectedByViewFrame() const

Description

Returns TRUE if a viewframe operation might affect the CVs of this surface due to construction history on multifillets. (In future releases other operations may also affect geometry during a viewframe.)

Return code

TRUE - if viewframe operations might affect the geometry

FALSE - if viewframe operations will not affect the surface or the surface has no AlSurfaceNode.

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

Description

Determines the U,V coordinates of a point on a surface is in a trim region.

Arguments

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

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

Return codes

TRUE - the point is in a trimmed region

FALSE - the point is outside of a trimmed region

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

Description

Determines the area of the surface

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

Arguments

< worldCoordinates - the evaluation is to be in world coordinates

> area - the returned value

> tolerance - the error tolerance

Return codes

sSuccess - the coordinate was successfully determined

sFailure - the evaluation failed

sInvalidObject - the surface is invalid

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

Description

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.

Arguments

< worldCoordinates - the evaluation is to be in world coordinates

> circumference - the returned value

> tolerance - the error tolerance

Return codes

sSuccess - the coordinate was successfully determined

sFailure - the evaluation failed

sInvalidObject - the surface is invalid

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

Description

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.

Arguments

< 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

Return codes

sSuccess - the coordinate was successfully determined

sFailure - the evaluation failed

sInvalidObject - the surface is invalid

int AlSurface::uNumberOfKnots() const

Description

Returns the number of knots in the 'u' direction of the surface. This method will not function properly on surfaces with unpiled end knots. Use realuNumberOfKnots() instead. This method will return -1 if the surface is invalid.

int AlSurface::vNumberOfKnots() const

Description

Returns the number of knots in the 'v' direction of the surface. This method will not function properly on surfaces with unpiled end knots. Use realvNumberOfKnots() instead. This method will return -1 if the surface is invalid.

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

Description

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.

Arguments

> knotVector - vector of length 'uNumberOfKnots()' that contains this curve's knot vector upon return

Return codes

sSuccess - the curve's knot vector was returned

sInvalidArgument - knotVector was NULL

sInvalidObject - the surface was invalid

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

Description

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.

Arguments

> knotVector - vector of length 'vNumberOfKnots()' that contains this curve's knot vector upon return

Return codes

sSuccess - the v knot vector was returned

sInvalidArgument - knotVector was NULL

sFailure - the v knot vector was not returned

sInvalidObject - the surface is invalid

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

Description

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.

Arguments

< uKnotVector - vector of length 'uNumberOfKnots()' to set this curve with

Return codes

sSuccess - the u knot vector was set

sInvalidArgument - knotVector was NULL

sFailure - the u knot vector was not set or the surface is trimmed

sInvalidObject - the surface is invalid

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

Description

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.

Arguments

< vKnotVector - vector of length 'vNumberOfKnots()' to set this curve with

Return codes

sSuccess - the v knot vector was set

sInvalidArgument - knotVector was NULL

sFailure - the v knot vector was not set or the surface is trimmed

sInvalidObject - the surface is invalid

int AlSurface::uNumberOfCVsInclMultiples() const

Description

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

Description

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

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

Description

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 ].

Arguments

> CVList - contains the world positions of all CVs upon return

Return codes

sSuccess - the world positions of all CV was returned

sInvalidArgument - CVList was NULL

sFailure - the world positions of all CVs could not be returned

sInvalidObject - the surface is invalid

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

Description

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 ].

Arguments

< tm - the transformation matrix generated while walking the dag.

> CVList - contains the world positions of all CVs upon return

Return codes

sSuccess - the affected positions of all CVs were returned

sInvalidArgument - CVList was NULL

sFailure - the affected positions of all CVs could not be returned

sInvalidObject - the surface is invalid

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

Description

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].

Arguments

> CVList - contains the unaffected positions of all CV's upon return

Return codes

sSuccess - the unaffected positions of all CVs were returned

sInvalidArgument - CVList was NULL

sFailure - the unaffected positions of all CVs could not be returned

sInvalidObject - the surface is invalid

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

Description

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].

Arguments

< CVList - the new positions to set this surface's CVs to.

Return codes

sSuccess - the unaffected positions of all CVs were set

sInvalidArgument - CVList was NULL

sFailure - the unaffected positions of all CVs could not be set

sInvalidObject - the surface is invalid

boolean AlSurface::isTargetSurface() const

Description

Returns TRUE if the surface is a target surface. If this node does not have a parent Dag node, then it is considered not to be a target surface.

boolean AlSurface::trimmed() const

Description

Returns TRUE if the surface has been trimmed. A target surface (a surface with a curve-on-surface that has never been trimmed) is not considered to be a trimmed surface.

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

Description

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.

Arguments

< 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.

Return codes

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[] )

Description

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.

Arguments

< whichEnds - one or more of AL_UNPILE_START_U, ..., AL_UNPILE_END_V or'ed together

< interval - an array (possibly NULL) of degree - 1 knot intervals.

Return codes

sSuccess - the specified ends were unpiled.

sFailure - the surface is invalid in some way (ex. no CVs.)

sInvalidObject - the surface is invalid

sInvalidArgument - an attempt was made to unpile a periodic surface in the direction of its periodicity.

int AlSurface::realuNumberOfKnots() const

Description

Returns the actual number of u knots on the surface. That is uNumberOfSpans() + 2*uDegree() - 1. (Note that two additional knots are required to define a NURBS curve, but they have no effect on the curve so are not included in this count.) This method returns -1 if the surface is not valid.

int AlSurface::realvNumberOfKnots() const

Description

Returns the actual number of v knots on the surface. That is vNumberOfSpans() + 2*vDegree() - 1. (Note that two additional knots are required to define a NURBS curve, but they have no effect on the curve so are not included in this count.) This method returns -1 if the surface is not valid.

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

Description

Returns realuNumberOfKnots() in 'knotVector' for the u direction of the surface.

Arguments

> knotVector - array to place the knot vector into

Return codes

sSuccess - successfully copied the surface's knot vector into knotVector

sInvalidArgument - knotVector was NULL

sInvalidObject - the surface was invalid

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

Description

Returns realvNumberOfKnots() in 'knotVector' for the v direction of the surface.

Arguments

> knotVector - array to place the knot vector into

Return codes

sSuccess - successfully copied the surface's knot vector into knotVector

sInvalidArgument - knotVector was NULL.

sInvalidObject - the surface was invalid

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

Description

Sets the knots in the u direction for this surface. The parameter 'knotVector' must be of 'realuNumberofKnots()'.

Arguments

< knotVector - array of knots

Return codes

sSuccess - the u knots were successfully set.

sInvalidArgument - knotVector was NULL

sFailure - the surface was trimmed.

sInvalidObject - the surface is invalid

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

Description

Sets the knots in the v direction for this surface. The parameter 'knotVector' must be of 'realvNumberofKnots()'.

Arguments

< knotVector - array of knots

Return codes

sSuccess - the v knots were successfully set.

sInvalidArgument - knotVector was NULL

sFailure - the surface was trimmed.

sInvalidObject - the surface is invalid

AlShader* AlSurface::firstShader() const

Description

Returns the first shader that this surface object references. Returns NULL if there are no shaders.

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

Description

Returns the shader after the given shader in the object's shader list. Returns NULL if there isn't a next shader. Specifying NULL as parameter will return the first shader.

Arguments

< last_shader - Shader from which to walk forward

statusCode AlSurface::nextShaderD( AlShader* last_shader ) const

Description

Destructively points 'last_shader' to the shader after the given shader in the object's shader list.

Arguments

< last_shader - Shader from which to walk forward

Return codes

sSuccess - last_shader now points to the next shader

sFailure - if there isn't a next shader.

sInvalidArgument - if last_shader is invalid

sInvalidObject - the surface is invalid

statusCode AlSurface::assignShader( AlShader* shader )

Description

Assigns the given shader to the surface. If the surface already has shaders they will be removed from the surface. The surface must have a surface node for this method to succeed.

Arguments

< shader - The shader which will be assigned to the surface.

Return codes

sSuccess - the shader was successfully assigned to the surface.

sInvalidArgument - 'shader' was invalid

sFailure - the shader was not created.

sInvalidObject - the surface is invalid

statusCode AlSurface::layerShader( AlShader* shader )

Description

Layers the given shader on the surface. The surface must have a surface node for this method to succeed.

Arguments

< shader - The shader which will be layered on the surface.

Return codes

sSuccess - the shader was successfully layered on the surface.

sInvalidArgument - 'shader' was invalid

sFailure - the shader was not created.

sInvalidObject - the surface is invalid

statusCode AlSurface::renderInfo( AlRenderInfo &renderInfo ) const

Description

Fills in the renderInfo structure with the render info for this surface.

Arguments

> renderInfo - the structure to fill in.

Return codes

sSuccess - if getting the render information was successful.

sInvalidArgument - if 'renderInfo' is NULL

sFailure - if there wasn't any render information (renderInfo is unchanged).

sInvalidObject - the surface is invalid

statusCode AlSurface::setRenderInfo( const AlRenderInfo &renderInfo ) const

Description

Sets the render info for this surface to the contents of the renderInfo structure.

Arguments

< renderInfo - the structure to take the render information from.

Return codes

sSuccess - if setting the render information was successful.

sInvalidArgument - 'renderInfo' was NULL or a parameter in 'renderInfo' was out of range

sFailure - if setting the render information failed.

sInvalidObject - the surface is invalid

AlCurveOnSurface* AlSurface::firstCurveOnSurface() const

Description

Returns the first curve on surface from the list of curves on this surface. Access the remainder of the curves on surfaces in the list with AlCurveOnSurface methods. This method returns NULL if there aren't any curves on this surface.

statusCode AlSurface::addCurveOnSurface( AlCurveOnSurface* AlCos )

Description

Add a curve on surface to the list of curves on this surface. It is illegal to add a curve on surface that is already attached to another surface. It is also illegal to add a curve on surface to a surface that has been trimmed (ie. in trim). The surface must be attached to a surfaceNode or this routine will fail.

Arguments

< AlCos - the curve-on-surface to add to the surface

Return codes

sSuccess - the curve was added

sInvalidArgument - AlCos was invalid

sFailure - the surface is trimmed

sInvalidObject - the surface is invalid

statusCode AlSurface::removeCurveOnSurface( AlCurveOnSurface* AlCos )

Description

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 also illegal to remove a curve on surface from a surface that is trimmed.

Arguments

< AlCos - the curve on surface to remove

Return codes

sSuccess - the CoS was removed

sInvalidArgument - AlCos was invalid

sFailure - the Curve on surface could not be removed

sInvalidObject - the surface is invalid

boolean AlSurface::isDisplayModeSet( AlDisplayModeType mode ) const

Description

Returns TRUE if the specified display mode is toggled on for the surface. Returns FALSE otherwise.

The only valid AlDisplayModeTypes for an AlSurface are

kDisplayGeomHull

kDisplayGeomEditPoints

kDisplayGeomKeyPoints

kDisplayGeomCVs

Arguments

< mode - display mode of interest.

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

Description

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

Arguments

< mode - display mode of interest.

< on_or_off - TRUE means that this surface will have the display mode set. FALSE means it will be unset.

Return values

sSuccess - if this operation was successful.

sFailure - if unable to complete this operation

sInvalidArgument - invalid display type.

sInvalidObject - the surface is invalid

AlTrimRegion* AlSurface::firstTrimRegion() const

Description

Returns the first trim region of a list if the surface has been trimmed. Returns NULL if there is no such trim region. Use the methods in the AlNewTrimRegion class to get trim region information.

AlSurface* AlSurface::untrimmedToTrimmedSurface() const

Description

This method is used to convert 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.

AlTrimRegion* AlSurface::trimSurfaceToRegion() const

Description

This method is used to convert a trim surface to a trim region. NULL is returned on failure. The surface is attached to face and therefore may not be separately deleted. A deletion of the face will also force a deletion of the surface. Use the methods in the AlNewTrimRegion class to get trim region information.

AlCurve* AlSurface::getModelSpaceSurfaceBoundary() const

Description

Returns the curve resulting from all of the edges of a surface.

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 misses a bspline segment when an edge has no length (i.e. at a pole). This method builds and returns the true 3D boundary curve. For example, a cylinder would return a curve of 4 bsplines. a line, a circle, a line and a circle.

AlCurve* AlSurface::getParamSpaceSurfaceBoundary() const

Description

Returns the parameter space curve of the edges of a surface.

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 the 2D boundary curve.

AlCurve* AlSurface::localBoundary( int ne ) const

Description

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

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 (i.e. at a pole).

AlCurve* AlSurface::parameterBoundary( int ne ) const

Description

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 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 builds and returns the 2D boundary curve.

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

Description

This method applies the current curves on the surface to this (untrimmed) surface. 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.

Arguments

< count - number of (u,v) trim selectors

< u,v - an array of u,v coordinates marking regions inside the trim to keep

Return code

sSuccess - the trim region was successfully applied to the surface.

sAlreadyTrimmed - the surface is already trimmed.

sInvalidArgument - one of the parameters is NULL or out of range

sFailure - the trim operation failed

sInvalidObject - the surface is invalid

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

Description

This method 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.

Arguments

< count - number of AlCurveOnSurface curves (must be > 0)

< uvTrimCurves - an array of closed AlCurveOnSurfaces that defines one trimmed region.

Return code

sSuccess - a trim region was successfully created.

sInvalidArgument - one of the parameters is NULL or out of range

sFailure - the trim operation failed

sInvalidObject - the surface is invalid

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

Description

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).

Arguments

> newSurface - 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

Return code

sSuccess - the surface was successfully rebuilt.

sFailure - the rebuild operation failed

sInvalidObject - the surface is invalid

sInvalidArgument - both inU and inV were FALSE;





aliasdocs@aw.sgi.com
Copyright © 1996, Alias|Wavefront, a Silicon Graphics Company. All rights reserved.