Tanoda
Leap.Unity.Geometry.Direction3 Struct Reference

A struct very similar to Vector3, but that prevents itself from ever being converted to Vector3.zero. If the Direction3's components would ever be un-normalizable (normalize to Vector3.zero), it will instead return Vector3.forward. (Direction3 implicitly converts to a normalized Vector3.) More...

Public Member Functions

 Direction3 (Vector3 v)
 
 Direction3 (float x, float y, float z)
 
Vector3 Vec ()
 Explicitly converts this Direction3 to a Vector3. More...
 

Static Public Member Functions

static implicit operator Vector3 (Direction3 dir)
 
static implicit operator Direction3 (Vector3 vec)
 
static bool PointsInSameDirection (Direction3 A, Direction3 B)
 Returns whether two Direction3s point in the same direction without normalizing either of the underlying vectors. More...
 

Properties

bool isValid [get]
 Gets whether this Direction3 will normalize without issue (has nonzero magnitude), otherwise the conversion to Vector3 will sanitize to Vector3.forward. More...
 

Detailed Description

A struct very similar to Vector3, but that prevents itself from ever being converted to Vector3.zero. If the Direction3's components would ever be un-normalizable (normalize to Vector3.zero), it will instead return Vector3.forward. (Direction3 implicitly converts to a normalized Vector3.)

Because of this sanitizing behavior, "default(Direction3)" is stored as all zero components, but is converted to Vector3.forward upon implicit conversion to Vector3.

Definition at line 24 of file Direction3.cs.

Constructor & Destructor Documentation

◆ Direction3() [1/2]

Leap.Unity.Geometry.Direction3.Direction3 ( Vector3  v)

Definition at line 35 of file Direction3.cs.

◆ Direction3() [2/2]

Leap.Unity.Geometry.Direction3.Direction3 ( float  x,
float  y,
float  z 
)

Definition at line 39 of file Direction3.cs.

Member Function Documentation

◆ operator Direction3()

static implicit Leap.Unity.Geometry.Direction3.operator Direction3 ( Vector3  vec)
static

Definition at line 63 of file Direction3.cs.

◆ operator Vector3()

static implicit Leap.Unity.Geometry.Direction3.operator Vector3 ( Direction3  dir)
static

Definition at line 55 of file Direction3.cs.

◆ PointsInSameDirection()

static bool Leap.Unity.Geometry.Direction3.PointsInSameDirection ( Direction3  A,
Direction3  B 
)
static

Returns whether two Direction3s point in the same direction without normalizing either of the underlying vectors.

This method is intended to cheaply match bit-idential Direction3s; it's subject to precision error if the magnitudes of the underlying vectors are very different.

Definition at line 75 of file Direction3.cs.

◆ Vec()

Vector3 Leap.Unity.Geometry.Direction3.Vec ( )

Explicitly converts this Direction3 to a Vector3.

Definition at line 51 of file Direction3.cs.

Property Documentation

◆ isValid

bool Leap.Unity.Geometry.Direction3.isValid
get

Gets whether this Direction3 will normalize without issue (has nonzero magnitude), otherwise the conversion to Vector3 will sanitize to Vector3.forward.

Definition at line 48 of file Direction3.cs.


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