|
float | angleTo (const Vector &other) const |
| The angle between this vector and the specified vector in radians.
|
|
Vector | cross (const Vector &other) const |
| The cross product of this vector and the specified vector.
|
|
float | distanceTo (const Vector &other) const |
| The distance between the point represented by this Vector object and a point represented by the specified Vector object.
|
|
float | dot (const Vector &other) const |
| The dot product of this vector with another vector.
|
|
bool | isValid () const |
| Returns true if all of the vector's components are finite.
|
|
float | magnitude () const |
| The magnitude, or length, of this vector.
|
|
float | magnitudeSquared () const |
| The square of the magnitude, or length, of this vector.
|
|
Vector | normalized () const |
| A normalized copy of this vector.
|
|
bool | operator!= (const Vector &other) const |
| Compare Vector inequality component-wise.
|
|
Vector | operator* (float scalar) const |
| Multiply vector by a scalar.
|
|
Vector & | operator*= (float scalar) |
| Multiply vector by a scalar and assign the product.
|
|
Vector | operator+ (const Vector &other) const |
| Add vectors component-wise.
|
|
Vector & | operator+= (const Vector &other) |
| Add vectors component-wise and assign the sum.
|
|
Vector | operator- () const |
| A copy of this vector pointing in the opposite direction.
|
|
Vector | operator- (const Vector &other) const |
| Subtract vectors component-wise.
|
|
Vector & | operator-= (const Vector &other) |
| Subtract vectors component-wise and assign the difference.
|
|
Vector | operator/ (float scalar) const |
| Divide vector by a scalar.
|
|
Vector & | operator/= (float scalar) |
| Divide vector by a scalar and assign the quotient.
|
|
bool | operator== (const Vector &other) const |
| Compare Vector equality component-wise.
|
|
float | operator[] (unsigned int index) const |
| Index vector components numerically.
|
|
float | pitch () const |
| The pitch angle in radians.
|
|
float | roll () const |
| The roll angle in radians.
|
|
const float * | toFloatPointer () const |
| Cast the vector to a float array.
|
|
std::string | toString () const |
| Returns a string containing this vector in a human readable format: (x, y, z).
|
|
template<typename Vector3Type > |
const Vector3Type | toVector3 () const |
| Convert a Leap::Vector to another 3-component Vector type.
|
|
template<typename Vector4Type > |
const Vector4Type | toVector4 (float w=0.0f) const |
| Convert a Leap::Vector to another 4-component Vector type.
|
|
| Vector () |
| Creates a new Vector with all components set to zero.
|
|
| Vector (float _x, float _y, float _z) |
| Creates a new Vector with the specified component values.
|
|
| Vector (const Vector &vector) |
| Copies the specified Vector.
|
|
float | yaw () const |
| The yaw angle in radians.
|
|
|
static const Vector & | backward () |
| The unit vector pointing backward along the positive z-axis: (0, 0, 1)
|
|
static const Vector & | down () |
| The unit vector pointing down along the negative y-axis: (0, -1, 0)
|
|
static const Vector & | forward () |
| The unit vector pointing forward along the negative z-axis: (0, 0, -1)
|
|
static const Vector & | left () |
| The unit vector pointing left along the negative x-axis: (-1, 0, 0)
|
|
static const Vector & | right () |
| The unit vector pointing right along the positive x-axis: (1, 0, 0)
|
|
static const Vector & | up () |
| The unit vector pointing up along the positive y-axis: (0, 1, 0)
|
|
static const Vector & | xAxis () |
| The x-axis unit vector: (1, 0, 0)
|
|
static const Vector & | yAxis () |
| The y-axis unit vector: (0, 1, 0)
|
|
static const Vector & | zAxis () |
| The z-axis unit vector: (0, 0, 1)
|
|
static const Vector & | zero () |
| The zero vector: (0, 0, 0)
|
|
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 device. 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.
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.
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.
float rollInRadians = thatVector.roll();
- Returns
- The angle of this vector to the right or left of the y-axis.
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.)