AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
HoloToolkit.Unity.InterpolatedValue< T > Class Template Referenceabstract

Base class that provides the common logic for interpolating between values. This class does not inherit from MonoBehaviour in order to enable various scenarios under which it used. To perform the interpolation step, call FrameUpdate. More...

Public Member Functions

 InterpolatedValue (T initialValue, bool skipFirstUpdateFrame)
 Instantiates a new InterpolatedValue with an initial value and a setting of whether to skip first update frame. More...
 
void UpdateTarget (T updateTargetValue)
 Updates the target value and starts the interpolator if it is not running already. More...
 
void UpdateTarget (T updateTargetValue, bool forceUpdate)
 Updates the target value and starts the interpolator if it is not running already. More...
 
void SnapToTarget ()
 Snap (set) the interpolated value to the current target value. More...
 
void SnapToTarget (T snapTargetValue)
 Update the target to a new value and snap (set) the interpolated value to it. More...
 
void InterpolateThenSnapToTarget (T snapTargetValue)
 Interpolative snap to target will interpolate until it reaches the given target value, after which subsequent calls to this method it will snap to the target value given. More...
 
void EnsureEnabled ()
 Starts interpolation if it is not currently running. More...
 
void EnsureDisabled ()
 Stops the interpolation if it is currently running. More...
 
FrameUpdate ()
 Increments the interpolation step. This function should be called each frame. More...
 
abstract bool DoValuesEqual (T one, T other)
 A method to check whether two values are equal. This should be overridden by inheriting classes. More...
 
abstract T ApplyCurveValue (T startValue, T targetValue, float curveValue)
 A method to calculate the current interpolated value based on the start value, a target value and the curve evaluated interpolation position value. This should be overridden by inheriting classes. More...
 

Static Public Member Functions

static implicit operator T (InterpolatedValue< T > interpolatedValue)
 Implicit cast operator that returns the current value of the Interpolator. More...
 

Public Attributes

const float SmallNumber = 0.0000001f
 
const float SmallNumberSquared = SmallNumber * SmallNumber
 

Properties

float Duration [get, set]
 Time the interpolator takes to get from current value to the target value. More...
 
AnimationCurve Curve [get, set]
 The AnimationCurve used for evaluating the interpolation value. More...
 
bool IsValid [get]
 Checks if the interpolator can be used by ensuring an AnimatorCurve has been set. More...
 
bool IsRunning [get]
 Checks whether the interpolator is currently interpolating. More...
 
Value [get]
 Returns the current interpolated value. More...
 
Target [get]
 Returns the current interpolation target value. More...
 
float CurrentTime [get]
 Wrapper for getting time that supports EditTime updates. More...
 

Events

Action< InterpolatedValue< T > > Started
 Event that is triggered when interpolation starts. More...
 
Action< InterpolatedValue< T > > Completed
 Event that is triggered when interpolation completes. More...
 
Action< InterpolatedValue< T > > ValueChanged
 Event that is triggered when the current interpolated value is changed. More...
 

Detailed Description

Base class that provides the common logic for interpolating between values. This class does not inherit from MonoBehaviour in order to enable various scenarios under which it used. To perform the interpolation step, call FrameUpdate.

Template Parameters
TType of value used for interpolation.

Definition at line 16 of file InterpolatedValue.cs.

Constructor & Destructor Documentation

§ InterpolatedValue()

HoloToolkit.Unity.InterpolatedValue< T >.InterpolatedValue ( initialValue,
bool  skipFirstUpdateFrame 
)

Instantiates a new InterpolatedValue with an initial value and a setting of whether to skip first update frame.

Parameters
initialValueInitial current value to use.
skipFirstUpdateFrameA flag to skip first update frame after the interpolation target has been set.

Definition at line 134 of file InterpolatedValue.cs.

Member Function Documentation

§ ApplyCurveValue()

abstract T HoloToolkit.Unity.InterpolatedValue< T >.ApplyCurveValue ( startValue,
targetValue,
float  curveValue 
)
pure virtual

A method to calculate the current interpolated value based on the start value, a target value and the curve evaluated interpolation position value. This should be overridden by inheriting classes.

This method is public because of a Unity compilation bug when dealing with abstract methods on generics.

Parameters
startValueThe value that the interpolation started at.
targetValueThe target value that the interpolation is moving to.
curveValueA curve evaluated interpolation position value. This will be in range of [0, 1]
Returns
The new calculated interpolation value.

§ DoValuesEqual()

abstract bool HoloToolkit.Unity.InterpolatedValue< T >.DoValuesEqual ( one,
other 
)
pure virtual

A method to check whether two values are equal. This should be overridden by inheriting classes.

This method is public because of a Unity compilation bug when dealing with abstract methods on generics.

Parameters
oneFirst value.
otherSecond value.
Returns
True if values are equal or are "close enough".

§ EnsureDisabled()

void HoloToolkit.Unity.InterpolatedValue< T >.EnsureDisabled ( )

Stops the interpolation if it is currently running.

