Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes | Friends | List of all members
Leap::Vector Class Reference

#include <LeapMath.h>

Inheritance diagram for Leap::Vector:
Inheritance graph
[legend]

Public Member Functions

def __add__ (self, other)
 
def __div__ (self, scalar)
 
def __eq__ (self, other)
 
def __getitem__ (self, index)
 
def __iadd__ (self, other)
 
def __idiv__ (self, scalar)
 
def __imul__ (self, scalar)
 
def __init__ (self, args)
 
def __isub__ (self, other)
 
def __mul__ (self, scalar)
 
def __ne__ (self, other)
 
def __neg__ (self)
 
def __str__ (self)
 
def __sub__ (self, other)
 
def angle_to (self, other)
 
float angleTo (const Vector &other) const
 
def cross (self, other)
 
Vector cross (const Vector &other) const
 
def distance_to (self, other)
 
float distanceTo (const Vector &other) const
 
def dot (self, other)
 
float dot (const Vector &other) const
 
def is_valid (self)
 
bool isValid () const
 
float magnitude () const
 
float magnitudeSquared () const
 
Vector normalized () const
 
bool operator!= (const Vector &other) const
 
Vector operator* (float scalar) const
 
Vectoroperator*= (float scalar)
 
Vector operator+ (const Vector &other) const
 
Vectoroperator+= (const Vector &other)
 
Vector operator- () const
 
Vector operator- (const Vector &other) const
 
Vectoroperator-= (const Vector &other)
 
Vector operator/ (float scalar) const
 
Vectoroperator/= (float scalar)
 
bool operator== (const Vector &other) const
 
float operator[] (unsigned int index) const
 
float pitch () const
 
float roll () const
 
def to_float_array (self)
 
def to_tuple (self)
 
const float * toFloatPointer () const
 
std::string toString () const
 
template<typename Vector3Type >
const Vector3Type toVector3 () const
 
template<typename Vector4Type >
const Vector4Type toVector4 (float w=0.0f) const
 
 Vector ()
 
 Vector (float _x, float _y, float _z)
 
 Vector (const Vector &vector)
 
float yaw () const
 

Static Public Member Functions

static const Vectorbackward ()
 
static const Vectordown ()
 
static const Vectorforward ()
 
static const Vectorleft ()
 
static const Vectorright ()
 
static const Vectorup ()
 
static const VectorxAxis ()
 
static const VectoryAxis ()
 
static const VectorzAxis ()
 
static const Vectorzero ()
 

Public Attributes

 this
 
float x
 
float y
 
float z
 

Static Public Attributes

 magnitude = _swig_property(LeapPython.Vector_magnitude_get)
 
 magnitude_squared = _swig_property(LeapPython.Vector_magnitude_squared_get)
 
 normalized = _swig_property(LeapPython.Vector_normalized_get)
 
 pitch = _swig_property(LeapPython.Vector_pitch_get)
 
 roll = _swig_property(LeapPython.Vector_roll_get)
 
 x = _swig_property(LeapPython.Vector_x_get, LeapPython.Vector_x_set)
 
 y = _swig_property(LeapPython.Vector_y_get, LeapPython.Vector_y_set)
 
 yaw = _swig_property(LeapPython.Vector_yaw_get)
 
 z = _swig_property(LeapPython.Vector_z_get, LeapPython.Vector_z_set)
 

Static Private Attributes

 __getattr__ = lambdaself,name:_swig_getattr(self, Vector, name)
 
 __repr__ = _swig_repr
 
 __setattr__ = lambdaself,name,value:_swig_setattr(self, Vector, name, value)
 
 __swig_destroy__ = LeapPython.delete_Vector
 
dictionary __swig_getmethods__ = {}
 
dictionary __swig_setmethods__ = {}
 

Friends

Vector operator* (float scalar, const Vector &vector)
 
std::ostream & operator<< (std::ostream &out, const Vector &vector)
 

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.

Leap_Axes.png
Since
1.0

Definition at line 60 of file LeapMath.h.

Constructor & Destructor Documentation

Leap::Vector::Vector ( )
inline

Creates a new Vector with all components set to zero.

Since
1.0

Definition at line 65 of file LeapMath.h.

