Encapsulates methods common to curve CVs.
#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 );
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
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
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
statusCode AlCurveCV::worldPosition( double &x, double &y,double &z, double &weight ) const
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 ].
statusCode AlCurveCV::affectedPosition( const AlTM& tm, double &x, double &y,double &z, double &weight ) const
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 ].
statusCode AlCurveCV::unaffectedPosition( double &x, double &y,double &z, double &weight ) const
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).
statusCode AlCurveCV::setMultiplicity( int newMultiplicity )
statusCode AlCurveCV::setWorldPosition( double x, double y, double z, boolean includeWorld )
statusCode AlCurveCV::setWorldPosition( double x, double y, double z, AlTM tm )
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.
statusCode AlCurveCV::setUnaffectedPosition( double x, double y,double z, double weight )
statusCode AlCurveCV::blindData( int user_type, long& size, const char *& data )
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.
statusCode AlCurveCV::setBlindData( int user_type, long size, const char * data )
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.