KudanAR - iOS  1.6.0
ARVector4 Class Reference

#import <ARVector4.h>

Inherits NSObject.

Instance Methods

(ARVector4 *) - addVector:
 
(ARVector4 *) - localAddVector:
 
(ARVector4 *) - subtractVector:
 
(ARVector4 *) - localSubtractVector:
 
(ARVector4 *) - multiplyByVector:
 
(ARVector4 *) - localMultiplyByVector:
 
(ARVector4 *) - divideByVector:
 
(ARVector4 *) - localDivideByVector:
 
(float) - dotProductWithVector:
 
(void) - setX:y:z:w:
 
(void) - setModifyObserverWithDelegate:selector:
 

Class Methods

(ARVector4 *) + vectorWithZero
 
(ARVector4 *) + vectorWithValuesX:y:z:w:
 
(ARVector4 *) + vectorWithOML: [implementation]
 

Protected Attributes

SEL _vectorModifiedSelector
 
__weak id _delegate
 

Properties

float x
 
float y
 
float z
 
float w
 
OgreMathLib::Vector4 vectorOML [implementation]
 

Detailed Description

An ARVector4 is a 4-Dimensional vector consisting of an X, Y, Z and W component. Generally used for graphical shading.

Method Documentation

◆ addVector:

- (ARVector4 *) addVector: (ARVector4 *)  vector

Adds the components of two vectors together and returns the result.

Example of use:

ARVector4 vectorOne = [ARVector4 vectorWithValuesX:1.0 y:2.0 z:3.0 w:4.0];
ARVector4 vectorTwo = [ARVector4 vectorWithValuesX:5.0 y:6.0 z:7.0 w:8.0];
ARVector4 vectorThree = [vectorOne addVector:vectorTwo];
Parameters
vectorThe vector to add to this vector.
Returns
A new ARVector4 with values (X1 + X2, Y1 + Y2, Z1 + Z2, W1 + W2).

◆ divideByVector:

- (ARVector4 *) divideByVector: (ARVector4 *)  vector

Divides this vector's components by the components of a given vector a returns the result.

Example of use:

ARVector4 vectorOne = [ARVector4 vectorWithValuesX:8.0 y:7.0 z:6.0 w:5.0];
ARVector4 vectorTwo = [ARVector4 vectorWithValuesX:4.0 y:3.0 z:2.0 w:1.0];
ARVector4 vectorThree = [vectorOne divideByVector:vectorTwo];
Parameters
vectorThe vector to divide this vector by.
Returns
A new ARVector4 with values (X1 / X2, Y1 / Y2, Z1 / Z2, W1 / W2).

◆ dotProductWithVector:

- (float) dotProductWithVector: (ARVector4 *)  vector

Calculates the dot product of this vector and another given vector and returns the result.

Example of use:

ARVector4 vectorOne = [ARVector4 vectorWithValuesX:1.0 y:2.0 z:3.0 w:4.0];
ARVector4 vectorTwo = [ARVector4 vectorWithValuesX:7.0 y:3.0 z:9.0 w:1.0];
float dotProduct = [vectorOne distanceToVector:vectorTwo];
Parameters
vectorThe other vector to use for the dot product calculation.
Returns
The dot product of the two vectors, ((X1 * X2) + (Y1 * Y2) + (Z1 * Z2) + (W1 * W2)).

◆ localAddVector:

- (ARVector4 *) localAddVector: (ARVector4 *)  vector

Adds the components of two vectors together and stores the result in this vector.

Example of use:

ARVector4 vectorOne = [ARVector4 vectorWithValuesX:1.0 y:2.0 z:3.0 w:4.0];
ARVector4 vectorTwo = [ARVector4 vectorWithValuesX:5.0 y:6.0 z:7.0 w:8.0];
[vectorOne localAddVector:vectorTwo];
Parameters
vectorThe vector to add to this vector.
Returns
This vector with values (X1 + X2, Y1 + Y2, Z1 + Z2, W1 + W2).

◆ localDivideByVector:

- (ARVector4 *) localDivideByVector: (ARVector4 *)  vector

Divides this vector's components by the components of a given vector a stores the result in this vector.

Example of use:

ARVector4 vectorOne = [ARVector4 vectorWithValuesX:8.0 y:7.0 z:6.0 w:5.0];
ARVector4 vectorTwo = [ARVector4 vectorWithValuesX:4.0 y:3.0 z:2.0 w:1.0];
[vectorOne divideByVector:vectorTwo];
Parameters
vectorThe vector to divide this vector by.
Returns
This vector with values (X1 / X2, Y1 / Y2, Z1 / Z2, W1 / W2).

◆ localMultiplyByVector:

- (ARVector4 *) localMultiplyByVector: (ARVector4 *)  vector

Multiplies this vector's components by the components of a given vector and stores the result in this vector. This is NOT the same as the Dot Product OR the Cross Product. It simply multiplies the components together.

