# HBhvInterpolatorPosition

## Functions

| `HBhvInterpolatorPosition`
const char * | `GetType`
HBhvInterpolator * | `CreateInstance`
void | `InsertLinear`
void | `ReplaceLinear`
void | `InsertCurve`
void | `ReplaceCurve`
void | `InsertDiscrete`
void | `Serialize`
void | `Interpolate`
void | `Evaluate`
void | `Reset`
void | `CalculatePos`
void * | `XMLCallback`

## Detailed Description

class HBhvInterpolatorPosition : public HBhvInterpolator

  The HBhvInterpolatorPosition class controls positional interpolation.

  HBhvInterpolatorPosition allows for either linear or spline based movement. This class can be used for camera interpolation as well other targets.

  Subclassed by HBhvInterpolatorTrail

  Public Functions

  HBhvInterpolatorPosition(HBhvAnimation *animation = 0, const char *name = 0)

    Constructs an HBhvInterpolatorPosition object.

    Parameters

      - animation – The animation that this interpolator belongs to.

      - name – The name of the interpolator.

  virtual const char *GetType()
    Returns

      Type of the interpolator which is ‘Pos’.

  virtual HBhvInterpolator *CreateInstance(HBhvAnimation *ainst)

    In special cases, you may want an interpolator that references this interpolator without changing it. Use this method to create the new interpolator passing a pointer to the animation that you want it to be associated with.

    Parameters

      ainst – The animation instance that this interpolator is associated with.

    Returns

      The newly created interpolator that references this interpolator.

  inline void InsertLinear(HPoint pos, int l = 0)

    This method creates a new linear positional keyframe with the passed pos value and then inserts it after the passed position l into the keyframe array.

    Parameters

      - pos – The position value for the keyframe to be inserted.

      - l – The position in the array to insert the item after.

  inline void ReplaceLinear(HPoint pos, int l)

    Replaces the item at the given position in the keyframe array with a new linear positional keyframe that was created with the passed pos value.

    Parameters

      - pos – The position value for the new replacement keyframe.

      - l – The array position to replace.

  inline void InsertCurve(HPoint pos, int l = 0)

    This method creates a new non-linear positional keyframe with the passed pos value and then inserts it after the passed position l into the keyframe array.

    Parameters

      - pos – The position value for the keyframe to be insert.

      - l – The array position to insert item after.

  inline void ReplaceCurve(HPoint pos, int l)

    Replaces the item at the given position in the keyframe array with a new non-linear positional keyframe that was created with the passed pos value.

    Parameters

      - pos – The position value for the new replacement keyframe.

      - l – The array position to replace.

  inline void InsertDiscrete(HPoint pos, int l = 0)

    This method creates a new discrete positional keyframe with the passed pos value and then inserts it after the passed position l into the keyframe array.

    Parameters

      - pos – The position value for the new keyframe to be inserted.

      - l – The array position to insert item after.

  virtual void Serialize(HUtilityXMLGenerator *xmlgen)

    Writes XML data to a buffer using the passed XML generator.

  virtual void Interpolate(int keyframe, float fraction)

    Performs an interpolation on this interpolator’s animation target.

    Parameters

      - keyframe – The reference keyframe for this interpolation.

      - fraction – The fraction value from the specified keyframe to the next keyframe. The value is from 0 to 1.

  virtual void Evaluate(int keyframe, float fraction, bool &hasPos, HPoint &pos, bool &hasQuat, HQuat &quat, bool &hasScale, HPoint &scale)
  virtual void Reset()

    Resets the interpolator instance.

  virtual void CalculatePos(int keyframe, float fraction, HPoint &res)

    Calculates the interpolated positional value given a keyframe and fraction to the next keyframe.

    Parameters

      - keyframe – The reference keyframe for this interpolation.

      - fraction – The fractional value from the specified keyframe to the next keyframe. This value is from 0 to 1.

      - res – The result of the interpolation.

  Public Static Functions

  static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData)

    This is XML read callback which parses XML data and then populates the member variables with the associated values.