Leap::Vector::Vector ( float  _x,
float  _y,
float  _z 
)
inline

Creates a new Vector with the specified component values.

Since
1.0

Definition at line 74 of file LeapMath.h.

Leap::Vector::Vector ( const Vector vector)
inline

Copies the specified Vector.

Since
1.0

Definition at line 83 of file LeapMath.h.

def Leap.Vector.__init__ (   self,
  args 
)

Definition at line 236 of file Leap.py.

Member Function Documentation

def Leap.Vector.__add__ (   self,
  other 
)

Definition at line 258 of file Leap.py.

def Leap.Vector.__div__ (   self,
  scalar 
)

Definition at line 267 of file Leap.py.

def Leap.Vector.__eq__ (   self,
  other 
)

Definition at line 285 of file Leap.py.

def Leap.Vector.__getitem__ (   self,
  index 
)

Definition at line 294 of file Leap.py.

def Leap.Vector.__iadd__ (   self,
  other 
)

Definition at line 270 of file Leap.py.

def Leap.Vector.__idiv__ (   self,
  scalar 
)

Definition at line 279 of file Leap.py.

def Leap.Vector.__imul__ (   self,
  scalar 
)

Definition at line 276 of file Leap.py.

def Leap.Vector.__isub__ (   self,
  other 
)

Definition at line 273 of file Leap.py.

def Leap.Vector.__mul__ (   self,
  scalar 
)

Definition at line 264 of file Leap.py.

def Leap.Vector.__ne__ (   self,
  other 
)

Definition at line 288 of file Leap.py.

def Leap.Vector.__neg__ (   self)

Definition at line 255 of file Leap.py.

def Leap.Vector.__str__ (   self)

Definition at line 282 of file Leap.py.

def Leap.Vector.__sub__ (   self,
  other 
)

Definition at line 261 of file Leap.py.

def Leap.Vector.angle_to (   self,
  other 
)

Definition at line 246 of file Leap.py.

float Leap::Vector::angleTo ( const Vector other) const
inline

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.

Math_AngleTo.png
Parameters
otherA Vector object.
Returns
The angle between this vector and the specified vector in radians.
Since
1.0

Definition at line 247 of file LeapMath.h.

static const Vector& Leap::Vector::backward ( )
inlinestatic

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

Since
1.0

Definition at line 182 of file LeapMath.h.

def Leap.Vector.cross (   self,
  other 
)

Definition at line 252 of file Leap.py.

Vector Leap::Vector::cross ( const Vector other) const
inline

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).

Math_Cross.png
Parameters
otherA Vector object.
Returns
The cross product of this vector and the specified vector.
Since
1.0

Definition at line 360 of file LeapMath.h.

def Leap.Vector.distance_to (   self,
  other 
)

Definition at line 243 of file Leap.py.

float Leap::Vector::distanceTo ( const Vector other) const
inline

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

Parameters
otherA Vector object.
Returns
The distance from this point to the specified point.
Since
1.0

Definition at line 223 of file LeapMath.h.

def Leap.Vector.dot (   self,
  other 
)

Definition at line 249 of file Leap.py.

float Leap::Vector::dot ( const Vector other) const
inline

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.

Math_Dot.png
Parameters
otherA Vector object.
Returns
The dot product of this vector and the specified vector.
Since
1.0

Definition at line 340 of file LeapMath.h.

static const Vector& Leap::Vector::down ( )
inlinestatic

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

Since
1.0

Definition at line 153 of file LeapMath.h.

static const Vector& Leap::Vector::forward ( )
inlinestatic

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

Since
1.0

Definition at line 172 of file LeapMath.h.

def Leap.Vector.is_valid (   self)

Definition at line 291 of file Leap.py.

bool Leap::Vector::isValid ( ) const
inline

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 538 of file LeapMath.h.

static const Vector& Leap::Vector::left ( )
inlinestatic

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

Since
1.0

Definition at line 134 of file LeapMath.h.

float Leap::Vector::magnitude ( ) const
inline

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.

Returns
The length of this vector.
Since
1.0

Definition at line 197 of file LeapMath.h.

float Leap::Vector::magnitudeSquared ( ) const
inline

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

Returns
The square of the length of this vector.
Since
1.0

