Vector3
3 params vector class
Constructor Summary
Public Constructor | ||
public |
constructor(x: float, y: float, z: float) constructor |
Method Summary
Public Methods | ||
public |
add 2 vectors. |
|
public |
clone(): * |
|
public |
|
|
public |
|
|
public |
get Float32Array format of vector value |
|
public |
length(): float calc a length of vector |
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
quaternionToEuler(quat: Vector4): void |
|
public |
|
|
public |
set vector value |
|
public |
|
|
public |
|
Public Constructors
public constructor(x: float, y: float, z: float) source
constructor
Params:
Name | Type | Attribute | Description |
x | float | X value, default is 0.0 |
|
y | float | Y value, default is 0.0 |
|
z | float | Z value, default is 0.0 |
Public Methods
public add(vec1: Vector3, vec2: Vector3): void source
add 2 vectors. result is set to this matrix.
Return:
void |
public dot(vec: Vector3): float source
Params:
Name | Type | Attribute | Description |
vec | Vector3 |
Return:
float | result of dot |
public mul(vec1: Vector3, rate: float): void source
Params:
Name | Type | Attribute | Description |
vec1 | Vector3 | ||
rate | float |
Return:
void |
public normalize(src: Vector3): void source
Params:
Name | Type | Attribute | Description |
src | Vector3 | optional |
Return:
void |
public quaternionToEuler(quat: Vector4): void source
Params:
Name | Type | Attribute | Description |
quat | Vector4 |
Return:
void |
public setValue(x: float | Vector3, y: float, z: float): void source
set vector value
Params:
Name | Type | Attribute | Description |
x | float | Vector3 | x value, or Vector3 object to copy. if first param is Vector3, second/third params are ignored. |
|
y | float | y value, default is 0.0 |
|
z | float | z value, default is 0.0 |
Return:
void |
Example:
var v1 = new Vector3(1.0, 2.0, 3.0)
var v2 = new Vector3()
var v2.setValue(v1)
// v2 is {x:1.0, y:2.0, z:3.0}