This forces a stop if currently running and does not check if the interpolated value has not reached the target value.

Definition at line 245 of file InterpolatedValue.cs.

§ EnsureEnabled()

void HoloToolkit.Unity.InterpolatedValue< T >.EnsureEnabled ( )

Starts interpolation if it is not currently running.

This forces a start if not currently running and does not check if the interpolated value is at the target value.

Definition at line 226 of file InterpolatedValue.cs.

§ FrameUpdate()

T HoloToolkit.Unity.InterpolatedValue< T >.FrameUpdate ( )

Increments the interpolation step. This function should be called each frame.

To enable multiple scenarios for using the InterpolatedValues, the class does not inherit from MonoBehaviour.

Returns
The new interpolated value after performing the interpolation step.

Definition at line 260 of file InterpolatedValue.cs.

§ InterpolateThenSnapToTarget()

void HoloToolkit.Unity.InterpolatedValue< T >.InterpolateThenSnapToTarget ( snapTargetValue)

Interpolative snap to target will interpolate until it reaches the given target value, after which subsequent calls to this method it will snap to the target value given.

SnapToTarget and UpdateTarget resets this.

Parameters
snapTargetValueThe target value to set and interpolate to.

Definition at line 201 of file InterpolatedValue.cs.

§ operator T()

static implicit HoloToolkit.Unity.InterpolatedValue< T >.operator T ( InterpolatedValue< T >  interpolatedValue)
static

Implicit cast operator that returns the current value of the Interpolator.

Parameters
interpolatedValueThe interpolator casting from.

Definition at line 25 of file InterpolatedValue.cs.

§ SnapToTarget() [1/2]

void HoloToolkit.Unity.InterpolatedValue< T >.SnapToTarget ( )

Snap (set) the interpolated value to the current target value.

Definition at line 180 of file InterpolatedValue.cs.

§ SnapToTarget() [2/2]

void HoloToolkit.Unity.InterpolatedValue< T >.SnapToTarget ( snapTargetValue)

Update the target to a new value and snap (set) the interpolated value to it.

Parameters
snapTargetValueThe new target value.

Definition at line 189 of file InterpolatedValue.cs.

§ UpdateTarget() [1/2]

void HoloToolkit.Unity.InterpolatedValue< T >.UpdateTarget ( updateTargetValue)

Updates the target value and starts the interpolator if it is not running already.

Parameters
updateTargetValueThe new target value.

Definition at line 148 of file InterpolatedValue.cs.

§ UpdateTarget() [2/2]

void HoloToolkit.Unity.InterpolatedValue< T >.UpdateTarget ( updateTargetValue,
bool  forceUpdate 
)

Updates the target value and starts the interpolator if it is not running already.

Parameters
updateTargetValueThe new target value.
forceUpdateA flag for forcing an update propagation.

Definition at line 158 of file InterpolatedValue.cs.

Member Data Documentation

§ SmallNumber

const float HoloToolkit.Unity.InterpolatedValue< T >.SmallNumber = 0.0000001f

Definition at line 18 of file InterpolatedValue.cs.

§ SmallNumberSquared

const float HoloToolkit.Unity.InterpolatedValue< T >.SmallNumberSquared = SmallNumber * SmallNumber

Definition at line 19 of file InterpolatedValue.cs.

Property Documentation

§ CurrentTime

float HoloToolkit.Unity.InterpolatedValue< T >.CurrentTime
getprotected

Wrapper for getting time that supports EditTime updates.

Definition at line 118 of file InterpolatedValue.cs.

§ Curve

AnimationCurve HoloToolkit.Unity.InterpolatedValue< T >.Curve
getset

The AnimationCurve used for evaluating the interpolation value.

Definition at line 73 of file InterpolatedValue.cs.

§ Duration

float HoloToolkit.Unity.InterpolatedValue< T >.Duration
getset

Time the interpolator takes to get from current value to the target value.

Definition at line 60 of file InterpolatedValue.cs.

§ IsRunning

bool HoloToolkit.Unity.InterpolatedValue< T >.IsRunning
get

Checks whether the interpolator is currently interpolating.

Definition at line 86 of file InterpolatedValue.cs.

§ IsValid

bool HoloToolkit.Unity.InterpolatedValue< T >.IsValid
get

Checks if the interpolator can be used by ensuring an AnimatorCurve has been set.

Definition at line 81 of file InterpolatedValue.cs.

§ Target

Returns the current interpolation target value.

Definition at line 110 of file InterpolatedValue.cs.

§ Value

Returns the current interpolated value.

Definition at line 94 of file InterpolatedValue.cs.

Event Documentation

§ Completed

Event that is triggered when interpolation completes.

Definition at line 38 of file InterpolatedValue.cs.

§ Started

Event that is triggered when interpolation starts.

Definition at line 33 of file InterpolatedValue.cs.

§ ValueChanged

Event that is triggered when the current interpolated value is changed.

Definition at line 43 of file InterpolatedValue.cs.


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