Encapsulates methods common to surface CVs.
Synopsis
#include <AlSurfaceCV.h>
class AlSurfaceCV : public AlObject , public AlClusterable , public AlAnimatable , public AlSettable , public AlPickable
virtual ~AlSurfaceCV();
virtual AlObject* copyWrapper() const;
AlObjectType type() const;
int uIndex() const;
int vIndex() const;
AlSurfaceCV* nextInU() const;
AlSurfaceCV* nextInV() const;
AlSurfaceCV* prevInU() const;
AlSurfaceCV* prevInV() const;
statusCode nextInUD();
statusCode nextInVD();
statusCode prevInUD();
statusCode prevInVD();
int multiplicityInU() const;
int multiplicityInV() const;
statusCode worldPosition( double&, double&, double&, double& ) const;
statusCode affectedPosition( const AlTM&, double&, double&, double&, double& ) const;
statusCode unaffectedPosition( double&, double&, double&, double& ) const;
statusCode setMultiplicity( int, int );
statusCode setWorldPosition( double, double, double, boolean );
statusCode setWorldPosition( double, double, double, AlTM );
statusCode setUnaffectedPosition( double, double, double, double );
AlSurface* surface() const;
statusCode blindData( int, long&, const char *& );
statusCode setBlindData( int, long, const char * );
statusCode removeBlindData( int );
statusCode applyIteratorToCVsInU( AlIterator* iter, int &rc );
statusCode applyIteratorToCVsInV( AlIterator* iter, int &rc );
statusCode doUpdates( boolean newState = TRUE );
Description
AlSurfaceCV is the class used to access and manipulate surface CVs (also referred to as Control Points). There is one AlSurfaceCV
object for each CV of an AlSurface as you see it in the interactive Alias package. You cannot create or delete an AlSurfaceCV. AlSurfaceCVs are only created through AlSurfaces.
There are methods to query and set the multiplicity of a CV, and method to query the world position and the "unaffected" position
of a CV. The "unaffected" position of a CV is its position BEFORE any transformations (from its parent DAG node or from affecting
clusters) have been applied to it. There is also a method to access the clusters that affect a CV. Methods setWorldPosition
are used for setting either the unaffected or affected(clusters) position of a CV.
For more information on CVs please see AlCurveCV.
AlSurfaceCV::~AlSurfaceCV()
Description
Deletes an AlSurfaceCV wrapper object.
AlObject* AlSurfaceCV::copyWrapper() const
Description
Returns an exact duplicate of this AlSurfaceCV wrapper.
AlObjectType AlSurfaceCV::type() const
Description
Returns the class identifier ’kSurfaceCVType’.
int AlSurfaceCV::uIndex() const
Description
Returns the index of this CV in the 'u' direction. Returns -1 if the CV is not valid. The indices of the first CV are (0,0).
int AlSurfaceCV::vIndex() const
Description
Returns the index of this CV in the 'v' direction. Returns -1 if the CV is not valid. The indices of the first CV are (0,0).
AlSurfaceCV* AlSurfaceCV::nextInU() const
Description
Returns a pointer to the next AlSurfaceCV in the u direction. Otherwise, returns NULL if there is no next surface CV or the
CV is inactive.
statusCode AlSurfaceCV::nextInUD()
Description
Destructively points this wrapper to the next AlSurfaceCV in the u direction.
Return Codes
sSuccess - the wrapper points to the next CV
sFailure - there is no next CV
sInvalidObject - the CV is invalid/inaction
AlSurfaceCV* AlSurfaceCV::nextInV() const
Description
Returns a pointer to the next AlSurfaceCV in the v direction. Otherwise, returns NULL if there is no next surface CV or the
CV is inactive.
statusCode AlSurfaceCV::nextInVD()
Description
Destructively points the wrapper to the next AlSurfaceCV in the v direction.
Return Codes
sSuccess - the wrapper points to the next CV
sFailure - there is no next CV
sInvalidObject - the CV is inactive/invalid
AlSurfaceCV* AlSurfaceCV::prevInU() const
Description
Returns a pointer to the previous AlSurfaceCV in the u direction. Otherwise, returns NULL if there is no previous surface
CV or the CV is inactive.
statusCode AlSurfaceCV::prevInUD()
Description
Destructively points the wrapper to the previous AlSurfaceCV in the u direction.
Return Codes
sSuccess - the wrapper points to the previous CV
sFailure - there is no previous CV
sInvalidObject - the CV is inactive / invalid
AlSurfaceCV* AlSurfaceCV::prevInV() const
Description
Returns a pointer to the previous AlSurfaceCV in the v direction. Otherwise, returns NULL if there is no previous surface
CV or the CV is inactive.
statusCode AlSurfaceCV::prevInVD()
Description
Destructively points the wrapper to the previous AlSurfaceCV in the v direction.
Return Codes
sSuccess - the wrapper points to the previous CV
sFailure - there is no previous CV
sInvalidObject - the CV is inactive / invalid
int AlSurfaceCV::multiplicityInU() const
Description
Returns the multiplicity of this surface CV in the u direction. The returned value is always 1, 2 or 3. -1 is returned if
the surfaceCV is invalid.
int AlSurfaceCV::multiplicityInV() const
Description
Returns the multiplicity of this surface CV in the v direction. The returned value is always 1, 2 or 3. -1 is returned if
the surfaceCV is invalid.
statusCode AlSurfaceCV::worldPosition( double &x, double &y,double &z, double &w) const
Description
Returns the position of this surface CV in world space. This position includes the transformations of all DAG nodes above
this surface and the effects of all clusters.
Note that the position returned is [ x y z w ] and not [ w*x w*y w*z w ].
If the surface CV is no longer active no position is returned.
Arguments
> double &x - the world position in the x direction
> double &y - the world position in the y direction
> double &z - the world position in the z direction
> double &w - homogeneous coordinate
Return Codes
sSuccess - the world position was retrieved
sInvalidObject - the object was invalid
sFailure - the surface CV is no longer active
statusCode AlSurfaceCV::affectedPosition( const AlTM& tm, double &x, double &y,double &z, double &w) const
Description
Returns the position of this surface CV modified by the AlTM.
Note that the position returned is [ x y z w ] and not [ w*x w*y w*z w ].
If the surface CV is no longer active no position is returned.
Arguments
< AlTM& tm - the transformation matrix generated while walking the DAG
> double &x - the world position in the x direction
> double &y - the world position in the y direction
> double &z - the world position in the z direction
> double &w - homogeneous coordinate
Return Codes
sSuccess - the affected position was retrieved
sInvalidObject - the object was invalid
statusCode AlSurfaceCV::unaffectedPosition( double &x, double &y,double &z, double &w ) const
Description
Returns the position of this surface CV PRIOR TO ANY TRANSFORMATIONS (hence "unaffected").
How are the unaffected position and world position related? The world position is the unaffected position with the inclusive
transformation of all DAG nodes above this surface applied to it AND the transformations of all affecting clusters applied
to it (in proportion).
If the surface CV is no longer active no position is returned.
Arguments
> double &x - the unaffected position in the x direction
> double &y - the unaffected position in the y direction
> double &z - the unaffected position in the z direction
> double &w - homogeneous coordinate
Return Codes
sSuccess - the unaffected position was retrieved
sInvalidObject - the object was invalid
statusCode AlSurfaceCV::setMultiplicity( int u, int v )
Description
Sets the multiplicity of this surface CV to the given multiplicity. The new multiplicity must be 1, 2, or 3. You cannot change
the multiplicity of a corner CV of a surface that is open in either the u or v direction.
Arguments
< int u - the new multiplicity in the u direction
< int v - the new multiplicity in the v direction
Return Codes
sSuccess - the multiplicity has been properly set
sInvalidObject - the surface CV is no longer active / valid
sInsufficientMemory - not enough memory
sInvalidArgument - the multiplicities must be 1, 2 or 3
sFailure - the surface CV is no longer active
statusCode AlSurfaceCV::doUpdates( boolean newState )
statusCode AlSurfaceCV::setWorldPosition( double x, double y, double z, boolean includeWorld )
Description
Sets the world position of the CV. The CV may be in a cluster.
Arguments
< double x - the new unaffected position in the x direction
< double y - the new unaffected position in the y direction
< double z - the new unaffected position in the z direction
< boolean includeWorld - include world transformation in move
Return Codes
sSuccess - the position was properly set
sFailure - the move could not be done
sInvalidObject - the CV is invalid / inactive
statusCode AlSurfaceCV::setWorldPosition( double x, double y, double z, AlTM tm )
Description
Sets the world position of the CV. The CV may be in a cluster. Note that this method uses the inverse of the transformation
matrix that is passed in so that the calling routine does not need to generate it.
Arguments
< double x - the new unaffected position in the x direction
< double y - the new unaffected position in the y direction
< double z - the new unaffected position in the z direction
< AlTM tm - user’s transformation matrix
Return Codes
sSuccess - the position was properly set
sFailure - the move could not be done
sInvalidObject - the CV is invalid / inactive
statusCode AlSurfaceCV::setUnaffectedPosition( double x, double y,double z, double w )
Description
Sets the unaffected position of the CV.
Arguments
< double x - the new unaffected position in the x direction
< double y - the new unaffected position in the y direction
< double z - the new unaffected position in the z direction
< double w - homogeneous coordinate
Return Codes
sSuccess - the position was properly set
sFailure - the surface CV is no longer active
sInvalidObject - the CV is invalid / inactive
AlSurface* AlSurfaceCV::surface() const
Description
Returns a pointer to the AlSurface that this surface CV belongs to or NULL if the surface CV is no longer valid.
statusCode AlSurfaceCV::blindData( int user_type, long& size, const char *& data )
Description
Obtains the size and address of a block of data associated with the object. If there is no data, then the size will be zero
and the address of the data is NULL. User_types between 0 and 13099 are reserved. If you would like to reserve a block of
"user_types" please contact us.
Arguments
< user_type - user type of the data desired
> size - number of characters in the block of data
> data - address of the block of data
Return Codes
sSuccess - the blind data was retrieved
sInvalidObject - the object was invalid
statusCode AlSurfaceCV::setBlindData( int user_type, long size, const char * data )
Description
Associates a block of data with the object. If a block of data is already associated with this object and this user_type,
the old block is replaced by a reference to the new block. The old block of data is not deleted.
Arguments
< user_type - user type of the blind data desired
< size - number of characters in the block
< data - address of the block of data
Return Codes
sSuccess - operation was successful
sInsufficientMemory - not enough memory to allocate a new block
sInvalidObject - the CV is invalid
statusCode AlSurfaceCV::removeBlindData( int user_type )
Description
Removes the block of data of the given type from the object. Note that the user is still responsible for the memory associated
with this block of data.
Arguments
< user_type - user type of the blind desired
Return Codes
sSuccess - operation was successful
sFailure - no such blind data existed sInvalidObject - the given object is not valid
statusCode AlSurfaceCV::applyIteratorToCVsInU( AlIterator* iter, int &rc )
Description
Starting at this CV, apply the iterator to all CVs in the surface in the U direction. This iterator can be combined with the
applyIteratorToCVsInV iterator to create a ’superiterator’ that iterates over all CVs in the surface.
class iterV : public AlIterator {
public:
iterV( AlIterator* inIter ) : iter( inIter ) {};
virutal int func( AlObject* obj )
{
int rc;
if( sSuccess == obj->asSurfaceCVPtr()->applyIteratorToCVsInU( iter, rc ) )
return rc;
else
return -1;
}
private:
AlIterator* iter;
}
....
statusCode applyIteratorToSurfaceCVs( AlSurface *surf, AlIterator* iter, int &rc )
{
if( !iter || !surf )
return sInvalidArgument;
iterV doV( iter );
AlSurfaceCV* cv = surface->firstCV();
statusCode stat = cv->applyIteratorToCVsInV( &doV, rc );
delete cv;
return stat;
}
See the documentation for AlIterator.
Arguments
< iter - the iterator to apply to each CV
> rc - the result of the last application of the iterator
Return Codes
sSuccess - the iterator exited normally
sFailure - the iterator exited abnormally
sInvalidArgument - the iterator ’iter’ was NULL
sInvalidObject - the curve was not valid
statusCode AlSurfaceCV::applyIteratorToCVsInV( AlIterator* iter, int &rc )
Description
Starting at this CV, apply the iterator to all CVs in the surface in the V direction. See the documentation for AlIterator.
Arguments
< iter - the iterator to apply to each CV
> rc - the result of the last application of the iterator
Return Codes
sSuccess - the iterator exited normally
sFailure - the iterator exited abnormally
sInvalidArgument - the iterator ’iter’ was NULL
sInvalidObject - the iterator was not valid