Definition at line 209 of file LeapMath.h.

Vector Leap::Vector::normalized ( ) const
inline

A normalized copy of this vector.

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

Returns
A Vector object with a length of one, pointing in the same direction as this Vector object.
Since
1.0

Definition at line 378 of file LeapMath.h.

bool Leap::Vector::operator!= ( const Vector other) const
inline

Compare Vector inequality component-wise.

Since
1.0

Definition at line 527 of file LeapMath.h.

Vector Leap::Vector::operator* ( float  scalar) const
inline

Multiply vector by a scalar.

Since
1.0

Definition at line 425 of file LeapMath.h.

Vector& Leap::Vector::operator*= ( float  scalar)
inline

Multiply vector by a scalar and assign the product.

Since
1.0

Definition at line 477 of file LeapMath.h.

Vector Leap::Vector::operator+ ( const Vector other) const
inline

Add vectors component-wise.

Since
1.0

Definition at line 405 of file LeapMath.h.

Vector& Leap::Vector::operator+= ( const Vector other)
inline

Add vectors component-wise and assign the sum.

Since
1.0

Definition at line 455 of file LeapMath.h.

Vector Leap::Vector::operator- ( ) const
inline

A copy of this vector pointing in the opposite direction.

Returns
A Vector object with all components negated.
Since
1.0

Definition at line 395 of file LeapMath.h.

Vector Leap::Vector::operator- ( const Vector other) const
inline

Subtract vectors component-wise.

Since
1.0

Definition at line 415 of file LeapMath.h.

Vector& Leap::Vector::operator-= ( const Vector other)
inline

Subtract vectors component-wise and assign the difference.

Since
1.0

Definition at line 466 of file LeapMath.h.

Vector Leap::Vector::operator/ ( float  scalar) const
inline

Divide vector by a scalar.

Since
1.0

Definition at line 435 of file LeapMath.h.

Vector& Leap::Vector::operator/= ( float  scalar)
inline

Divide vector by a scalar and assign the quotient.

Since
1.0

Definition at line 488 of file LeapMath.h.

bool Leap::Vector::operator== ( const Vector other) const
inline

Compare Vector equality component-wise.

Since
1.0

Definition at line 518 of file LeapMath.h.

float Leap::Vector::operator[] ( unsigned int  index) const
inline

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

Returns
The x, y, or z component of this Vector, if the specified index value is at least 0 and at most 2; otherwise, returns zero.
Since
1.0

Definition at line 553 of file LeapMath.h.

float Leap::Vector::pitch ( ) const
inline

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.

Math_Pitch_Angle.png
Returns
The angle of this vector above or below the horizon (x-z plane).
Since
1.0

Definition at line 277 of file LeapMath.h.

static const Vector& Leap::Vector::right ( )
inlinestatic

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

Since
1.0

Definition at line 144 of file LeapMath.h.

float Leap::Vector::roll ( ) const
inline

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.

Math_Roll_Angle.png

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.

Returns
The angle of this vector to the right or left of the y-axis.
Since
1.0

Definition at line 322 of file LeapMath.h.

def Leap.Vector.to_float_array (   self)

Definition at line 326 of file Leap.py.

def Leap.Vector.to_tuple (   self)

Definition at line 327 of file Leap.py.

const float* Leap::Vector::toFloatPointer ( ) const
inline

Cast the vector to a float array.

Since
1.0

Definition at line 563 of file LeapMath.h.

std::string Leap::Vector::toString ( ) const
inline

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

Since
1.0

Definition at line 499 of file LeapMath.h.

template<typename Vector3Type >
const Vector3Type Leap::Vector::toVector3 ( ) const
inline

Convert a Leap::Vector to another 3-component Vector type.

The specified type must define a constructor that takes the x, y, and z components as separate parameters.

Since
1.0

Definition at line 575 of file LeapMath.h.

template<typename Vector4Type >
const Vector4Type Leap::Vector::toVector4 ( float  w = 0.0f) const
inline

Convert a Leap::Vector to another 4-component Vector type.

The specified type must define a constructor that takes the x, y, z, and w components as separate parameters. (The homogeneous coordinate, w, is set to zero by default, but you should typically set it to one for vectors representing a position.)

Since
1.0

