Public Types | Static Public Member Functions | Protected Member Functions | Static Protected Attributes

KFCurveUtils Class Reference

Search for all occurrences

Detailed Description

Curve utilities.

This class groups methods allowing to test and convert a KFCurve into another KFCurve data set. Easier to use for some applications.

The class is used to encapsulate the methods and enums, helping to not further clog the global space.
As an example, some 3D software use a single interpolation or tangent mode for a whole curve. By providing a way to make sure the KFCurve to be converted uses a single interpolation and tangent for all keys, the conversion task is made a lot easier.

Definition at line 64 of file kfcurveutils.h.

#include <kfcurveutils.h>

List of all members.

Public Types

enum   EInterpolationAndTangeant {
  eCONSTANT, eLINEAR, eCUBIC_AUTO, eCUBIC_AUTO_BREAK,
  eCUBIC_USER, eCUBIC_BREAK, eCUBIC_TCB, eINTERPOLATION_AND_TANGEANT_COUNT
}
 

Enum useful for method KFCurveUtils::GetInterpolationAndTangeantCount().

More...

Static Public Member Functions

static bool  CompareCurve (KFCurve *pCurveA, KFCurve *pCurveB)
  Compare two curves.
static bool  GetGlobalInterpolation (kFCurveInterpolation &pGlobalInterpolation, KFCurve &pCurve)
  Check if all keys of a curve are of the same interpolation type.
static bool  GetGlobalTangeant (kFCurveTangeantMode &pGlobalTangent, KFCurve &pCurve)
  Check if all keys of a curve are of the same tangent mode.
static bool  GetInterpolationAndTangeantCount (KFCurve &pCurve, int pArray[eINTERPOLATION_AND_TANGEANT_COUNT])
  Get the number of keys in each category of interpolation type and tangent mode.
static KFCurveNode ConvertCurveInterpolationRecursive (kFCurveInterpolation pTargetGlobalInterpolation, kFCurveTangeantMode pTargetGlobalTangent, KFCurveNode &pCurveNode)
  Convert all curve keys contained in the current KFCurveNode and its children to the tangent mode and interpolation specified.
static KFCurve ConvertCurve (KFCurve &pSourceCurve, KFCurve &pTargetCurve, kFCurveInterpolation pTargetGlobalInterpolation, kFCurveTangeantMode pTargetGlobalTangent, KTime pFramePeriod)
  Convert curve keys so they are of a single interpolation type and a single tangent mode.
static void  Resample (KFCurve &pSourceCurve, KFCurve &pTargetCurve, KTime &pStart, KTime &pStop, KTime &pPeriod, kFCurveInterpolation pInterpolation, kFCurveTangeantMode pTangentMode, bool pAddStopKey=false)
  Resample a curve.
static void  Resample (KFCurve &pSourceCurve, KFCurve &pTargetCurve, KTime &pStart, KTime &pStop, KTime &pPeriod, bool pAddStopKey=false)
  Resample a curve.
static void  Resample (KFCurve &pCurve, KTime pPeriod, KTime pStart=KTIME_MINUS_INFINITE, KTime pStop=KTIME_INFINITE, bool pKeysOnFrame=false)
  Resample a curve.
static void  Merge (KFCurve &pCurveIn, KFCurve &pCurveMerge, KFCurve &pCurveOut)
  Merge pCurveIn and pCurveMerge into pCurveOut.
static KTime  FindTimeOffsetBefore (KFCurve pCurve, KTime &pTime)
  Compute time difference between the first key of a curve and a given time.
static KTime  FindTimeOffsetAfter (KFCurve pCurve, KTime &pTime)
  Compute time difference between the last key of a curve and a given time.

Protected Member Functions

  KFCurveUtils ()
  No instance of this class needs to be created.

Static Protected Attributes

static KError  smError

Error Management

enum   EError {
  eNoKey, eMultiple, eMultipleKeyCount, eUnsyncedKeys,
  eLeftUnchanged, eErrorCount
}
 

Status codes.

More...
static KError GetError ()
  Retrieve error object.
static EError  GetLastErrorID ()
  Get last error code.
static const char *  GetLastErrorString ()
  Get last error code.

Member Enumeration Documentation

enum EError

Status codes.

Enumerator:
eNoKey 
eMultiple 
eMultipleKeyCount 
eUnsyncedKeys 
eLeftUnchanged 
eErrorCount 

Definition at line 241 of file kfcurveutils.h.

        {
            // Interpolation & tangent methods
            eNoKey,
            eMultiple,

            // Curve sync methods
            eMultipleKeyCount,
            eUnsyncedKeys,

            // Filtering methods
            eLeftUnchanged,

            eErrorCount
        };

Constructor & Destructor Documentation

KFCurveUtils ( ) [protected]

No instance of this class needs to be created.


Member Function Documentation

static bool CompareCurve ( KFCurve pCurveA,
KFCurve pCurveB 
) [static]

Compare two curves.

Parameters:
pCurveA KFCurve to be compared with another KFCurve.
pCurveB KFCurve to be compared with another KFCurve.
Returns:
true if curves are equivalent.
static bool GetGlobalInterpolation ( kFCurveInterpolation pGlobalInterpolation,
KFCurve pCurve 
) [static]

Check if all keys of a curve are of the same interpolation type.

Parameters:
pGlobalInterpolation Receives interpolation type of all keys if function returns true, undetermined otherwise.
pCurve Curve to scan.
Returns:
true if there is at least one key and all keys are of the same interpolation type, false otherwise.
static bool GetGlobalTangeant ( kFCurveTangeantMode pGlobalTangent,
KFCurve pCurve 
) [static]

