HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_AIFMath Class Reference

Attribute Interface class to perform numeric operations on attributes. More...

#include <GA_AIFMath.h>

+ Inheritance diagram for GA_AIFMath:

Public Member Functions

 GA_AIFMath ()
 
virtual ~GA_AIFMath ()
 

Static Public Member Functions

static const GA_AIFMathgetNoMath ()
 

Detailed Description

Attribute Interface class to perform numeric operations on attributes.

This class provides the interface to perform numerical operations on attribute data. Each attribute type may provide this interface if it makes sense.
Basic mathematicl operations.

  • madd(d, a, b)
    d = d + a*b
  • scaleoffset(d, s, o)
    d = d*s + o
  • add(d, a, b)
    d = a + b
  • mul(d, a, b)
    d = a * b
  • sub(d, a, b)
    d = a - b
  • div(d, a, b)
    d = a / b

Common mathematical operations

Matrix Operations

  • rowVecMult
  • rowVecMult
  • rowVecMult3
  • colVecMult
  • colVecMult
  • colVecMult3

Signatures
When performing operations on attributes, there are different variable types.

  • A constant value (scalar or tuple)
  • A single element of the attribute array (specified by an offset)
  • A selection of the attribute array (specified by an iterator) Operations are defined as the permutations of all these different variable types. The destination (LHS) must always be writable (i.e. an attribute, not a constant).

Many operations may also be performed on one or more components of the tuple of values. The methods which take a component parameter will use the component to work only on a single component of the tuple. If the component parameter is less than zero, the operation will be applied to all components.

For example, the add() operation has the following signatures

add(GA_Attribute &d, GA_Offset di, const GA_Attribute &a, GA_Offset ai, fpreal b, int component);
add(GA_Attribute &d, GA_Offset di, const GA_Attribute &a, GA_Offset ai, const fpreal32 *b, int tuple_size, int component);
add(GA_Attribute &d, GA_Offset di, const GA_Attribute &a, GA_Offset ai, const fpreal64 *b, int tuple_size, int component);
add(GA_Attribute &d, GA_Offset di, const GA_Attribute &a, GA_Offset ai, const GA_Attribute &b, GA_Offset bi, int component);
add(GA_Attribute &d, const GA_Range &di, const GA_Attribute &a, const GA_Range &ai, fpreal b, int component);
add(GA_Attribute &d, const GA_Range &di, const GA_Attribute &a, const GA_Range &ai, const fpreal32 *b, int tuple_size, int component);
add(GA_Attribute &d, const GA_Range &di, const GA_Attribute &a, const GA_Range &ai, const fpreal64 *b, int tuple_size, int component);
add(GA_Attribute &d, const GA_Range &di, const GA_Attribute &a, const GA_Range &ai, const GA_Attribute &b, GA_Offset bi, int component);
add(GA_Attribute &d, const GA_Range &di, const GA_Attribute &a, const GA_Range &ai, const GA_Attribute &b, const GA_Range &bi, int component);

To assist with being able to implement all these operations with minimal effort, please see the GA_AttributeOperand class. All of the specialized methods will simply call into the method which handles the operand. If you wish to specialize the methods to be more efficient, you can do that by overriding the specific method. In the case of add(), the generic operation is.

add(GA_AttributeOperantd &dest, GA_AttributeOperand &a, GA_AttributeOperand &b);
Examples:
SOP/SOP_TimeCompare.C.

Definition at line 88 of file GA_AIFMath.h.

Constructor & Destructor Documentation

GA_AIFMath::GA_AIFMath ( )
inline

Definition at line 91 of file GA_AIFMath.h.

virtual GA_AIFMath::~GA_AIFMath ( )
virtual

Member Function Documentation

static const GA_AIFMath* GA_AIFMath::getNoMath ( )
static

Create an AIFMath which performs no arithmetic on any objects. This is different than not having an AIFMath.


The documentation for this class was generated from the following file: