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

Context to keep track of weighted sums. More...

#include <GA_WeightedSum.h>

Public Member Functions

 GA_WeightedSum ()
 
 ~GA_WeightedSum ()
 
void rewind ()
 Rewind will reset the values of the sum (i.e. the count and weights) More...
 
void advance (fpreal weight)
 
void finish ()
 
int getPartialIndex () const
 
int getIterationCount () const
 
fpreal getCurrentWeight () const
 Get the current weight to sum. More...
 
fpreal getTotalWeight () const
 Get the sum of the weights for all iterations (for normalization) More...
 
bool getIsMaxWeight () const
 A convenince method for conditional copying of the maximum weight. More...
 

Detailed Description

Context to keep track of weighted sums.

Weighted sums are used in metaball blending, TP surfaces and various other places. The weighted sum class is used to keep track of progress through the weighted sum. The class keeps track of the current, maximum and total of the weights. This allows discrete attributes to perform conditional copying (on the maximum value), or for normalization at the end of the sum.

Definition at line 36 of file GA_WeightedSum.h.

Constructor & Destructor Documentation

GA_WeightedSum::GA_WeightedSum ( )
inline

The weighted sum is used to keep track of partial sums.

The homogeneous flag will change weighted sums of homogeneous attributes (GA_TYPE_HPOINT) so that they will be homogenized before summing and de-homogenized at the conclusion of the sum. This only affects homogeneous attributes.

Definition at line 45 of file GA_WeightedSum.h.

GA_WeightedSum::~GA_WeightedSum ( )
inline

Definition at line 46 of file GA_WeightedSum.h.

Member Function Documentation

void GA_WeightedSum::advance ( fpreal  weight)
inline

Advance is called when starting a new iteration. The weight passed in is the weight associated with this iteration.

Definition at line 53 of file GA_WeightedSum.h.

void GA_WeightedSum::finish ( )

Finish is called after the last partial sum has been called. This lets the max-weight get set correctly.

fpreal GA_WeightedSum::getCurrentWeight ( ) const
inline

Get the current weight to sum.

Definition at line 75 of file GA_WeightedSum.h.

bool GA_WeightedSum::getIsMaxWeight ( ) const
inline

A convenince method for conditional copying of the maximum weight.

Definition at line 81 of file GA_WeightedSum.h.

int GA_WeightedSum::getIterationCount ( ) const
inline

Like the partial index, but returns the "count". That is, on finishSum(), this method will return the count of the iterations.

Definition at line 72 of file GA_WeightedSum.h.

int GA_WeightedSum::getPartialIndex ( ) const
inline

The partial index runs from 0...N On the call to initSum(), the value will be -1, on the call to finishSum(), the value will be N-1.

Definition at line 68 of file GA_WeightedSum.h.

fpreal GA_WeightedSum::getTotalWeight ( ) const
inline

Get the sum of the weights for all iterations (for normalization)

Definition at line 78 of file GA_WeightedSum.h.

void GA_WeightedSum::rewind ( )

Rewind will reset the values of the sum (i.e. the count and weights)


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