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

NameTypeAccessDescription
xnumberRead
ynumberRead
lengthnumberRead
length2numberReadProvides the squared magnitude of the vector (avoids sqrt)

Methods

SignatureDescription
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)Vector2Creates a Vector2 from a string representation and returns the instance
getItem(key: number)numberReturns 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)booleanChecks whether another Vector2 has identical x and y components