Vector2
Overview
Vector2 is a class in Aspose.3d for Typescript.
Inherits from: Vector2.
Vector2 represents a 2‑D vector with x and y components, provides length properties, item access via getItem/setItem, parsing from strings, and equality comparison.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
x | number | Read | |
y | number | Read | |
length | number | Read | |
length2 | number | Read | Provides the squared magnitude of the vector (avoids sqrt) |
Methods
| Signature | Description |
|---|---|
constructor(x: number, y: number) | |
set(newX: number, newY: number) | Updates the vector’s x and y values to newX and newY |
parse(input: string) → Vector2 | Creates a Vector2 from a string representation and returns the instance |
getItem(key: number) → number | Returns the component value (x for key 0, y for key 1) of the vector |
setItem(key: number, value: number) | Assigns a numeric value to the component identified by key (0 for x, 1 for y) |
toString() → string | |
equals(other: Vector2) → boolean | Checks whether another Vector2 has identical x and y components |