Definition at line 589 of file LeapMath.h.

static const Vector& Leap::Vector::up ( )
inlinestatic

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

Since
1.0

Definition at line 163 of file LeapMath.h.

static const Vector& Leap::Vector::xAxis ( )
inlinestatic

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

Since
1.0

Definition at line 103 of file LeapMath.h.

float Leap::Vector::yaw ( ) const
inline

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.

Math_Yaw_Angle.png
Returns
The angle of this vector to the right or left of the negative z-axis.
Since
1.0

Definition at line 297 of file LeapMath.h.

static const Vector& Leap::Vector::yAxis ( )
inlinestatic

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

Since
1.0

Definition at line 113 of file LeapMath.h.

static const Vector& Leap::Vector::zAxis ( )
inlinestatic

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

Since
1.0

Definition at line 123 of file LeapMath.h.

static const Vector& Leap::Vector::zero ( )
inlinestatic

The zero vector: (0, 0, 0)

Since
1.0

Definition at line 92 of file LeapMath.h.

Friends And Related Function Documentation

Vector operator* ( float  scalar,
const Vector vector 
)
friend

Multiply vector by a scalar on the left-hand side (C++ only).

Since
1.0

Definition at line 446 of file LeapMath.h.

std::ostream& operator<< ( std::ostream &  out,
const Vector vector 
)
friend

Writes the vector to the output stream using a human readable format: (x, y, z).

Since
1.0

Definition at line 508 of file LeapMath.h.

Member Data Documentation

Leap.Vector.__getattr__ = lambdaself,name:_swig_getattr(self, Vector, name)
staticprivate

Definition at line 233 of file Leap.py.

Leap.Vector.__repr__ = _swig_repr
staticprivate

Definition at line 234 of file Leap.py.

Leap.Vector.__setattr__ = lambdaself,name,value:_swig_setattr(self, Vector, name, value)
staticprivate

Definition at line 231 of file Leap.py.

Leap.Vector.__swig_destroy__ = LeapPython.delete_Vector
staticprivate

Definition at line 329 of file Leap.py.

dictionary Leap.Vector.__swig_getmethods__ = {}
staticprivate

Definition at line 232 of file Leap.py.

dictionary Leap.Vector.__swig_setmethods__ = {}
staticprivate

Definition at line 230 of file Leap.py.

Leap.Vector.magnitude = _swig_property(LeapPython.Vector_magnitude_get)
static

Definition at line 310 of file Leap.py.

Leap.Vector.magnitude_squared = _swig_property(LeapPython.Vector_magnitude_squared_get)
static

Definition at line 313 of file Leap.py.

Leap.Vector.normalized = _swig_property(LeapPython.Vector_normalized_get)
static

Definition at line 325 of file Leap.py.

Leap.Vector.pitch = _swig_property(LeapPython.Vector_pitch_get)
static

Definition at line 316 of file Leap.py.

Leap.Vector.roll = _swig_property(LeapPython.Vector_roll_get)
static

Definition at line 319 of file Leap.py.

Leap.Vector.this

Definition at line 241 of file Leap.py.

Leap.Vector.x = _swig_property(LeapPython.Vector_x_get, LeapPython.Vector_x_set)
static

Definition at line 299 of file Leap.py.

float Leap::Vector::x

The horizontal component.

Since
1.0

Definition at line 597 of file LeapMath.h.

Leap.Vector.y = _swig_property(LeapPython.Vector_y_get, LeapPython.Vector_y_set)
static

Definition at line 303 of file Leap.py.

float Leap::Vector::y

The vertical component.

Since
1.0

Definition at line 602 of file LeapMath.h.

Leap.Vector.yaw = _swig_property(LeapPython.Vector_yaw_get)
static

Definition at line 322 of file Leap.py.

Leap.Vector.z = _swig_property(LeapPython.Vector_z_get, LeapPython.Vector_z_set)
static

Definition at line 307 of file Leap.py.

float Leap::Vector::z

The depth component.

Since
1.0

Definition at line 607 of file LeapMath.h.


The documentation for this class was generated from the following files:


leap_motion
Author(s): Florian Lier , Mirza Shah , Isaac IY Saito
autogenerated on Tue Jun 2 2020 03:58:01