The Vector struct represents a three-component mathematical vector or point such as a direction or position in three-dimensional space. More...
Public Member Functions | |
| float | angleTo (Vector other) |
| The angle between this vector and the specified vector in radians. More... | |
| Vector | cross (Vector other) |
| The cross product of this vector and 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... | |
| Vector | divide (float scalar) |
| Divide vector by a scalar. More... | |
| float | dot (Vector other) |
| The dot product of this vector with another vector. More... | |
| boolean | equals (Vector other) |
| Compare Vector equality component-wise. More... | |
| float | get (long index) |
| Index vector components numerically. More... | |
| float | getX () |
| The horizontal component. More... | |
| float | getY () |
| The vertical component. More... | |
| float | getZ () |
| The depth component. More... | |
| boolean | isValid () |
| Returns true if all of the vector's components are finite. More... | |
| float | magnitude () |
| The magnitude, or length, of this vector. More... | |
| float | magnitudeSquared () |
| The square of the magnitude, or length, of this vector. More... | |
| Vector | minus (Vector other) |
| Subtract vectors component-wise. More... | |
| Vector | normalized () |
| A normalized copy of this vector. More... | |
| Vector | opposite () |
| A copy of this vector pointing in the opposite direction. More... | |
| float | pitch () |
| The pitch angle in radians. More... | |
| Vector | plus (Vector other) |
| Add vectors component-wise. More... | |
| float | roll () |
| The roll angle in radians. More... | |
| void | setX (float value) |
| The horizontal component. More... | |
| void | setY (float value) |
| The vertical component. More... | |
| void | setZ (float value) |
| The depth component. More... | |
| Vector | times (float scalar) |
| Multiply vector by a scalar. More... | |
| String | toString () |
| Returns a string containing this vector in a human readable format: (x, y, z). More... | |
| Vector () | |
| Creates a new Vector with all components set to zero. More... | |
| 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 | yaw () |
| The yaw angle in radians. More... | |
Static Public Member Functions | |
| static Vector | backward () |
| The unit vector pointing backward along the positive z-axis: (0, 0, 1) More... | |
| static Vector | down () |
| The unit vector pointing down along the negative y-axis: (0, -1, 0) More... | |
| static Vector | forward () |
| The unit vector pointing forward along the negative z-axis: (0, 0, -1) More... | |
| static Vector | left () |
| The unit vector pointing left along the negative x-axis: (-1, 0, 0) More... | |
| static Vector | right () |
| The unit vector pointing right along the positive x-axis: (1, 0, 0) More... | |
| static Vector | up () |
| The unit vector pointing up along the positive y-axis: (0, 1, 0) More... | |
| static Vector | xAxis () |
| The x-axis unit vector: (1, 0, 0) More... | |
| static Vector | yAxis () |
| The y-axis unit vector: (0, 1, 0) More... | |
| static Vector | zAxis () |
| The z-axis unit vector: (0, 0, 1) More... | |
| static Vector | zero () |
| The zero vector: (0, 0, 0) More... | |
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.
| Vector | ( | float | _x, |
| float | _y, | ||
| float | _z | ||
| ) |
| float 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.
| other | A Vector object. |
|
static |
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).
| other | A Vector object. |
| float distanceTo | ( | Vector | other | ) |
| Vector divide | ( | float | scalar | ) |
| float 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.
| other | A Vector object. |
|
static |
| boolean equals | ( | Vector | other | ) |
Compare Vector equality component-wise.
|
static |
| float get | ( | long | index | ) |
Index vector components numerically.
Index 0 is x, index 1 is y, and index 2 is z.
| float getX | ( | ) |
The horizontal component.
| float getY | ( | ) |
The vertical component.
| float getZ | ( | ) |
The depth component.
| boolean isValid | ( | ) |
Returns true if all of the vector's components are finite.
If any component is NaN or infinite, then this returns false.
|
static |
| float magnitude | ( | ) |
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.
| float magnitudeSquared | ( | ) |
The square of the magnitude, or length, of this vector.
| Vector normalized | ( | ) |
| Vector opposite | ( | ) |
| float pitch | ( | ) |
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.
|
static |
| float roll | ( | ) |
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.
| void setX | ( | float | value | ) |
The horizontal component.
| void setY | ( | float | value | ) |
The vertical component.
| void setZ | ( | float | value | ) |
The depth component.
| Vector times | ( | float | scalar | ) |
| String toString | ( | ) |
Returns a string containing this vector in a human readable format: (x, y, z).
|
static |
|
static |
| float yaw | ( | ) |
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.
|
static |
|
static |
Java