DHART
Loading...
Searching...
No Matches
DHARTAPI.NativeUtils.HelperFunctions Class Reference

Contains some functions useful for converting data for interop. More...

Static Public Member Functions

static float[] FlattenVectorArray (IEnumerable< Vector3D > vectors)
 Convert a vector array into an array of floats. Slower than passing a Vector3D array. More...
 
static float[] FlattenVectorArray (Vector3D[] vectors)
 Convert a vector3d array into an array of floats. A faster overload to the enumerable method. More...
 
static Vector3D[] FloatArrayToVectorArray (float[] float_array, bool[] result_array)
 Convert a flat array of floats into a vector of points where result_array is true. More...
 

Detailed Description

Contains some functions useful for converting data for interop.

Remarks
These functions are frequently called internally in multiple DHARTAPI namespaces.

Member Function Documentation

◆ FlattenVectorArray() [1/2]

static float[] DHARTAPI.NativeUtils.HelperFunctions.FlattenVectorArray ( IEnumerable< Vector3D vectors)
static

Convert a vector array into an array of floats. Slower than passing a Vector3D array.

Parameters
vectorsThe array of vectors to convert
Returns
An array of floats 3x as big as the array of vectors.

◆ FlattenVectorArray() [2/2]

static float[] DHARTAPI.NativeUtils.HelperFunctions.FlattenVectorArray ( Vector3D[]  vectors)
static

Convert a vector3d array into an array of floats. A faster overload to the enumerable method.

Parameters
vectorsThe array of vectors to convert
Returns
An array of floats 3x as big as the array of vectors.

References DHARTAPI.Vector3D.x, DHARTAPI.Vector3D.y, and DHARTAPI.Vector3D.z.

◆ FloatArrayToVectorArray()

static Vector3D[] DHARTAPI.NativeUtils.HelperFunctions.FloatArrayToVectorArray ( float[]  float_array,
bool[]  result_array 
)
static

Convert a flat array of floats into a vector of points where result_array is true.

Parameters
float_arrayThe array of floats. Every 3 values should correspond to a single Vector3D
result_arrayArray of booleans where if false the Vector3D at this index will be set to null. Otherwise, it will be converted from the float array.
Returns
An array of Vector3D where every 3 floats in float_array is a single vector3D.
Precondition
The length of result_array is equal to 1/3 the length of float_array
Remarks
This function is used frequently internally to handle results of ray intersections.
Exceptions
ArgumentExceptionThe number of elements in result_array is not equal to the number of elements in float_array / 3

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