KFCurveUtils Class Reference

#include <kfcurveutils.h>

List of all members.


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 65 of file kfcurveutils.h.

Error Management

enum  EError
 Status codes. More...
static KErrorGetError ()
 Retrieve error object.
static EError GetLastErrorID ()
 Get last error code.
static char * GetLastErrorString ()
 Get last error code.

Public Types

enum  EInterpolationAndTangeant
 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 KFCurveNodeConvertCurveInterpolationRecursive (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 KFCurveConvertCurve (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.


Member Enumeration Documentation

Enum useful for method KFCurveUtils::GetInterpolationAndTangeantCount().

Definition at line 94 of file kfcurveutils.h.

enum EError

Status codes.

Definition at line 228 of file kfcurveutils.h.


Member Function Documentation

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

Compare two curves.

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 interpolation type, 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.

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.

static KTime FindTimeOffsetAfter ( KFCurve  pCurve,
KTime pTime 
) [static]

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

static KError& GetError (  )  [static]

Retrieve error object.

static EError GetLastErrorID (  )  [static]

Get last error code.

static char* GetLastErrorString (  )  [static]

Get last error code.