TriEngine  v0.0.16
General-purpose engine in C#/OpenGL
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
TriDevs.TriEngine.Extensions.Vector3Extensions Class Reference

Extensions for Vector3. More...

Static Public Member Functions

static float[] ToFloatArray (this Vector3 vector)
 Converts a Vector3 into a float array (3 floats for XYZ). More...
 
static float[] ToFloatArray (this Vector3[] vectors)
 Converts an array of Vector3 into a float array (3 floats per vector). More...
 

Detailed Description

Extensions for Vector3.

Member Function Documentation

static float [] TriDevs.TriEngine.Extensions.Vector3Extensions.ToFloatArray ( this Vector3  vector)
static

Converts a Vector3 into a float array (3 floats for XYZ).

Parameters
vectorThe vector to convert.
Returns
A float array representation of the vector.
40  {
41  return new[] {vector.X, vector.Y, vector.Z};
42  }
static float [] TriDevs.TriEngine.Extensions.Vector3Extensions.ToFloatArray ( this Vector3[]  vectors)
static

Converts an array of Vector3 into a float array (3 floats per vector).

Parameters
vectorsThe vector array to convert.
Returns
A float array representation of the vectors.
51  {
52  var result = new float[3 * vectors.Length];
53 
54  for (var i = 0; i < vectors.Length; i++)
55  {
56  var index = i * 3;
57 
58  result[index] = vectors[i].X;
59  result[index + 1] = vectors[i].Y;
60  result[index + 2] = vectors[i].Z;
61  }
62 
63  return result;
64  }

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