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

Description

A direction in 3D space.

A direction is represented using two angles:

Public Member Functions

 Direction (AngleFloat horizontal, AngleFloat vertical)
 Create a new direction.
 
override readonly string ToString ()
 
readonly UnityEngine.Vector3 ToVector3 ()
 Convert the direction into a carthesian vector.
 
readonly Vector3Float ToVector3 ()
 Convert the direction into a carthesian vector.
 
override readonly bool Equals (object obj)
 
override readonly int GetHashCode ()
 

Static Public Member Functions

static Direction Degrees (float horizontal, float vertical)
 Create a direction using angle values in degrees.
 
static Direction Radians (float horizontal, float vertical)
 Create a direction using angle values in radians.
 
static Direction FromVector3 (UnityEngine.Vector3 v)
 Convert a carthesian vector into a direction.
 
static Direction FromVector3 (Vector3Float v)
 Convert a carthesian vector into a direction.
 
static Direction operator- (Direction d)
 
static bool operator== (Direction d1, Direction d2)
 Tests the equality of two directions.
 
static bool operator!= (Direction d1, Direction d2)
 Tests the inequality of two directions.
 
static AngleFloat UnsignedAngle (Direction d1, Direction d2)
 

Public Attributes

AngleFloat horizontal
 horizontal angle, range = (-180..180] degrees
 
AngleFloat vertical
 vertical angle, range in degrees = (-90..90] degrees
 

Static Public Attributes

static readonly Direction forward = Degrees(0, 0)
 A forward direction with zero for both angles.
 
static readonly Direction backward = Degrees(-180, 0)
 A backward direction with horizontal angle -180 and zero vertical angle.
 
static readonly Direction up = Degrees(0, 90)
 A upward direction with zero horizontal angle and vertical angle 90.
 
static readonly Direction down = Degrees(0, -90)
 A downward direction with zero horizontal angle and vertical angle -90.
 
static readonly Direction left = Degrees(-90, 0)
 A left-pointing direction with horizontal angle -90 and zero vertical angle.
 
static readonly Direction right = Degrees(90, 0)
 A right-pointing direction with horizontal angle 90 and zero vertical angle.
 

Constructor & Destructor Documentation

◆ Direction()

LinearAlgebra.Direction.Direction ( AngleFloat  horizontal,
AngleFloat  vertical 
)

Create a new direction.

Parameters
horizontalThe horizontal angle
verticalThe vertical angle

The direction will be normalized automatically to ensure the angles are within the allowed ranges

Member Function Documentation

◆ Degrees()

static Direction LinearAlgebra.Direction.Degrees ( float  horizontal,
float  vertical 
)
static

Create a direction using angle values in degrees.

Parameters
horizontalThe horizontal angle in degrees
verticalThe vertical angle in degrees
Returns
The direction

The direction will be normalized automatically to ensure the angles are within the allowed ranges

◆ Radians()

static Direction LinearAlgebra.Direction.Radians ( float  horizontal,
float  vertical 
)
static

Create a direction using angle values in radians.

Parameters
horizontalThe horizontal angle in radians
verticalThe vertical angle in radians
Returns
The direction

◆ ToVector3() [1/2]

readonly UnityEngine.Vector3 LinearAlgebra.Direction.ToVector3 ( )

Convert the direction into a carthesian vector.

Returns
The carthesian vector corresponding to this direction.

◆ FromVector3() [1/2]

static Direction LinearAlgebra.Direction.FromVector3 ( UnityEngine::Vector3  v)
static

Convert a carthesian vector into a direction.

Parameters
vThe carthesian vector
Returns
The direction

Information about the length of the carthesian vector is not included in this transformation

◆ ToVector3() [2/2]

readonly Vector3Float LinearAlgebra.Direction.ToVector3 ( )

Convert the direction into a carthesian vector.

Returns
The carthesian vector corresponding to this direction.

◆ FromVector3() [2/2]

static Direction LinearAlgebra.Direction.FromVector3 ( Vector3Float  v)
static

Convert a carthesian vector into a direction.

Parameters
vThe carthesian vector
Returns
The direction

Information about the length of the carthesian vector is not included in this transformation

◆ operator==()

static bool LinearAlgebra.Direction.operator== ( Direction  d1,
Direction  d2 
)
static

Tests the equality of two directions.

Parameters
d1
d2
Returns
True when the direction angles are equal, false otherwise.

◆ operator!=()

static bool LinearAlgebra.Direction.operator!= ( Direction  d1,
Direction  d2 
)
static

Tests the inequality of two directions.

Parameters
d1
d2
Returns
True when the direction angles are not equal, false otherwise.

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