Vector3
Overview
Vector3 is a class in Aspose.3D FOSS for Typescript.
Vector3.constructor creates a new Vector3 with given x, y, z components.
This class provides 16 methods for working with Vector3 objects in Typescript programs.
Available methods include: angleBetween, compareTo, constructor, cos, cross, dot, equals, getItem, minus, normalize, parse, set, and 4 additional methods.
All public members are accessible to any Typescript application after installing the Aspose.3D FOSS for Typescript package.
Properties: length, length2, one, unitX, unitY, unitZ, and 4 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
x | number | Read/Write | Gets the x. |
y | number | Read/Write | Gets the y. |
z | number | Read/Write | Gets the z. |
length | number | Read | Gets the length. |
length2 | number | Read | Gets the length2. |
zero | Vector3 | Read | Gets the zero. |
one | Vector3 | Read | Gets the one. |
unitX | Vector3 | Read | Gets the unit x. |
unitY | Vector3 | Read | Gets the unit y. |
unitZ | Vector3 | Read | Gets the unit z. |
Methods
| Signature | Description |
|---|---|
constructor(x: number, y: number, z: number) | Creates a new Vector3 using either a number or FVector3 for x and separate y, z |
constructor(vec: FVector3) | |
constructor(v: number) | |
constructor(x: number | FVector3, y: number, z: number) | |
set(newX: number, newY: number, newZ: number) | Assigns new x, y, z values to the vector |
dot(rhs: Vector3) → number | Returns the dot product of this vector with another Vector3 |
cross(rhs: Vector3) → Vector3 | |
normalize() → Vector3 | Returns a unit-length vector in the same direction |
angleBetween(dir: Vector3, up: Vector3) → number | Returns the angle in radians between this vector and dir, using up as reference |
sin() → Vector3 | Returns a vector whose components are the sine of this vector’s components |
cos() → Vector3 | |
compareTo(other: Vector3) → number | Returns a numeric comparison of this vector with another vector |
parse(input: string) → Vector3 | Creates a Vector3 from a string representation |
getItem(key: number) → number | |
setItem(key: number, value: number) | Sets the item value. |
toString() → string | |
equals(other: Vector3) → boolean | Returns true if this vector has the same components as another |
minus(v: Vector3) → Vector3 | Returns a new vector equal to this vector minus the given vector |
times(scalar: number) → Vector3 | Returns a new vector scaled by the given scalar |