Tanoda
|
Allows you to add to a capped-size ring buffer of Ts and, when full, compute the buffer's average change over time. DeltaBuffer without type parameters supports Vector3s; DeltaFloatBuffer supports floats, and DeltaQuaternionBuffer supports Quaternion rotations. More...
Classes | |
struct | ValueTimePair |
Public Member Functions | |
DeltaBuffer (int bufferSize) | |
void | Clear () |
void | Add (SampleType sample, float sampleTime) |
SampleType | Get (int idx) |
SampleType | GetLatest () |
void | Set (int idx, SampleType sample, float sampleTime) |
void | SetLatest (SampleType sample, float sampleTime) |
float | GetTime (int idx) |
float | GetLatestTime () |
abstract DerivativeType | Delta () |
Returns the average change between each sample per unit time. More... | |
IndexableEnumerator< SampleType > | GetEnumerator () |
DeltaBuffer (int bufferSize) | |
override Vector3 | Delta () |
Returns the average change between each sample per unit time, or zero if the buffer contains one or fewer elements. More... | |
![]() | |
DeltaBuffer (int bufferSize) | |
DeltaBuffer (int bufferSize) | |
void | Clear () |
void | Add (SampleType sample, float sampleTime) |
SampleType | Get (int idx) |
SampleType | GetLatest () |
void | Set (int idx, SampleType sample, float sampleTime) |
void | SetLatest (SampleType sample, float sampleTime) |
float | GetTime (int idx) |
float | GetLatestTime () |
abstract DerivativeType | Delta () |
Returns the average change between each sample per unit time. More... | |
override Vector3 | Delta () |
Returns the average change between each sample per unit time, or zero if the buffer contains one or fewer elements. More... | |
IndexableEnumerator< SampleType > | GetEnumerator () |
Protected Attributes | |
RingBuffer< ValueTimePair > | _buffer |
![]() | |
RingBuffer< ValueTimePair > | _buffer |
Properties | |
int | Count [get] |
bool | IsFull [get] |
bool | IsEmpty [get] |
int | Capacity [get] |
SampleType | this[int idx] [get] |
![]() | |
int | Count [get] |
bool | IsFull [get] |
bool | IsEmpty [get] |
int | Capacity [get] |
SampleType | this[int idx] [get] |
![]() | |
T | this[int idx] [get] |
int | Count [get] |
Allows you to add to a capped-size ring buffer of Ts and, when full, compute the buffer's average change over time. DeltaBuffer without type parameters supports Vector3s; DeltaFloatBuffer supports floats, and DeltaQuaternionBuffer supports Quaternion rotations.
A ring buffer of Vector3s with a Delta() function that computes the buffer's average change over time.
To support other types, subclass DeltaBuffer with your sample type and average change type (in many cases the these are the same) and implement the Delta() function to compute the average change of samples currently in the buffer.
The larger the buffer, the more stable but also delayed the resulting average change over time. A buffer size of 5 is a good start for 60-90 Hz updates.
Definition at line 24 of file DeltaBuffer.cs.
Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.DeltaBuffer | ( | int | bufferSize | ) |
Definition at line 31 of file DeltaBuffer.cs.
Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.DeltaBuffer | ( | int | bufferSize | ) |
Definition at line 111 of file DeltaBuffer.cs.
void Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.Add | ( | SampleType | sample, |
float | sampleTime | ||
) |
Definition at line 51 of file DeltaBuffer.cs.
void Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.Clear | ( | ) |
Definition at line 49 of file DeltaBuffer.cs.
|
pure virtual |
Returns the average change between each sample per unit time.
If the buffer is empty, you should return the identity for your derivative type.
Implements Leap.Unity.DeltaBuffer< Vector3, Vector3 >.
Implemented in Leap.Unity.DeltaBuffer< SampleType, DerivativeType >, Leap.Unity.DeltaBuffer< float, float >, Leap.Unity.DeltaBuffer< Quaternion, Vector3 >, Leap.Unity.DeltaBuffer< SampleType, DerivativeType >, Leap.Unity.DeltaBuffer< float, float >, Leap.Unity.DeltaBuffer< Quaternion, Vector3 >, Leap.Unity.DeltaFloatBuffer, and Leap.Unity.DeltaQuaternionBuffer.
|
virtual |
Returns the average change between each sample per unit time, or zero if the buffer contains one or fewer elements.
The larger the buffer, the more stable but also delayed the resulting average change over time. A buffer size of 5 is a good start for 60-90 Hz updates.
Implements Leap.Unity.DeltaBuffer< Vector3, Vector3 >.
Definition at line 120 of file DeltaBuffer.cs.
SampleType Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.Get | ( | int | idx | ) |
Definition at line 60 of file DeltaBuffer.cs.
IndexableEnumerator< SampleType > Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.GetEnumerator | ( | ) |
Definition at line 94 of file DeltaBuffer.cs.
SampleType Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.GetLatest | ( | ) |
Definition at line 64 of file DeltaBuffer.cs.
float Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.GetLatestTime | ( | ) |
Definition at line 81 of file DeltaBuffer.cs.
float Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.GetTime | ( | int | idx | ) |
Definition at line 77 of file DeltaBuffer.cs.
void Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.Set | ( | int | idx, |
SampleType | sample, | ||
float | sampleTime | ||
) |
Definition at line 68 of file DeltaBuffer.cs.
void Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.SetLatest | ( | SampleType | sample, |
float | sampleTime | ||
) |
Definition at line 72 of file DeltaBuffer.cs.
|
protected |
Definition at line 35 of file DeltaBuffer.cs.
|
get |
Definition at line 43 of file DeltaBuffer.cs.
|
get |
Definition at line 37 of file DeltaBuffer.cs.
|
get |
Definition at line 41 of file DeltaBuffer.cs.
|
get |
Definition at line 39 of file DeltaBuffer.cs.
|
get |
Definition at line 45 of file DeltaBuffer.cs.