Nano Brain for Unity v0.1
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
LinearAlgebra.Vector3Float Struct Reference

Description

3-dimensional vectors

This uses the right-handed coordinate system.

Public Member Functions

 Vector3Float (float horizontal, float vertical, float depth)
 Create a new 3-dimensional vector.
 
 Vector3Float (Vector3Int v)
 
override string ToString ()
 
override readonly bool Equals (object obj)
 
override readonly int GetHashCode ()
 

Static Public Member Functions

static Vector3Float FromSpherical (Spherical s)
 
static float MagnitudeOf (Vector3Float v)
 The vector length.
 
static float SqrMagnitudeOf (Vector3Float v)
 The squared vector length.
 
static Vector3Float Normalize (Vector3Float v)
 Convert the vector to a length of 1.
 
static Vector3Float operator- (Vector3Float v1)
 Negate te vector such that it points in the opposite direction.
 
static Vector3Float operator- (Vector3Float v1, Vector3Float v2)
 Subtract two vectors.
 
static Vector3Float operator+ (Vector3Float v1, Vector3Float v2)
 Add two vectors.
 
static Vector3Float Scale (Vector3Float v1, Vector3Float v2)
 Scale the vector using another vector.
 
static Vector3Float operator* (Vector3Float v1, float d)
 
static Vector3Float operator* (float d, Vector3Float v1)
 
static Vector3Float operator/ (Vector3Float v1, float d)
 
static bool operator== (Vector3Float v1, Vector3Float v2)
 
static bool operator!= (Vector3Float v1, Vector3Float v2)
 
static float Distance (Vector3Float v1, Vector3Float v2)
 The distance between two vectors.
 
static float Dot (Vector3Float v1, Vector3Float v2)
 The dot product of two vectors.
 
static Vector3Float Cross (Vector3Float v1, Vector3Float v2)
 The cross product of two vectors.
 
static Vector3Float Project (Vector3Float v, Vector3Float n)
 Project the vector on another vector.
 
static Vector3Float ProjectOnPlane (Vector3Float v, Vector3Float n)
 Project the vector on a plane defined by a normal orthogonal to the plane.
 
static AngleFloat UnsignedAngle (Vector3Float v1, Vector3Float v2)
 The angle between two vectors.
 
static AngleFloat SignedAngle (Vector3Float v1, Vector3Float v2, Vector3Float axis)
 The signed angle between two vectors.
 
static Vector3Float Lerp (Vector3Float v1, Vector3Float v2, float f)
 Lerp (linear interpolation) between two vectors.
 

Public Attributes

float horizontal
 The right axis of the vector.
 
float vertical
 The upward axis of the vector.
 
float depth
 The forward axis of the vector.
 

Static Public Attributes

static readonly Vector3Float zero = new Vector3Float(0, 0, 0)
 A vector with zero for all axis.
 
static readonly Vector3Float one = new Vector3Float(1, 1, 1)
 A vector with one for all axis.
 
static readonly Vector3Float left = new Vector3Float(-1, 0, 0)
 A Vector3Float with values (-1, 0, 0)
 
static readonly Vector3Float right = new Vector3Float(1, 0, 0)
 A vector with values (1, 0, 0)
 
static readonly Vector3Float down = new Vector3Float(0, -1, 0)
 A vector with values (0, -1, 0)
 
static readonly Vector3Float up = new Vector3Float(0, 1, 0)
 A vector with values (0, 1, 0)
 
static readonly Vector3Float back = new Vector3Float(0, -1, 0)
 A vector with values (0, 0, -1)
 
static readonly Vector3Float forward = new Vector3Float(0, 1, 0)
 A vector with values (0, 0, 1)
 

Properties

readonly float magnitude [get]
 The vector length.
 
readonly float sqrMagnitude [get]
 The squared vector length.
 
readonly Vector3Float normalized [get]
 Convert the vector to a length of 1.
 

Constructor & Destructor Documentation

◆ Vector3Float()

LinearAlgebra.Vector3Float.Vector3Float ( float  horizontal,
float  vertical,
float  depth 
)

Create a new 3-dimensional vector.

Parameters
horizontalx axis value
verticaly axis value
depthz axis value

Member Function Documentation

◆ MagnitudeOf()

static float LinearAlgebra.Vector3Float.MagnitudeOf ( Vector3Float  v)
static

The vector length.

Parameters
vThe vector for which you need the length
Returns
The vector length

◆ SqrMagnitudeOf()

static float LinearAlgebra.Vector3Float.SqrMagnitudeOf ( Vector3Float  v)
static

The squared vector length.

Parameters
vThe vector for which you need the squared length
Returns
The squared vector length

