Tanoda
Leap.Unity.DeltaBuffer< SampleType, DerivativeType > Class Template Referenceabstract

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...

Inheritance diagram for Leap.Unity.DeltaBuffer< SampleType, DerivativeType >:
Leap.Unity.DeltaBuffer< Vector3, Vector3 > Leap.Unity.IIndexable< SampleType >

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...
 
- Public Member Functions inherited from Leap.Unity.DeltaBuffer< Vector3, Vector3 >
 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
 
- Protected Attributes inherited from Leap.Unity.DeltaBuffer< Vector3, Vector3 >
RingBuffer< ValueTimePair > _buffer
 

Properties

int Count [get]
 
bool IsFull [get]
 
bool IsEmpty [get]
 
int Capacity [get]
 
SampleType this[int idx] [get]
 
- Properties inherited from Leap.Unity.DeltaBuffer< Vector3, Vector3 >
int Count [get]
 
bool IsFull [get]
 
bool IsEmpty [get]
 
int Capacity [get]
 
SampleType this[int idx] [get]
 
- Properties inherited from Leap.Unity.IIndexable< SampleType >
this[int idx] [get]
 
int Count [get]
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ DeltaBuffer() [1/2]

Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.DeltaBuffer ( int  bufferSize)

Definition at line 31 of file DeltaBuffer.cs.

◆ DeltaBuffer() [2/2]

Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.DeltaBuffer ( int  bufferSize)

Definition at line 111 of file DeltaBuffer.cs.

Member Function Documentation

◆ Add()

void Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.Add ( SampleType  sample,
float  sampleTime 
)

Definition at line 51 of file DeltaBuffer.cs.

◆ Clear()

void Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.Clear ( )

Definition at line 49 of file DeltaBuffer.cs.

◆ Delta() [1/2]

abstract DerivativeType Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.Delta ( )
pure virtual

◆ Delta() [2/2]

override Vector3 Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.Delta ( )
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.

◆ Get()

SampleType Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.Get ( int  idx)

Definition at line 60 of file DeltaBuffer.cs.

◆ GetEnumerator()

IndexableEnumerator< SampleType > Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.GetEnumerator ( )

Definition at line 94 of file DeltaBuffer.cs.

◆ GetLatest()

SampleType Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.GetLatest ( )

Definition at line 64 of file DeltaBuffer.cs.

◆ GetLatestTime()

float Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.GetLatestTime ( )

Definition at line 81 of file DeltaBuffer.cs.

◆ GetTime()

float Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.GetTime ( int  idx)

Definition at line 77 of file DeltaBuffer.cs.

◆ Set()

void Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.Set ( int  idx,
SampleType  sample,
float  sampleTime 
)

Definition at line 68 of file DeltaBuffer.cs.

◆ SetLatest()

void Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.SetLatest ( SampleType  sample,
float  sampleTime 
)

Definition at line 72 of file DeltaBuffer.cs.

Member Data Documentation

◆ _buffer

RingBuffer<ValueTimePair> Leap.Unity.DeltaBuffer< SampleType, DerivativeType >._buffer
protected

Definition at line 35 of file DeltaBuffer.cs.

Property Documentation

◆ Capacity

int Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.Capacity
get

Definition at line 43 of file DeltaBuffer.cs.

◆ Count

int Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.Count
get

Definition at line 37 of file DeltaBuffer.cs.

◆ IsEmpty

bool Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.IsEmpty
get

Definition at line 41 of file DeltaBuffer.cs.

◆ IsFull

bool Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.IsFull
get

Definition at line 39 of file DeltaBuffer.cs.

◆ this[int idx]

SampleType Leap.Unity.DeltaBuffer< SampleType, DerivativeType >.this[int idx]
get

Definition at line 45 of file DeltaBuffer.cs.


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