Basic interface to Alias action.
#include <AlAction.h>
class AlAction : public AlObject
virtual ~AlAction();
virtual statusCode deleteObject();
virtual AlObjectType type() const;
virtual const char* name() const;
virtual statusCode setName(const char *);
const char* comment() const;
AlActionExtrapType extrapTypePRE() const;
AlActionExtrapType extrapTypePOST() const;
statusCode setComment(const char *);
statusCode setExtrapTypePRE(AlActionExtrapType);
statusCode setExtrapTypePOST(AlActionExtrapType);
AlAction* copy() const;
statusCode copyD();
double eval( double, AlTripleComponent = kX_COMPONENT ) const;
int numChannelReferences() const;
AlChannel* channelReference(const int) const;
AlAction is the base class for an Alias action. An action is an entity that will map time to a value. In Alias, there are two types of actions: parameter curve actions, represented by the derived class AlParamAction, and motion path actions, represented by the derived class AlMotionAction.
You can create new AlActions by creating an AlParamAction or an AlMotionAction. Existing actions can be accessed either through the global list of actions (AlUniverse::firstAction(), AlUniverse::nextAction()) or through the list of actions that a channel uses to animate a field of an item (AlChannel::appliedAction()). If you delete an action, it may cause other classes to be deleted (for example, AlKeyframe, and AlChannel if the action was the base action of a channel).
statusCode AlAction::setExtrapTypePRE(AlActionExtrapType extrapType)
statusCode AlAction::setExtrapTypePOST(AlActionExtrapType extrapType)
double AlAction::eval( double time, AlTripleComponent compo ) const
Evaluates this action at the given time, and returns the value of the action at that time. If the action is an AlMotionAction, then you must specify which component of the resulting (x,y,z) value to retrieve using the optional second argument. If the action is not valid, 0.0 is returned.
Evaluation of an AlParamAction is as follows
An animation parameter curve is a "Poon-Ross" spline (developed by Angus Poon and Dave Ross). This spline is basically a Hermite-linear spline. That is, it is a Hermite in y (the vertical axis) and a linear in x (the horizontal axis). If we call this spline C(t) = (x(t), y(t)), then we see that it is fairly straightforward to compute for the case when x = T since x(t) = t. So we would get C(t) for x = T is (T, y(T)). To compute a point on a curve segment C(t) (which is bounded by the CVs (t1, y1), (t2, y2) and has tangents m1 and m2 at the start and end of the segment) at t = T, we first make the mapping
T’ = (T - t1) / (t2 - t1)
so that t is in the range [0, 1]. We then get the y value off of the curve segment using the standard computation
C(T) = [T’^3 T’^2 T’ 1] * H * | y1 | | y2 | | m1 | | m2 |
where H is the hermite basis matrix.
double AlChannel::sample( void ) const
Samples the channel without actually evaluating it. The value of the current parameter is read without any updates being done. The channel is sampled at the current time. This method is faster than eval(), and is useful in cases where eval() has already been called, either explicitly or through a viewFrame operation.
If this method succeeds, it returns the value of the channel at the current frame. If it fails, 0.0 is returned.