Chunks
Moddable voxel sandbox for room-scale VR.
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Chunks.Geometry.Vector4D Struct Reference

Represents a position or offset in 3D space. More...

Inheritance diagram for Chunks.Geometry.Vector4D:

Public Member Functions

 Vector4D (float x, float y)
 Constructs a new vector with the given X and Y components, with 0 for the Z and W components. More...
 
 Vector4D (float x, float y, float z)
 Constructs a new vector with the given X, Y, and Z components, with 0 for the W component. More...
 
 Vector4D (float x, float y, float z, float w)
 Constructs a new vector with the given X, Y, Z, and W components. More...
 
float Dot (Vector4D other)
 Finds the scalar product of this vector and another. More...
 
bool Equals (Vector4D other)
 Tests for equality with another vector. More...
 
bool Equals (Vector4D other, float epsilon)
 Tests for equality with another vector within a given margin of error. More...
 
override bool Equals (object obj)
 Tests for equality with another object. More...
 
override int GetHashCode ()
 Returns the hash code for this vector. More...
 
override string ToString ()
 Returns a string representation of this vector. More...
 

Static Public Member Functions

static implicit operator Vector4D (Vector2D a)
 
static operator Vector2D (Vector4D a)
 
static implicit operator Vector4D (Vector a)
 
static operator Vector (Vector4D a)
 
static Vector4D operator+ (Vector4D a)
 
static Vector4D operator- (Vector4D a)
 Negates a vector. More...
 
static Vector4D operator+ (Vector4D a, Vector4D b)
 Adds two vectors together. More...
 
static Vector4D operator- (Vector4D a, Vector4D b)
 Subtracts a vector from another. More...
 
static Vector4D operator* (Vector4D a, Vector4D b)
 Multiplies two vectors together. More...
 
static Vector4D operator* (float scalar, Vector4D vec)
 Multiplies a vector by a scalar. More...
 
static Vector4D operator* (Vector4D vec, float scalar)
 Multiplies a vector by a scalar. More...
 
static Vector4D operator/ (Vector4D a, Vector4D b)
 Divides each component of a vector by the corresponding component of another. More...
 
static Vector4D operator/ (Vector4D vec, float denom)
 Divides a vector by a scalar. More...
 
static Vector4D Min (Vector4D a, Vector4D b)
 Finds the component-wise minimum of two vectors. More...
 
static Vector4D Max (Vector4D a, Vector4D b)
 Finds the component-wise maximum of two vectors. More...
 
static Vector4D Lerp (Vector4D from, Vector4D to, float t)
 Linearly interpolates between two vectors. More...
 

Public Attributes

readonly float X
 X component of the vector. More...
 
readonly float Y
 Y component of the vector. More...
 
readonly float Z
 Z component of the vector. More...
 
readonly float W
 W component of the vector. More...
 

Static Public Attributes

static readonly Vector4D Zero = new Vector4D(0, 0, 0, 0)
 The zero vector with 0 for X, Y, Z, and W. More...
 
static readonly Vector4D One = new Vector4D(1, 1, 1, 1)
 A vector with 1 for X, Y, Z, and W. More...
 
static readonly Vector4D UnitX = new Vector4D(1, 0, 0, 0)
 A unit vector pointing along +X. More...
 
static readonly Vector4D UnitY = new Vector4D(0, 1, 0, 0)
 A unit vector pointing along +Y. More...
 
static readonly Vector4D UnitZ = new Vector4D(0, 0, 1, 0)
 A unit vector pointing along +Z. More...
 
static readonly Vector4D UnitW = new Vector4D(0, 0, 0, 1)
 A unit vector pointing along +W. More...
 

Properties

float Length [get]
 Finds the length of the vector. More...
 
float LengthSquared [get]
 Finds the squared length of the vector. More...
 
Vector4D NormalizedSafe [get]
 Finds a unit vector pointing in the same direction as this one. If the original vector has approximately zero length, the zero vector is returned. More...
 
Vector4D Normalized [get]
 Finds a unit vector pointing in the same direction as this one. Use NormalizedSafe for vectors that may have zero length. More...
 
float this[int index] [get]
 Gets a component of the vector by indexl with 0 for X, 1 for Y, 2 for Z, and 3 for W. More...
 

Detailed Description

Represents a position or offset in 3D space.

Constructor & Destructor Documentation

Chunks.Geometry.Vector4D.Vector4D ( float  x,
float  y 
)

Constructs a new vector with the given X and Y components, with 0 for the Z and W components.

Parameters
xX component
yY component
Chunks.Geometry.Vector4D.Vector4D ( float  x,
float  y,
float  z 
)

Constructs a new vector with the given X, Y, and Z components, with 0 for the W component.

Parameters
xX component
yY component
zZ component
Chunks.Geometry.Vector4D.Vector4D ( float  x,
float  y,
float  z,
float  w 
)

Constructs a new vector with the given X, Y, Z, and W components.

Parameters
xX component
yY component
zZ component
wW component

Member Function Documentation

float Chunks.Geometry.Vector4D.Dot ( Vector4D  other)

Finds the scalar product of this vector and another.

Parameters
otherVector to find the scalar product with
bool Chunks.Geometry.Vector4D.Equals ( Vector4D  other)

Tests for equality with another vector.

Parameters
otherVector to test for equality with
bool Chunks.Geometry.Vector4D.Equals ( Vector4D  other,
float  epsilon 
)

Tests for equality with another vector within a given margin of error.