Check if all keys of a curve are of the same tangent mode.

Parameters:
pGlobalTangent Receives tangent mode of all keys if function returns true, undetermined otherwise.
pCurve Curve to scan.
Returns:
true if there is at least one key and all keys are of the same tangent mode, false otherwise.
static bool GetInterpolationAndTangeantCount ( KFCurve pCurve,
int  pArray[eINTERPOLATION_AND_TANGEANT_COUNT] 
) [static]

Get the number of keys in each category of interpolation type and tangent mode.

Parameters:
pCurve Curve to scan.
pArray Array to keep the number of keys in each category of interpolation type and tangent mode.
Returns:
True.
static KFCurveNode& ConvertCurveInterpolationRecursive ( kFCurveInterpolation  pTargetGlobalInterpolation,
kFCurveTangeantMode  pTargetGlobalTangent,
KFCurveNode pCurveNode 
) [static]

Convert all curve keys contained in the current KFCurveNode and its children to the tangent mode and interpolation specified.

Parameters:
pTargetGlobalInterpolation Interpolation type given to all keys.
pTargetGlobalTangent Tangent mode given to all keys if interpolation type is cubic.
pCurveNode Curve node to be modified.
Returns:
Reference to pCurveNode parameter.
Remarks:
In most cases, this function modifies the curve shape between the keys.
static KFCurve& ConvertCurve ( KFCurve pSourceCurve,
KFCurve pTargetCurve,
kFCurveInterpolation  pTargetGlobalInterpolation,
kFCurveTangeantMode  pTargetGlobalTangent,
KTime  pFramePeriod 
) [static]

Convert curve keys so they are of a single interpolation type and a single tangent mode.

As opposed to function KFCurveUtils::ConvertCurve(), this function preserves the curve shape between the keys. Part of the curve is resampled if needed.

Parameters:
pSourceCurve Source curve.
pTargetCurve Curve to be modified.
pTargetGlobalInterpolation Interpolation type given to all keys.
pTargetGlobalTangent Tangent mode given to all keys if interpolation type is cubic.
pFramePeriod Resampling period in segments to resample.
Returns:
Reference to pTargetCurve parameter.
static void Resample ( KFCurve pSourceCurve,
KFCurve pTargetCurve,
KTime pStart,
KTime pStop,
KTime pPeriod,
kFCurveInterpolation  pInterpolation,
kFCurveTangeantMode  pTangentMode,
bool  pAddStopKey = false 
) [static]

Resample a curve.

Interpolation type of each created curve key is set equal to parameter pInterpolation. Tangent mode of each created curve key is set equal to pTangentMode.

Parameters:
pSourceCurve Source curve.
pTargetCurve Curve to be modified.
pStart Start time of resampling.
pStop Stop time of resampling.
pPeriod Resampling period.
pInterpolation Interpolation type given to all keys.
pTangentMode Tangent mode given to all keys if interpolation type is cubic.
pAddStopKey Set to true to make sure a key is added exactly at time pStop.
static void Resample ( KFCurve pSourceCurve,
KFCurve pTargetCurve,
KTime pStart,
KTime pStop,
KTime pPeriod,
bool  pAddStopKey = false 
) [static]

Resample a curve.

Interpolation type of each created curve key is set equal to the interpolation type of the closest curve key encountered. Tangent mode of each created curve key is set equal to the tangent mode of the closest curve key encountered.

Parameters:
pSourceCurve Source curve.
pTargetCurve Curve to be modified.
pStart Start time of resampling.
pStop Stop time of resampling.
pPeriod Resampling period.
pAddStopKey Set to true to make sure a key is added exactly at time pStop.
static void Resample ( KFCurve pCurve,
KTime  pPeriod,
KTime  pStart = KTIME_MINUS_INFINITE,
KTime  pStop = KTIME_INFINITE,
bool  pKeysOnFrame = false 
) [static]

Resample a curve.

Interpolation type of each created curve key is set to KFCURVE_INTERPOLATION_CUBIC. Tangent mode of each created curve key is set to KFCURVE_TANGEANT_AUTO.

Parameters:
pCurve Curve to be modified.
pPeriod Resampling period.
pStart Start time of resampling. Set to KTIME_MINUS_INFINITE for whole curve.
pStop Stop time of resampling. Set to KTIME_INFINITE for whole curve.
pKeysOnFrame Set to true if keys are to be added on frames.
static void Merge ( KFCurve pCurveIn,
KFCurve pCurveMerge,
KFCurve pCurveOut 
) [static]

Merge pCurveIn and pCurveMerge into pCurveOut.

Copy pCurveIn in pCurveOut and then overwrite keys in the time span covered by pCurveMerge.

Parameters:
pCurveIn Source curve.
pCurveMerge Curve containing keys to merge in source curve.
pCurveOut Destination for source curve and keys to merge.
static KTime FindTimeOffsetBefore ( KFCurve  pCurve,
KTime pTime 
) [static]

Compute time difference between the first key of a curve and a given time.

Parameters:
pCurve
pTime The given time.
Returns:
The time offset.
static KTime FindTimeOffsetAfter ( KFCurve  pCurve,
KTime pTime 
) [static]

Compute time difference between the last key of a curve and a given time.

Parameters:
pCurve
pTime The given time.
Returns:
The time offset.
static KError& GetError ( ) [static]

Retrieve error object.

static EError GetLastErrorID ( ) [static]

Get last error code.

static const char* GetLastErrorString ( ) [static]

Get last error code.


Member Data Documentation

KError smError [static, protected]

Definition at line 284 of file kfcurveutils.h.


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

KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils
KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils KFCurveUtils