Tanoda
Leap.Vector Struct Reference

The Vector struct represents a three-component mathematical vector or point such as a direction or position in three-dimensional space. More...

Inheritance diagram for Leap.Vector:

Public Member Functions

float[] ToFloatArray ()
 
 Vector (float x, float y, float z)
 Creates a new Vector with the specified component values. More...
 
 Vector (Vector vector)
 Copies the specified Vector. More...
 
float DistanceTo (Vector other)
 The distance between the point represented by this Vector object and a point represented by the specified Vector object. More...
 
float AngleTo (Vector other)
 The angle between this vector and the specified vector in radians. More...
 
float Dot (Vector other)
 The dot product of this vector with another vector. More...
 
Vector Cross (Vector other)
 The cross product of this vector and the specified vector. More...
 
override string ToString ()
 Returns a string containing this vector in a human readable format: (x, y, z). More...
 
bool Equals (Vector v)
 Compare Vector equality component-wise. More...
 
override bool Equals (Object obj)
 
bool IsValid ()
 Returns true if all of the vector's components are finite. If any component is NaN or infinite, then this returns false. More...
 
override int GetHashCode ()
 

Static Public Member Functions

static Vector operator+ (Vector v1, Vector v2)
 
static Vector operator- (Vector v1, Vector v2)
 
static Vector operator* (Vector v1, float scalar)
 
static Vector operator* (float scalar, Vector v1)
 
static Vector operator/ (Vector v1, float scalar)
 
static Vector operator- (Vector v1)
 
static bool operator== (Vector v1, Vector v2)
 
static bool operator!= (Vector v1, Vector v2)
 
static Vector Lerp (Vector a, Vector b, float t)
 

Public Attributes

float x
 
float y
 
float z
 

Static Public Attributes

static readonly Vector Zero = new Vector(0, 0, 0)
 The zero vector: (0, 0, 0) More...
 
static readonly Vector Ones = new Vector(1, 1, 1)
 The ones vector: (1, 1, 1) More...
 
static readonly Vector XAxis = new Vector(1, 0, 0)
 The x-axis unit vector: (1, 0, 0) More...
 
static readonly Vector YAxis = new Vector(0, 1, 0)
 The y-axis unit vector: (0, 1, 0) More...
 
static readonly Vector ZAxis = new Vector(0, 0, 1)
 The z-axis unit vector: (0, 0, 1) More...
 
static readonly Vector Forward = new Vector(0, 0, -1)
 The unit vector pointing forward along the negative z-axis: (0, 0, -1) More...
 
static readonly Vector Backward = new Vector(0, 0, 1)
 The unit vector pointing backward along the positive z-axis: (0, 0, 1) More...
 
static readonly Vector Left = new Vector(-1, 0, 0)
 The unit vector pointing left along the negative x-axis: (-1, 0, 0) More...
 
static readonly Vector Right = new Vector(1, 0, 0)
 The unit vector pointing right along the positive x-axis: (1, 0, 0) More...
 
static readonly Vector Up = new Vector(0, 1, 0)
 The unit vector pointing up along the positive y-axis: (0, 1, 0) More...
 
static readonly Vector Down = new Vector(0, -1, 0)
 The unit vector pointing down along the negative y-axis: (0, -1, 0) More...
 

Properties

float this[uint index] [get, set]
 Index vector components numerically. Index 0 is x, index 1 is y, and index 2 is z. More...
 
float Magnitude [get]
 The magnitude, or length, of this vector. More...
 
float MagnitudeSquared [get]
 The square of the magnitude, or length, of this vector. More...
 
float Pitch [get]
 The pitch angle in radians. More...
 
float Roll [get]
 The roll angle in radians. More...
 
float Yaw [get]
 The yaw angle in radians. More...
 
Vector Normalized [get]
 A normalized copy of this vector. More...
 

Detailed Description

The Vector struct represents a three-component mathematical vector or point such as a direction or position in three-dimensional space.

The Leap Motion software employs a right-handed Cartesian coordinate system. Values given are in units of real-world millimeters. The origin is centered at the center of the Leap Motion Controller. The x- and z-axes lie in the horizontal plane, with the x-axis running parallel to the long edge of the device. The y-axis is vertical, with positive values increasing upwards (in contrast to the downward orientation of most computer graphics coordinate systems). The z-axis has positive values increasing away from the computer screen.

Since
1.0

Definition at line 36 of file Vector.cs.

Constructor & Destructor Documentation

◆ Vector() [1/2]

Leap.Vector.Vector ( float  x,
float  y,
float  z 
)