Parameters
otherVector to test for equality with
epsilonInclusive margin of error
override bool Chunks.Geometry.Vector4D.Equals ( object  obj)

Tests for equality with another object.

Parameters
objObject to test for equality with
override int Chunks.Geometry.Vector4D.GetHashCode ( )

Returns the hash code for this vector.

static Vector4D Chunks.Geometry.Vector4D.Lerp ( Vector4D  from,
Vector4D  to,
float  t 
)
static

Linearly interpolates between two vectors.

Parameters
fromStarting vector
toEnding vector
tInterpolation parameter
static Vector4D Chunks.Geometry.Vector4D.Max ( Vector4D  a,
Vector4D  b 
)
static

Finds the component-wise maximum of two vectors.

Parameters
aFirst vector to find the maximum of
bSecond vector to find the maximum of
static Vector4D Chunks.Geometry.Vector4D.Min ( Vector4D  a,
Vector4D  b 
)
static

Finds the component-wise minimum of two vectors.

Parameters
aFirst vector to find the minimum of
bSecond vector to find the minimum of
static Chunks.Geometry.Vector4D.operator Vector ( Vector4D  a)
explicitstatic
static Chunks.Geometry.Vector4D.operator Vector2D ( Vector4D  a)
explicitstatic
static implicit Chunks.Geometry.Vector4D.operator Vector4D ( Vector2D  a)
static
static implicit Chunks.Geometry.Vector4D.operator Vector4D ( Vector  a)
static
static Vector4D Chunks.Geometry.Vector4D.operator* ( Vector4D  a,
Vector4D  b 
)
static

Multiplies two vectors together.

Parameters
aFirst vector to multiply
bSecond vector to multiply
static Vector4D Chunks.Geometry.Vector4D.operator* ( float  scalar,
Vector4D  vec 
)
static

Multiplies a vector by a scalar.

Parameters
vecVector to multiply
scalarScalar value to multiply by
static Vector4D Chunks.Geometry.Vector4D.operator* ( Vector4D  vec,
float  scalar 
)
static

Multiplies a vector by a scalar.

Parameters
vecVector to multiply
scalarScalar value to multiply by
static Vector4D Chunks.Geometry.Vector4D.operator+ ( Vector4D  a)
static
static Vector4D Chunks.Geometry.Vector4D.operator+ ( Vector4D  a,
Vector4D  b 
)
static

Adds two vectors together.

Parameters
aFirst vector to add
bSecond vector to add
static Vector4D Chunks.Geometry.Vector4D.operator- ( Vector4D  a)
static

Negates a vector.

Parameters
aVector to negate
static Vector4D Chunks.Geometry.Vector4D.operator- ( Vector4D  a,
Vector4D  b 
)
static

Subtracts a vector from another.

Parameters
aVector to be subtracted from
bVector to subtract
static Vector4D Chunks.Geometry.Vector4D.operator/ ( Vector4D  a,
Vector4D  b 
)
static

Divides each component of a vector by the corresponding component of another.

Parameters
aNumerator vector
bDenomenator vector
static Vector4D Chunks.Geometry.Vector4D.operator/ ( Vector4D  vec,
float  denom 
)
static

Divides a vector by a scalar.

Parameters
vecVector to divide
denomScalar value to divide by
override string Chunks.Geometry.Vector4D.ToString ( )

Returns a string representation of this vector.

Member Data Documentation

readonly Vector4D Chunks.Geometry.Vector4D.One = new Vector4D(1, 1, 1, 1)
static

A vector with 1 for X, Y, Z, and W.

readonly Vector4D Chunks.Geometry.Vector4D.UnitW = new Vector4D(0, 0, 0, 1)
static

A unit vector pointing along +W.

readonly Vector4D Chunks.Geometry.Vector4D.UnitX = new Vector4D(1, 0, 0, 0)
static

A unit vector pointing along +X.

readonly Vector4D Chunks.Geometry.Vector4D.UnitY = new Vector4D(0, 1, 0, 0)
static

A unit vector pointing along +Y.

readonly Vector4D Chunks.Geometry.Vector4D.UnitZ = new Vector4D(0, 0, 1, 0)
static

A unit vector pointing along +Z.

readonly float Chunks.Geometry.Vector4D.W

W component of the vector.

readonly float Chunks.Geometry.Vector4D.X

X component of the vector.

readonly float Chunks.Geometry.Vector4D.Y

Y component of the vector.

readonly float Chunks.Geometry.Vector4D.Z

Z component of the vector.

readonly Vector4D Chunks.Geometry.Vector4D.Zero = new Vector4D(0, 0, 0, 0)
static

The zero vector with 0 for X, Y, Z, and W.

Property Documentation

float Chunks.Geometry.Vector4D.Length
get

Finds the length of the vector.

float Chunks.Geometry.Vector4D.LengthSquared
get

Finds the squared length of the vector.

Vector4D Chunks.Geometry.Vector4D.Normalized
get

Finds a unit vector pointing in the same direction as this one. Use NormalizedSafe for vectors that may have zero length.

Vector4D Chunks.Geometry.Vector4D.NormalizedSafe
get

Finds a unit vector pointing in the same direction as this one. If the original vector has approximately zero length, the zero vector is returned.

float Chunks.Geometry.Vector4D.this[int index]
get

Gets a component of the vector by indexl with 0 for X, 1 for Y, 2 for Z, and 3 for W.

Parameters
indexIndex of the component to get

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