AlCurveCV
 
 
 

Encapsulates methods common to curve CVs.

Synopsis

#include <AlCurveCV.h>
class AlCurveCV : public AlObject, public AlClusterable, public AlAnimatable, public AlSettable, public AlPickable
virtual	~AlCurveCV();
virtual AlObject*	copyWrapper() const;
AlObjectType	type() const;
AlCurveCV*	next() const;
AlCurveCV*	prev() const;
statusCode	nextD();
statusCode	prevD();
int	index() const;
int	multiplicity() 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 );
statusCode	setWorldPosition( double, double, double, boolean );
statusCode	setWorldPosition( double, double, double, AlTM );
statusCode	setUnaffectedPosition( double, double, double, double );
AlCurve*	curve() const;
statusCode	blindData( int, long&, const char *& );
statusCode setBlindData( int, long, const char * );
statusCode removeBlindData( int );
statusCode	doUpdates( boolean newState = TRUE );

Description

AlCurveCV is the class used to access and manipulate curve CVs (also referred to as Control Points). There is one AlCurveCV object for each CV of an AlCurve as you see it in the interactive Alias package. You cannot create or delete an AlCurveCV. AlCurveCVs are only created through AlCurves.

There are methods to query and set the multiplicity of a CV, and methods 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.

To print out all CVs of a curve:

 AlCurve     curve;      AlCurveCV  *cvPtr;      int         i = 0;      double      x, y, z, w;           if ( cvPtr = curve->firstCV() )      {          do {              cvPtr->worldPosition( x, y, z, w );              printf("CV %d is at %G, %G, %G with weight %G.\n", i, x, y, z, w );              i++;          } while( cvPtr->nextD() == sSuccess );      }      delete cvPtr;           Example Result: CV 1 is at 0.0, 1.0, 0.0 with weight 1.0 CV 2 is at 0.0, 2.0, 0.0 with weight 1.0               CV 3 is at 0.0, 3.0, 0.0 with weight 1.0               CV 4 is at 0.0, 4.0, 0.0 with weight 1.0

Multiplicity

When an AlCurveCV has a multiplicity > 1, CVs are internally piled up at that position. In this case, an AlCurveCV actually represents more than one CV internally. To access ALL CVs, use the methods in the AlCurve class to query values "including multiplicity", or use the example code below. By representing AlCurveCVs this way, then if an AlCurveCV is moved, the corresponding multiple CVs at that position are moved as well, acting exactly like the Alias interactive package.

For example, to print all internal CVs of a curve with 4 AlCurveCV’s where the second AlCurveCV has multiplicity = 2, you would do this:

 AlCurve curve;      AlCurveCV *cvPtr;      int i,j = 0; double x, y, z, w;           if ( cvPtr = curve->firstCV() ) {          do {              for( j = 0; j <= cvPtr->multiplicity(); j++, i++ )              {                  cvPtr->worldPosition( x, y, z, w );                  printf("CV %d is at %G, %G, %G with weight %G.\n", i, x, y, z, w );              }              i++; } while( cvPtr->nextD() == sSuccess );      }      delete cvPtr;                Example Result:               CV 1 is at 0.0, 1.0, 0.0 with weight 1.0               CV 2 is at 0.0, 2.0, 0.0 with weight 1.0               CV 3 is at 0.0, 2.0, 0.0 with weight 1.0               CV 4 is at 0.0, 3.0, 0.0 with weight 1.0 CV 5 is at 0.0, 4.0, 0.0 with weight 1.0

Creation

Note that certain routines require that the given CV be installed in the DAG (that is, that the curve belongs to a AlCurveNode). If any of these are called on a CV that is not part of the DAG, they will simply fail.

Routines that require the CV to be in the DAG:

next nextD worldPosition setMultiplicity setUnaffectedPosition setWorldPosition

AlCurveCV::~AlCurveCV()

Description

Deletes an AlCurveCV wrapper object.

AlObject* AlCurveCV::copyWrapper() const

Description

Makes an exact copy of this AlCurveCV wrapper.

AlObjectType AlCurveCV::type() const

Description

Returns the class identifier ’kCurveCVType’.

AlCurveCV *AlCurveCV::asCurveCVPtr()

Description

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

int AlCurveCV::index() const

Description

Returns the index of this CV. Returns -1 if the index could not be found. The index of the first CV is 0.

AlCurveCV* AlCurveCV::next() const

Description

Returns a pointer to the next AlCurveCV. Otherwise, returns NULL if there is no next curve CV, or if this CV is not in the DAG.

statusCode AlCurveCV::nextD()

Description

Destructively points the current wrapper to the next CV in the curve. This call will also fail if the CV is not in the DAG.

