Class StabilizedRay
A ray whose position and direction are stabilized in a way similar to how gaze stabilization works in HoloLens.
The ray uses Anatolie Gavrulic's "DynamicExpDecay" filter to stabilize the ray this filter adjusts its smoothing factor based on the velocity of the filtered object
The formula is Y_smooted += ∆𝑌_𝑟 where 〖∆𝑌_𝑟=∆𝑌∗〖0.5〗^(∆𝑌/〖Halflife〗)
In code, LERP(signal, oldValue, POW(0.5, ABS(signal – oldValue) / hl)
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.Utilities
Assembly: cs.temp.dll.dll
Syntax
public class StabilizedRay
Constructors
StabilizedRay(Single)
HalfLife closer to zero means lerp closer to one.
Declaration
public StabilizedRay(float halfLife)
Parameters
Type | Name | Description |
---|---|---|
Single | halfLife |
Properties
HalfLifeDirection
Half life used for velocity decay calculations.
Declaration
public float HalfLifeDirection { get; }
Property Value
Type | Description |
---|---|
Single |
HalfLifePosition
Half life used for position decay calculations.
Declaration
public float HalfLifePosition { get; }
Property Value
Type | Description |
---|---|
Single |
StabilizedDirection
Computed stabilized direction.
Declaration
public Vector3 StabilizedDirection { get; }
Property Value
Type | Description |
---|---|
Vector3 |
StabilizedPosition
Computed Stabilized position.
Declaration
public Vector3 StabilizedPosition { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Methods
AddSample(Ray)
Add sample to ray stabilizer.
Declaration
public void AddSample(Ray ray)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | New Sample used to update stabilized ray. |
DynamicExpCoefficient(Single, Single)
Compute dynamic exponential coefficient.
Declaration
public static float DynamicExpCoefficient(float hLife, float delta)
Parameters
Type | Name | Description |
---|---|---|
Single | hLife | Half life |
Single | delta | Distance delta |
Returns
Type | Description |
---|---|
Single | The dynamic exponential coefficient. |
DynamicExpDecay(Vector3, Vector3, Single)
Compute stabilized vector3 given a previously stabilized value, and a new sample, given a half life.
Declaration
public static Vector3 DynamicExpDecay(Vector3 from, Vector3 to, float hLife)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | from | Previous stabilized Vector3. |
Vector3 | to | New Vector3 sample. |
Single | hLife | Half life used for stabilization. |
Returns
Type | Description |
---|---|
Vector3 | Stabilized Vector 3. |