The LeapVector class represents a three-component mathematical vector or point such as a direction or position in three-dimensional space. More...
Inherits NSObject.
Instance Methods | |
(float) | - angleTo: |
The angle between this vector and the specified vector in radians. More... | |
(LeapVector *) | - cross: |
The cross product of this vector and the specified vector. More... | |
(float) | - distanceTo: |
The distance between the point represented by this LeapVector object and a point represented by the specified LeapVector object. More... | |
(LeapVector *) | - divide: |
Divide this vector by a number. More... | |
(float) | - dot: |
The dot product of this vector with another vector. More... | |
(BOOL) | - equals: |
Checks LeapVector equality. More... | |
(id) | - initWithVector: |
Copies the specified LeapVector. More... | |
(id) | - initWithX:y:z: |
Creates a new LeapVector with the specified component values. More... | |
(LeapVector *) | - minus: |
Subtract a vector from this vector. More... | |
(LeapVector *) | - negate |
Negate this vector. More... | |
(LeapVector *) | - plus: |
Adds two vectors. More... | |
(LeapVector *) | - times: |
Multiply this vector by a number. More... | |
Class Methods | |
(LeapVector *) | + backward |
The unit vector pointing backward along the positive z-axis: (0, 0, 1). More... | |
(LeapVector *) | + down |
The unit vector pointing down along the negative y-axis: (0, -1, 0). More... | |
(LeapVector *) | + forward |
The unit vector pointing forward along the negative z-axis: (0, 0, -1). More... | |
(LeapVector *) | + left |
The unit vector pointing left along the negative x-axis: (-1, 0, 0). More... | |
(LeapVector *) | + right |
The unit vector pointing right along the positive x-axis: (1, 0, 0). More... | |
(LeapVector *) | + up |
The unit vector pointing up along the positive y-axis: (0, 1, 0). More... | |
(LeapVector *) | + xAxis |
The x-axis unit vector: (1, 0, 0). More... | |
(LeapVector *) | + yAxis |
The y-axis unit vector: (0, 1, 0). More... | |
(LeapVector *) | + zAxis |
The z-axis unit vector: (0, 0, 1). More... | |
(LeapVector *) | + zero |
The zero vector: (0, 0, 0) More... | |
Properties | |
float | magnitude |
The magnitude, or length, of this vector. More... | |
float | magnitudeSquared |
The square of the magnitude, or length, of this vector. More... | |
LeapVector * | normalized |
A normalized copy of this vector. More... | |
float | pitch |
The pitch angle in radians. More... | |
float | roll |
The roll angle in radians. More... | |
NSMutableData * | toFloatPointer |
Returns an NSMutableData object containing the vector components as consecutive floating point values. More... | |
NSArray * | toNSArray |
Returns an NSArray object containing the vector components in the order: x, y, z. More... | |
float | x |
The horizontal component. More... | |
float | y |
The vertical component. More... | |
float | yaw |
The yaw angle in radians. More... | |
float | z |
The depth component. More... | |
The LeapVector class represents a three-component mathematical vector or point such as a direction or position in three-dimensional space.
The Leap 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 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) angleTo: | (const LeapVector *) | vector |
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.
vector | A LeapVector object. |
+ (LeapVector *) backward |
The unit vector pointing backward along the positive z-axis: (0, 0, 1).
- (LeapVector *) cross: | (const LeapVector *) | vector |
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 negate] cross:A]
.
vector | A LeapVector object. |
- (float) distanceTo: | (const LeapVector *) | vector |
The distance between the point represented by this LeapVector object and a point represented by the specified LeapVector object.
vector | A LeapVector object. |
- (LeapVector *) divide: | (float) | scalar |
Divide this vector by a number.
scalar | The scalar divisor; |
- (float) dot: | (const LeapVector *) | vector |
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.
vector | A LeapVector object. |
+ (LeapVector *) down |
The unit vector pointing down along the negative y-axis: (0, -1, 0).
- (BOOL) equals: | (const LeapVector *) | vector |
Checks LeapVector equality.
Vectors are equal if each corresponding component is equal.
vector | The LeapVector to compare. |
+ (LeapVector *) forward |
The unit vector pointing forward along the negative z-axis: (0, 0, -1).
- (id) initWithVector: | (const LeapVector *) | vector |
Copies the specified LeapVector.
vector | The LeapVector to copy. |
- (id) initWithX: | (float) | x | |
y: | (float) | y | |
z: | (float) | z | |
Creates a new LeapVector with the specified component values.
x | The horizontal component. |
y | The vertical component. |
z | The depth component. |
+ (LeapVector *) left |
The unit vector pointing left along the negative x-axis: (-1, 0, 0).
- (LeapVector *) minus: | (const LeapVector *) | vector |
Subtract a vector from this vector.
vector | the LeapVector subtrahend. |
- (LeapVector *) negate |
Negate this vector.
- (LeapVector *) plus: | (const LeapVector *) | vector |
Adds two vectors.
vector | The LeapVector addend. |
+ (LeapVector *) right |
The unit vector pointing right along the positive x-axis: (1, 0, 0).
- (LeapVector *) times: | (float) | scalar |
Multiply this vector by a number.
scalar | The scalar factor. |
+ (LeapVector *) up |
The unit vector pointing up along the positive y-axis: (0, 1, 0).
+ (LeapVector *) xAxis |
+ (LeapVector *) yAxis |
+ (LeapVector *) zAxis |
+ (LeapVector *) zero |
|
readnonatomicassign |
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 LeapVector object.
|
readnonatomicassign |
The square of the magnitude, or length, of this vector.
|
readnonatomicassign |
A normalized copy of this vector.
A normalized vector has the same direction as the original vector, but with a length of one.
|
readnonatomicassign |
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.
|
readnonatomicassign |
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.
|
readnonatomicassign |
Returns an NSMutableData object containing the vector components as consecutive floating point values.
|
readnonatomicassign |
Returns an NSArray object containing the vector components in the order: x, y, z.
|
readwritenonatomicassign |
The horizontal component.
|
readwritenonatomicassign |
The vertical component.
|
readnonatomicassign |
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.
|
readwritenonatomicassign |
The depth component.