Class AnalysisObject
This class describes a (usually) tracked object or person.
Inheritance
Inherited Members
Namespace: IMLD.MixedRealityAnalysis.Core
Assembly: Assembly-CSharp.dll
Syntax
public class AnalysisObject
Constructors
AnalysisObject(String, Int32, ObjectType, Int32, String, Single, TimeFormat, RotationFormat, List<String>, List<Session>, Color)
Initializes a new instance of the AnalysisObject class.
Declaration
public AnalysisObject(string title, int id, ObjectType type, int parentId, string dataSource, float unitfactor, TimeFormat timeformat, RotationFormat rotationformat, List<string> conditions, List<Session> sessions, Color color)
Parameters
Type | Name | Description |
---|---|---|
System.String | title | The name or title of this object. This is used, e.g., for labels in the visualization. |
System.Int32 | id | The id of this object. |
ObjectType | type | The ObjectType of this object. |
System.Int32 | parentId | The id of the parent object for this object. Should be -1 if the object has no parent. |
System.String | dataSource | The data source for this object. This can be used to differentiate between different sensors or tracking systems. |
System.Single | unitfactor | The conversion factor between the samples' unit of length and 1m. |
TimeFormat | timeformat | The TimeFormat for this object |
RotationFormat | rotationformat | The RotationFormat for this object |
System.Collections.Generic.List<System.String> | conditions | An ordered |
System.Collections.Generic.List<Session> | sessions | An ordered |
UnityEngine.Color | color | The default UnityEngine.Color for this object. |
Fields
Id
The id of this object.
Declaration
public readonly int Id
Field Value
Type | Description |
---|---|
System.Int32 |
Title
The name or title of this object. This is used, e.g., for labels in the visualization.
Declaration
public readonly string Title
Field Value
Type | Description |
---|---|
System.String |
Properties
AveragePosition
Gets the average position of all samples.
Declaration
public Vector3 AveragePosition { get; }
Property Value
Type | Description |
---|---|
UnityEngine.Vector3 |
ConditionCount
Gets the number of conditions.
Declaration
public int ConditionCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
ConditionToId
Gets the System.Collections.Generic.Dictionary<TKey, TValue> mapping conditions to their ids.
Declaration
public Dictionary<string, int> ConditionToId { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.Int32> |
HasStateData
Gets or sets a value indicating whether this object has state information connected to it. Should only be set during data import/parsing.
Declaration
public bool HasStateData { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IdToCondition
Gets the System.Collections.Generic.Dictionary<TKey, TValue> mapping condition ids to their conditions.
Declaration
public Dictionary<int, string> IdToCondition { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.Int32, System.String> |
IsStatic
Gets or sets a value indicating whether this object is static. Should only be set during data import/parsing.
Declaration
public bool IsStatic { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
LocalPosition
Gets or sets the static local position (i.e., relative to its parent) of this object.
Do not use if this object is not static.
Default is Vector3.zero
Declaration
public Vector3 LocalPosition { get; set; }
Property Value
Type | Description |
---|---|
UnityEngine.Vector3 |
LocalRotation
Gets or sets the static local rotation (i.e., relative to its parent) of this object.
Do not use if this object is not static.
Default is Quaternion.identity
Declaration
public Quaternion LocalRotation { get; set; }
Property Value
Type | Description |
---|---|
UnityEngine.Quaternion |
LocalScale
Gets or sets the static local scale (i.e., relative to its parent) of this object.
Do not use if this object is not static.
Default is Vector3.one
Declaration
public Vector3 LocalScale { get; set; }
Property Value
Type | Description |
---|---|
UnityEngine.Vector3 |
MaxX
Gets the maximum value in x direction of the position data of this object.
Declaration
public float MaxX { get; }
Property Value
Type | Description |
---|---|
System.Single |
MaxY
Gets the maximum value in y direction of the position data of this object.
Declaration
public float MaxY { get; }
Property Value
Type | Description |
---|---|
System.Single |
MaxZ
Gets the maximum value in z direction of the position data of this object.
Declaration
public float MaxZ { get; }
Property Value
Type | Description |
---|---|
System.Single |
MinX
Gets the minimum value in x direction of the position data of this object.
Declaration
public float MinX { get; }
Property Value
Type | Description |
---|---|
System.Single |
MinY
Gets the minimum value in y direction of the position data of this object.
Declaration
public float MinY { get; }
Property Value
Type | Description |
---|---|
System.Single |
MinZ
Gets the minimum value in z direction of the position data of this object.
Declaration
public float MinZ { get; }
Property Value
Type | Description |
---|---|
System.Single |
ObjectColor
Gets or sets the default object UnityEngine.Color.
Declaration
public Color ObjectColor { get; set; }
Property Value
Type | Description |
---|---|
UnityEngine.Color |
ObjectDataSource
Gets or sets the data source of this object. This can be used to differentiate between different sensors or tracking systems.
Declaration
public string ObjectDataSource { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ObjectModel
Gets or sets the UnityEngine.Mesh for this object. This is used to show the object in its static position or to indicate its current position on its trajectory.
Declaration
public Mesh ObjectModel { get; set; }
Property Value
Type | Description |
---|---|
UnityEngine.Mesh |
ObjectType
Gets the ObjectType of this model.
Declaration
public ObjectType ObjectType { get; }
Property Value
Type | Description |
---|---|
ObjectType |
ParentObjectId
Gets the id of this object's parent or -1 if it has no parent.
Declaration
public int ParentObjectId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
RotationFormat
Gets the RotationFormat of this object.
Declaration
public RotationFormat RotationFormat { get; }
Property Value
Type | Description |
---|---|
RotationFormat |
SessionCount
Gets the number of study sessions of this object.
Declaration
public int SessionCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
TimeFormat
Gets the TimeFormat of this object.
Declaration
public TimeFormat TimeFormat { get; }
Property Value
Type | Description |
---|---|
TimeFormat |
UnitConversionFactor
Gets the conversion factor between the samples' unit of length and 1m.
Declaration
public float UnitConversionFactor { get; }
Property Value
Type | Description |
---|---|
System.Single |
UseStaticPosition
Gets or sets a value indicating whether this object's position is static. Default is false.
Declaration
public bool UseStaticPosition { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
UseStaticRotation
Gets or sets a value indicating whether this object's rotation is static. Default is false.
Declaration
public bool UseStaticRotation { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
UseStaticScale
Gets or sets a value indicating whether this object's scale is static. Default is false.
Declaration
public bool UseStaticScale { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
GetFilteredInfoObjects(Int32, Int32, Func<Sample, Sample, Boolean>)
This method returns a filtered list of data points (samples). This filtering is based on a given session id, a condition id, a starting sample id, a final sample id and a filter.
Declaration
public IEnumerable<Sample> GetFilteredInfoObjects(int session, int condition, Func<Sample, Sample, bool> filter)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | session | The session id to filter for |
System.Int32 | condition | The condition id to filter for |
System.Func<Sample, Sample, System.Boolean> | filter | A System.Func<T1, T2, TResult> used as a filter function. It takes the current sample and the previous sample as arguments and returns true if the current sample should be included, false otherwise. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Sample> | An System.Collections.Generic.IEnumerable<T> of the filtered data points (samples) |
GetFilteredInfoObjects(Int32, Int32, Int32, Int32, Func<Sample, Sample, Boolean>)
This method returns a filtered list of data points (samples). This filtering is based on a given session id, a condition id, a starting sample id, a final sample id and a filter.
Declaration
public IEnumerable<Sample> GetFilteredInfoObjects(int session, int condition, int firstSample, int lastSample, Func<Sample, Sample, bool> filter)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | session | The session id to filter for |
System.Int32 | condition | The condition id to filter for |
System.Int32 | firstSample | The id of the first sample to include |
System.Int32 | lastSample | The id of the last sample to include |
System.Func<Sample, Sample, System.Boolean> | filter | A System.Func<T1, T2, TResult> used as a filter function. It takes the current sample and the previous sample as arguments and returns true if the current sample should be included, false otherwise. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Sample> | An System.Collections.Generic.IEnumerable<T> of the filtered data points (samples) |
GetIndexFromTimestamp(Int64, Int32, Int32, Int32)
Returns the index of the data point for a given timestamp, session and condition.
Declaration
public int GetIndexFromTimestamp(long timestamp, int session, int condition, int startIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | timestamp | The timestamp to use for the lookup |
System.Int32 | session | The session to use |
System.Int32 | condition | The condition to use |
System.Int32 | startIndex | An optional start index for the search. Use this if you are certain that the result index is larger. |
Returns
Type | Description |
---|---|
System.Int32 | The index for the data point at or directly before the given timestamp or 0 if this AnalysisObject is static. |
GetInfoObjects(Int32, Int32)
Returns all samples for a given session and condition.
Declaration
public List<Sample> GetInfoObjects(int session, int condition)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | session | The study session. |
System.Int32 | condition | The study condition. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Sample> | A System.Collections.Generic.List<T> of all samples for the given session and condition. |
GetMaxSpeed(Int32, Int32)
Returns the maximum speed for a given session and condition.
Declaration
public float GetMaxSpeed(int session, int condition)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | session | The study session. |
System.Int32 | condition | The study condition. |
Returns
Type | Description |
---|---|
System.Single | The maximum speed over all samples for the given session and condition in m/s. |
GetMaxTimestamp(Int32, Int32)
Returns the last (i.e., largest) timestamp for a given session and condition
Declaration
public long GetMaxTimestamp(int session, int condition)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | session | The study session. |
System.Int32 | condition | The study condition. |
Returns
Type | Description |
---|---|
System.Int64 | The maximum timestamp. |
GetMinTimestamp(Int32, Int32)
Returns the first (i.e., smallest) timestamp for a given session and condition
Declaration
public long GetMinTimestamp(int session, int condition)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | session | The study session. |
System.Int32 | condition | The study condition. |
Returns
Type | Description |
---|---|
System.Int64 | The minimum timestamp. |
RecomputeBounds()
Recomputes the boundaries in the three axes directions for the samples in this object.
Declaration
public void RecomputeBounds()
SetSamplesForSessionAndCondition(List<Sample>, Int32, Int32, Single)
Sets the samples for a given session and condition.
Declaration
public void SetSamplesForSessionAndCondition(List<Sample> list, int session, int condition, float maxSpeed)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<Sample> | list | The list of samples. |
System.Int32 | session | The study session. |
System.Int32 | condition | The study condition. |
System.Single | maxSpeed | The maximum speed as precomputed. |