Creates a new Vector with the specified component values.

Since
1.0

Definition at line 78 of file Vector.cs.

◆ Vector() [2/2]

Leap.Vector.Vector ( Vector  vector)

Copies the specified Vector.

Since
1.0

Definition at line 89 of file Vector.cs.

Member Function Documentation

◆ AngleTo()

float Leap.Vector.AngleTo ( Vector  other)

The angle between this vector and the specified vector in radians.

The angle is measured in the plane formed by the two vectors. The angle returned is always the smaller of the two conjugate angles. Thus A.angleTo(B) == B.angleTo(A) and is always a positive value less than or equal to pi radians (180 degrees).

If either vector has zero length, then this function returns zero.

Since
1.0

Definition at line 120 of file Vector.cs.

◆ Cross()

Vector Leap.Vector.Cross ( Vector  other)

The cross product of this vector and the specified vector.

The cross product is a vector orthogonal to both original vectors. It has a magnitude equal to the area of a parallelogram having the two vectors as sides. The direction of the returned vector is determined by the right-hand rule. Thus A.cross(B) == -B.cross(A).

Since
1.0

Definition at line 155 of file Vector.cs.

◆ DistanceTo()

float Leap.Vector.DistanceTo ( Vector  other)

The distance between the point represented by this Vector object and a point represented by the specified Vector object.

Since
1.0

Definition at line 102 of file Vector.cs.

◆ Dot()

float Leap.Vector.Dot ( Vector  other)

The dot product of this vector with another vector.

The dot product is the magnitude of the projection of this vector onto the specified vector.

Since
1.0

Definition at line 141 of file Vector.cs.

◆ Equals() [1/2]

override bool Leap.Vector.Equals ( Object  obj)

Definition at line 177 of file Vector.cs.

◆ Equals() [2/2]

bool Leap.Vector.Equals ( Vector  v)

Compare Vector equality component-wise.

Since
1.0

Definition at line 173 of file Vector.cs.

◆ GetHashCode()

override int Leap.Vector.GetHashCode ( )

Definition at line 374 of file Vector.cs.

◆ IsValid()

bool Leap.Vector.IsValid ( )

Returns true if all of the vector's components are finite. If any component is NaN or infinite, then this returns false.

Since
1.0

Definition at line 186 of file Vector.cs.

◆ Lerp()

static Vector Leap.Vector.Lerp ( Vector  a,
Vector  b,
float  t 
)
static

Definition at line 366 of file Vector.cs.

◆ operator!=()

static bool Leap.Vector.operator!= ( Vector  v1,
Vector  v2 
)
static

Definition at line 66 of file Vector.cs.

◆ operator*() [1/2]

static Vector Leap.Vector.operator* ( float  scalar,
Vector  v1 
)
static

Definition at line 50 of file Vector.cs.

◆ operator*() [2/2]

static Vector Leap.Vector.operator* ( Vector  v1,
float  scalar 
)
static

Definition at line 46 of file Vector.cs.

◆ operator+()

static Vector Leap.Vector.operator+ ( Vector  v1,
Vector  v2 
)
static

Definition at line 38 of file Vector.cs.

◆ operator-() [1/2]

static Vector Leap.Vector.operator- ( Vector  v1)
static

Definition at line 58 of file Vector.cs.

◆ operator-() [2/2]

static Vector Leap.Vector.operator- ( Vector  v1,
Vector  v2 
)
static

Definition at line 42 of file Vector.cs.

◆ operator/()

static Vector Leap.Vector.operator/ ( Vector  v1,
float  scalar 
)
static

Definition at line 54 of file Vector.cs.

◆ operator==()

static bool Leap.Vector.operator== ( Vector  v1,
Vector  v2 
)
static

Definition at line 62 of file Vector.cs.

◆ ToFloatArray()

float[] Leap.Vector.ToFloatArray ( )

Definition at line 70 of file Vector.cs.

◆ ToString()

override string Leap.Vector.ToString ( )

Returns a string containing this vector in a human readable format: (x, y, z).

Since
1.0

Definition at line 165 of file Vector.cs.

Member Data Documentation

◆ Backward

readonly Vector Leap.Vector.Backward = new Vector(0, 0, 1)
static

The unit vector pointing backward along the positive z-axis: (0, 0, 1)

Definition at line 343 of file Vector.cs.

◆ Down

readonly Vector Leap.Vector.Down = new Vector(0, -1, 0)
static

The unit vector pointing down along the negative y-axis: (0, -1, 0)

Definition at line 363 of file Vector.cs.

