KFCurveUtils
#include<kfcurveutils.h>

List of all members.

Detailed Description

Curve utilities.

This class groups methods allowing to test and convert aKFCurveinto anotherKFCurvedata 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 theKFCurveto be converted uses a single interpolation and tangent for all keys, the conversion task is made a lot easier.

Definition at line65of filekfcurveutils.h.


Error Management

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

Public Types

enum EInterpolationAndTangeant
 Enum useful for methodKFCurveUtils::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.
staticKFCurveNodeConvertCurveInterpolationRecursive(kFCurveInterpolation pTargetGlobalInterpolation, kFCurveTangeantMode pTargetGlobalTangent,KFCurveNode&pCurveNode)
 Convert all curve keys contained in the currentKFCurveNodeand its children to the tangent mode and interpolation specified.
staticKFCurveConvertCurve(KFCurve&pSourceCurve,KFCurve&pTargetCurve, kFCurveInterpolation pTargetGlobalInterpolation, kFCurveTangeantMode pTargetGlobalTangent,KTimepFramePeriod)
 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,KTimepPeriod,KTimepStart=KTIME_MINUS_INFINITE,KTimepStop=KTIME_INFINITE, bool pKeysOnFrame=false)
 Resample a curve.
static void Merge(KFCurve&pCurveIn,KFCurve&pCurveMerge,KFCurve&pCurveOut)
 MergepCurveInandpCurveMergeintopCurveOut.
staticKTime FindTimeOffsetBefore(KFCurvepCurve,KTime&pTime)
 Compute time d ifference between the first key of a curve and a given time.
staticKTime FindTimeOffsetAfter(KFCurvepCurve,KTime&pTime)
 Compute time difference between the last key of a curve and a given time.

Member Enumeration Documentation

Enum useful for methodKFCurveUtils::GetInterpolationAndTangeantCount().

Definition at line96of filekfcurveutils.h.

enumEError

Status codes.

Definition at line242of filekfcurveutils.h.

Member Function Documentation

static bool CompareCurve(KFCurvepCurveA,
KFCurvepCurveB 
)[static]

Compare two curves.

Parameters:
pCurveA KFCurveto be compared with anotherKFCurve.
pCurveB KFCurveto be compared with anotherKFCurve.
Returns:
trueif curves are equivalent.

static bool GetGlobalInterpolation(kFCurveInterpolation& pGlobalInterpolation,
KFCurvepCurve 
)[static]

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

Parameters:
pGlobalInterpolation Receives interpolation type of all keys if function returnstrue, undetermined otherwise.
pCurve Curve to scan.
Returns:
trueif there is at least one key and all keys are of the same interpolation type,falseotherwise.

static bool GetGlobalTangeant(kFCurveTangeantMode& pGlobalTangent,
KFCurvepCurve 
)[static]

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

Parameters:
pGlobalTangent Receives tangent mode of all keys if function returnstrue, undetermined otherwise.
pCurve Curve to scan.
Returns:
trueif there is at least one key and all keys are of the same tangent mode,falseotherwise.

static bool GetInterpolationAndTangeantCount(KFCurvepCurve,
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.

staticKFCurveNode&ConvertCurveInterpolationRecursive(kFCurveInterpolation pTargetGlobalInterpolation,
kFCurveTangeantMode pTargetGlobalTangent,
KFCurveNodepCurveNode 
)[static]

Convert all curve keys contained in the currentKFCurveNodeand 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.

staticKFCurve&ConvertCurve(KFCurvepSourceCurve,
KFCurvepTargetCurve,
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 functionKFCurveUtils::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(KFCurvepSourceCurve,
KFCurvepTargetCurve,
KTimepStart,
KTimepStop,
KTimepPeriod,
kFCurveInterpolation pInterpolation,
kFCurveTangeantMode pTangentMode,
bool pAddStopKey=false 
)[static]

Resample a curve.

Interpolation type of each created curve key is set equal to parameterpInterpolation. Tangent mode of each created curve key is set equal topTangentMode.

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 totrueto make sure a key is added exactly at time pStop.

static void Resample(KFCurvepSourceCurve,
KFCurvepTargetCurve,
KTimepStart,
KTimepStop,
KTimepPeriod,
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 totrueto make sure a key is added exactly at time pStop.

static void Resample(KFCurvepCurve,
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 totrueif keys are to be added on frames.

static void Merge(KFCurvepCurveIn,
KFCurvepCurveMerge,
KFCurvepCurveOut 
)[static]

MergepCurveInandpCurveMergeintopCurveOut.

CopypCurveIninpCurveOutand then overwrite keys in the time span covered bypCurveMerge.

Parameters:
pCurveIn Source curve.
pCurveMerge Curve containing keys to merge in source curve.
pCurveOut Destination for source curve and keys to merge.

staticKTimeFindTimeOffsetBefore(KFCurve pCurve,
KTimepTime 
)[static]

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

Parameters:
pCurve 
pTime The given time.
Returns:
The time offset.

staticKTimeFindTimeOffsetAfter(KFCurve pCurve,
KTimepTime 
)[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.

staticKError&GetError( ) [static]

Retrieve error object.

staticEErrorGetLastErrorID( ) [static]

Get last error code.

static const char* GetLastErrorString( ) [static]

Get last error code.