Return Codes

sSuccess - the wrapper now points to the next CV in the curve

sInvalidObject - the curve CV was invalid

sFailure - there is no next CV in the curve

AlCurveCV* AlCurveCV::prev() const

Description

Returns a pointer to the previous AlCurveCV. Otherwise, returns NULL if there is no previous curve CV.

statusCode AlCurveCV::prevD()

Description

Destructively points the current wrapper to the previous CV in the curve.

Return Codes

sSuccess - the wrapper now points to the previous CV in the curve

sInvalidObject - the curve CV was invalid

sFailure - there is no previous CV in the curve

int AlCurveCV::multiplicity() const

Description

Returns the multiplicity of this curve CV. The returned value is 1, 2 or 3, unless the call fails, in which case it is 0.

statusCode AlCurveCV::worldPosition( double &x, double &y,double &z, double &weight ) const

Description

Returns the position of this curve CV in world space. This position includes the transformations of all DAG nodes above this curve and the effects of all clusters.

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

Arguments

> x - the world position in the x direction

> y - the world position in the y direction

> z - the world position in the z direction

> weight - homogeneous coordinate

Return Codes

sSuccess - the position of this curve CV in world space was returned

sInvalidObject - the CV was invalid

sFailure - the CV is not created or not in the world

statusCode AlCurveCV::affectedPosition( const AlTM& tm, double &x, double &y,double &z, double &weight ) const

Description

Returns the position of this curve CV adjusted by the AlTM.

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

Arguments

< tm - the transformation matrix which is built traversing the DAG

> x - the world position in the x direction

> y - the world position in the y direction

> z - the world position in the z direction

> weight - homogeneous coordinate

Return Codes

sSuccess - the position of this curve CV was returned

sInvalidObject - the CV is not created or not in the world

statusCode AlCurveCV::unaffectedPosition( double &x, double &y,double &z, double &weight ) const

Description

Returns the position of this curve 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 curve applied to it AND the transformations of all affecting clusters applied to it (in proportion).

Arguments

> x - the unaffected position in the x direction

> y - the unaffected position in the y direction

> z - the unaffected position in the z direction

> weight - homogeneous coordinate

Return Codes

sSuccess - the position of this curve CV was returned

sInvalidObject - the CV was invalid

sFailure - the CV is not created or not in the world

statusCode AlCurveCV::setMultiplicity( int newMultiplicity )

Description

Sets the multiplicity of this curve CV to the given multiplicity. The new multiplicity must be 1, 2, or 3.

Arguments

< int newMultiplicity - the multiplicity to set this AlCurveCV to

Return Codes

sSuccess - the multiplicity was set

sInvalidArgument - the multiplicity was not 1, 2 or 3

sInvalidObject - the CV was invalid

sInsufficientMemory - there is not enough memory to allocate a new block

sFailure - the CV is not created or is not in the world

statusCode AlCurveCV::doUpdates( boolean newState )

Description

See AlDagNode for information.

statusCode AlCurveCV::setWorldPosition( double x, double y, double z, boolean includeWorld )

Description

Sets the world position of the CV. The CV may also be in a cluster.

Arguments

< x - the new unaffected position in the x direction

< y - the new unaffected position in the y direction

< z - the new unaffected position in the z direction

< includeWorld - include world transformation in move

Return Codes

sSuccess - the position of this curve CV was set

sInvalidObject - the CV was not valid

sFailure - the CV is not created or not in the world. The move could not be done.

statusCode AlCurveCV::setWorldPosition( double x, double y, double z, AlTM tm )

Description

Sets the world position of the CV. The CV may also 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

< x - the new unaffected position in the x direction

< y - the new unaffected position in the y direction

< z - the new unaffected position in the z direction

< tm - user’s transformation matrix

Return Codes

sSuccess - the position of this curve CV was set

sInvalidObject - the CV was not valid

sFailure - the CV is not created or not in the world. The move could not be done.

statusCode AlCurveCV::setUnaffectedPosition( double x, double y,double z, double weight )

Description

Sets the unaffected position of a curve CV.

Arguments

< x - the new unaffected position in the x direction

< y - the new unaffected position in the y direction

< z - the new unaffected position in the z direction

< weight - homogeneous coordinate

Return Codes

sSuccess - the position of this curve CV was set

sInvalidObject - the CV was not valid

sFailure - the CV is not created or not in the world

AlCurve* AlCurveCV::curve() const

Description

Returns a pointer to the AlCurve that this curve CV belongs to.

statusCode AlCurveCV::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 must be 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 returned

sInvalidObject - the curveCV was invalid

statusCode AlCurveCV::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 - create has not been called on this object yet

statusCode AlCurveCV::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