◆ Forward

readonly Vector Leap.Vector.Forward = new Vector(0, 0, -1)
static

The unit vector pointing forward along the negative z-axis: (0, 0, -1)

Definition at line 338 of file Vector.cs.

◆ Left

readonly Vector Leap.Vector.Left = new Vector(-1, 0, 0)
static

The unit vector pointing left along the negative x-axis: (-1, 0, 0)

Definition at line 348 of file Vector.cs.

◆ Ones

readonly Vector Leap.Vector.Ones = new Vector(1, 1, 1)
static

The ones vector: (1, 1, 1)

Definition at line 318 of file Vector.cs.

◆ Right

readonly Vector Leap.Vector.Right = new Vector(1, 0, 0)
static

The unit vector pointing right along the positive x-axis: (1, 0, 0)

Definition at line 353 of file Vector.cs.

◆ Up

readonly Vector Leap.Vector.Up = new Vector(0, 1, 0)
static

The unit vector pointing up along the positive y-axis: (0, 1, 0)

Definition at line 358 of file Vector.cs.

◆ x

float Leap.Vector.x

Definition at line 218 of file Vector.cs.

◆ XAxis

readonly Vector Leap.Vector.XAxis = new Vector(1, 0, 0)
static

The x-axis unit vector: (1, 0, 0)

Definition at line 323 of file Vector.cs.

◆ y

float Leap.Vector.y

Definition at line 219 of file Vector.cs.

◆ YAxis

readonly Vector Leap.Vector.YAxis = new Vector(0, 1, 0)
static

The y-axis unit vector: (0, 1, 0)

Definition at line 328 of file Vector.cs.

◆ z

float Leap.Vector.z

Definition at line 220 of file Vector.cs.

◆ ZAxis

readonly Vector Leap.Vector.ZAxis = new Vector(0, 0, 1)
static

The z-axis unit vector: (0, 0, 1)

Definition at line 333 of file Vector.cs.

◆ Zero

readonly Vector Leap.Vector.Zero = new Vector(0, 0, 0)
static

The zero vector: (0, 0, 0)

Definition at line 313 of file Vector.cs.

Property Documentation

◆ Magnitude

float Leap.Vector.Magnitude
get

The magnitude, or length, of this vector.

The magnitude is the L2 norm, or Euclidean distance between the origin and the point represented by the (x, y, z) components of this Vector object.

Since
1.0

Definition at line 229 of file Vector.cs.

◆ MagnitudeSquared

float Leap.Vector.MagnitudeSquared
get

The square of the magnitude, or length, of this vector.

Since
1.0

Definition at line 237 of file Vector.cs.

◆ Normalized

Vector Leap.Vector.Normalized
get

A normalized copy of this vector.

A normalized vector has the same direction as the original vector, but with a length of one.

Since
1.0

Definition at line 299 of file Vector.cs.

◆ Pitch

float Leap.Vector.Pitch
get

The pitch angle in radians.

Pitch is the angle between the negative z-axis and the projection of the vector onto the y-z plane. In other words, pitch represents rotation around the x-axis. If the vector points upward, the returned angle is between 0 and pi radians (180 degrees); if it points downward, the angle is between 0 and -pi radians.

Since
1.0

Definition at line 252 of file Vector.cs.

◆ Roll

float Leap.Vector.Roll
get

The roll angle in radians.

Roll is the angle between the y-axis and the projection of the vector onto the x-y plane. In other words, roll represents rotation around the z-axis. If the vector points to the left of the y-axis, then the returned angle is between 0 and pi radians (180 degrees); if it points to the right, the angle is between 0 and -pi radians.

Use this function to get roll angle of the plane to which this vector is a normal. For example, if this vector represents the normal to the palm, then this function returns the tilt or roll of the palm plane compared to the horizontal (x-z) plane.

Since
1.0

Definition at line 272 of file Vector.cs.

◆ this[uint index]

float Leap.Vector.this[uint index]
getset

Index vector components numerically. Index 0 is x, index 1 is y, and index 2 is z.

Since
1.0

Definition at line 197 of file Vector.cs.

◆ Yaw

float Leap.Vector.Yaw
get

The yaw angle in radians.

Yaw is the angle between the negative z-axis and the projection of the vector onto the x-z plane. In other words, yaw represents rotation around the y-axis. If the vector points to the right of the negative z-axis, then the returned angle is between 0 and pi radians (180 degrees); if it points to the left, the angle is between 0 and -pi radians.

Since
1.0

Definition at line 287 of file Vector.cs.


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