The squared length is computationally simpler than the real length. Think of Pythagoras A^2 + B^2 = C^2. This leaves out the calculation of the squared root of C.

◆ Normalize()

static Vector3Float LinearAlgebra.Vector3Float.Normalize ( Vector3Float  v)
static

Convert the vector to a length of 1.

Parameters
vThe vector to convert
Returns
The vector normalized to a length of 1

◆ operator-() [1/2]

static Vector3Float LinearAlgebra.Vector3Float.operator- ( Vector3Float  v1)
static

Negate te vector such that it points in the opposite direction.

Parameters
v1
Returns
The negated vector

◆ operator-() [2/2]

static Vector3Float LinearAlgebra.Vector3Float.operator- ( Vector3Float  v1,
Vector3Float  v2 
)
static

Subtract two vectors.

Parameters
v1
v2
Returns
The result of the subtraction

◆ operator+()

static Vector3Float LinearAlgebra.Vector3Float.operator+ ( Vector3Float  v1,
Vector3Float  v2 
)
static

Add two vectors.

Parameters
v1
v2
Returns
The result of the addition

◆ Scale()

static Vector3Float LinearAlgebra.Vector3Float.Scale ( Vector3Float  v1,
Vector3Float  v2 
)
static

Scale the vector using another vector.

Parameters
v1The vector to scale
v2A vector with the scaling factors
Returns
The scaled vector
Remarks
Each component of the vector v1 will be multiplied with the matching component from the scaling vector v2.

◆ Distance()

static float LinearAlgebra.Vector3Float.Distance ( Vector3Float  v1,
Vector3Float  v2 
)
static

The distance between two vectors.

Parameters
v1The first vector
v2The second vector
Returns
The distance between the two vectors

◆ Dot()

static float LinearAlgebra.Vector3Float.Dot ( Vector3Float  v1,
Vector3Float  v2 
)
static

The dot product of two vectors.

Parameters
v1The first vector
v2The second vector
Returns
The dot product of the two vectors

◆ Cross()

static Vector3Float LinearAlgebra.Vector3Float.Cross ( Vector3Float  v1,
Vector3Float  v2 
)
static

The cross product of two vectors.

Parameters
v1The first vector
v2The second vector
Returns
The cross product of the two vectors

◆ Project()

static Vector3Float LinearAlgebra.Vector3Float.Project ( Vector3Float  v,
Vector3Float  n 
)
static

Project the vector on another vector.

Parameters
vThe vector to project
nThe normal vecto to project on
Returns
The projected vector

◆ ProjectOnPlane()

static Vector3Float LinearAlgebra.Vector3Float.ProjectOnPlane ( Vector3Float  v,
Vector3Float  n 
)
static

Project the vector on a plane defined by a normal orthogonal to the plane.

Parameters
vThe vector to project
nThe normal of the plane to project on
Returns
Teh projected vector

◆ UnsignedAngle()

static AngleFloat LinearAlgebra.Vector3Float.UnsignedAngle ( Vector3Float  v1,
Vector3Float  v2 
)
static

The angle between two vectors.

Parameters
v1The first vector
v2The second vector
Returns
The angle between the two vectors
Remarks
This reterns an unsigned angle which is the shortest distance between the two vectors. Use Vector3::SignedAngle if a signed angle is needed.

◆ SignedAngle()

static AngleFloat LinearAlgebra.Vector3Float.SignedAngle ( Vector3Float  v1,
Vector3Float  v2,
Vector3Float  axis 
)
static

The signed angle between two vectors.

Parameters
v1The starting vector
v2The ending vector
axisThe axis to rotate around
Returns
The signed angle between the two vectors

◆ Lerp()

static Vector3Float LinearAlgebra.Vector3Float.Lerp ( Vector3Float  v1,
Vector3Float  v2,
float  f 
)
static

Lerp (linear interpolation) between two vectors.

Parameters
v1The starting vector
v2The ending vector
fThe interpolation distance
Returns
The lerped vector
Remarks
The factor f is unclamped. Value 0 matches the vector v1, Value 1 matches vector v2. Value -1 is vector v1 minus the difference between v1 and v2 etc.

Property Documentation

◆ magnitude

readonly float LinearAlgebra.Vector3Float.magnitude
get

The vector length.

Returns
The vector length

◆ sqrMagnitude

readonly float LinearAlgebra.Vector3Float.sqrMagnitude
get

The squared vector length.

Returns
The squared vector length
Remarks
The squared length is computationally simpler than the real length. Think of Pythagoras A^2 + B^2 = C^2. This leaves out the calculation of the squared root of C.

◆ normalized

readonly Vector3Float LinearAlgebra.Vector3Float.normalized
get

Convert the vector to a length of 1.

Returns
The vector normalized to a length of 1

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