Example of use:

ARVector4 vectorOne = [ARVector4 vectorWithValuesX:1.0 y:2.0 z:3.0 w:4.0];
ARVector4 vectorTwo = [ARVector4 vectorWithValuesX:5.0 y:6.0 z:7.0 w:8.0];
[vectorOne localMultiplyByVector:vectorTwo];
Parameters
vectorThe vector to multiply with this vector.
Returns
This vector with values (X1 * X2, Y1 * Y2, Z1 * Z2, W1 * W2).

◆ localSubtractVector:

- (ARVector4 *) localSubtractVector: (ARVector4 *)  vector

Subtracts a given vector's components from the componentes this vector and stores the result in this vector.

Example of use:

ARVector4 vectorOne = [ARVector4 vectorWithValuesX:8.0 y:7.0 z:6.0 w:5.0];
ARVector4 vectorTwo = [ARVector4 vectorWithValuesX:4.0 y:3.0 z:2.0 w:1.0];
[vectorOne subtractVector:vectorTwo];
Parameters
vectorThe vector to subtract from this vector.
Returns
Thie vector with values (X1 - X2, Y1 - Y2, Z1 - Z2, W1 - W2).

◆ multiplyByVector:

- (ARVector4 *) multiplyByVector: (ARVector4 *)  vector

Multiplies this vector's components by the components of a given vector and returns the result. This is NOT the same as the Dot Product OR the Cross Product. It simply multiplies the components together.

Example of use:

ARVector4 vectorOne = [ARVector4 vectorWithValuesX:1.0 y:2.0 z:3.0 w:4.0];
ARVector4 vectorTwo = [ARVector4 vectorWithValuesX:5.0 y:6.0 z:7.0 w:8.0];
ARVector4 vectorThree = [vectorOne multiplyByVector:vectorTwo];
Parameters
vectorThe vector to multiply with this vector.
Returns
A new ARVector4 with values (X1 * X2, Y1 * Y2, Z1 * Z2, W1 * W2).

◆ setModifyObserverWithDelegate:selector:

- (void) setModifyObserverWithDelegate: (id)  delegate
selector: (SEL)  selector 

Allows an ARNode to add an ARVector3 as an observer.

Parameters
delegateThe delegate to assign to this vector.
selectorThe selector method to call when the vector is modified.

◆ setX:y:z:w:

- (void) setX: (float)  x
y: (float)  y
z: (float)  z
w: (float)  w 

Sets the components of this vector with the given values.

Example of use:

[vector setX:1.0 y:2.0 z:3.0 w:4.0];
Parameters
xThe value to give the X component of this vector.
yThe value to give the Y component of this vector.
zThe value to give the Z component of this vector.
wThe value to give the W component of this vector.

◆ subtractVector:

- (ARVector4 *) subtractVector: (ARVector4 *)  vector

Subtracts a given vector's components from the components of this vector and returns the result.

Example of use:

ARVector4 vectorOne = [ARVector4 vectorWithValuesX:8.0 y:7.0 z:6.0 w:5.0];
ARVector4 vectorTwo = [ARVector4 vectorWithValuesX:4.0 y:3.0 z:2.0 w:1.0];
ARVector4 vectorThree = [vectorOne subtractVector:vectorTwo];
Parameters
vectorThe vector to subtract from this vector.
Returns
A new ARVector4 with values (X1 - X2, Y1 - Y2, Z1 - Z2, W1 - W2).

◆ vectorWithValuesX:y:z:w:

+ (ARVector4 *) vectorWithValuesX: (float)  x
y: (float)  y
z: (float)  z
w: (float)  w 

Create a vector with the specified component values.

Example of use:

ARVector4 *vector = [ARVector4 vectorWithValuesX:1.0 y:0.0 z:1.0 w:0.0];
Parameters
xThe x component of the vector.
yThe y component of the vector.
zThe z component of the vector.
wThe w component of the vector.
Returns
A vector with components set to the specified values.

◆ vectorWithZero

+ (ARVector4 *) vectorWithZero

Create a vector with all 4 components set to 0.

Example of use:

Returns
A vector with (0, 0, 0, 0)

Property Documentation

◆ w

- (float) w
readwritenonatomicassign

The w value of the vector.

◆ x

- (float) x
readwritenonatomicassign

The x value of the vector.

◆ y

- (float) y
readwritenonatomicassign

The y value of the vector.

◆ z

- (float) z
readwritenonatomicassign

The z value of the vector.


The documentation for this class was generated from the following files:
ARVector4
Definition: ARVector4.h:7
ARVector4::z
float z
Definition: ARVector4.h:21
ARVector4::y
float y
Definition: ARVector4.h:16
+[ARVector4 vectorWithZero]
ARVector4 * vectorWithZero()
Definition: ARVector4.mm:34
ARVector4::w
float w
Definition: ARVector4.h:26