DHART
Loading...
Searching...
No Matches
DHARTAPI.Vector3D Struct Reference

A three dimensional vector with built in utility functions. More...

Public Member Functions

 Vector3D (float X, float Y, float Z)
 Create a new instance of Vector3D. More...
 
float[] ToArray ()
 Convert this vector3D to an array of floats. More...
 
float DistanceTo (Vector3D V2)
 Calculate the distance between this vector and another. More...
 
bool IsValid ()
 Check if this vector is valid. More...
 
override string ToString ()
 Construct a string representation of this vector's x, y, and z coordinates. More...
 

Public Attributes

readonly float x
 X component of this vector.
 
readonly float y
 Y component of this vector.
 
readonly float z
 Z component of this vector.
 

Properties

float this[int i] [get]
 Get a component of this vector as if it were an array of 3 floats. More...
 

Detailed Description

A three dimensional vector with built in utility functions.

The Vector3D is the fundamental type of DHARTAPI for handling position and direction values.

Remarks
If using another library with similar types such as unity, consider making extension methods to easily convert them to Vector3D.

Constructor & Destructor Documentation

◆ Vector3D()

DHARTAPI.Vector3D.Vector3D ( float  X,
float  Y,
float  Z 
)

Create a new instance of Vector3D.

Parameters
XThe x coordinate.
YThe y coordinate.
ZThe z coordinate.

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

Member Function Documentation

◆ DistanceTo()

float DHARTAPI.Vector3D.DistanceTo ( Vector3D  V2)

Calculate the distance between this vector and another.

Parameters
V2The vector to calculate distance to.
Returns
The distance between this vector and V2.

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

◆ IsValid()

bool DHARTAPI.Vector3D.IsValid ( )

Check if this vector is valid.

Returns
false if the point contains any components that are not finite.
See also
Single.IsFinite() for more information on how this is calculated.

◆ ToArray()

float[] DHARTAPI.Vector3D.ToArray ( )

Convert this vector3D to an array of floats.

Returns
A 3 element array containing X, Y, and Z

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

◆ ToString()

override string DHARTAPI.Vector3D.ToString ( )

Construct a string representation of this vector's x, y, and z coordinates.

Returns
A string representation of the x,y, and z coordinates of this vector.

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

Property Documentation

◆ this[int i]

float DHARTAPI.Vector3D.this[int i]
get

Get a component of this vector as if it were an array of 3 floats.

Parameters
iThe index of the coordinate to get.
Returns
The x coordinate for 0, the y coordinate for 1, the z coordinate for 2.
Exceptions
System.ArgumentOutOfRangeExceptioni is greater than 2 or less than 0.

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