---
Product: Aspose.3D
Platform: typescript
Page Type: reference
Canonical URL: https://reference.aspose.org/3d/typescript/Vector2
---

# Vector2

## Overview

`Vector2` is a class in Aspose.3D FOSS for Typescript.

Vector2.set updates the vector's x and y components to new values.

This class provides 7 methods for working with Vector2 objects in Typescript programs.
Available methods include: `constructor`, `equals`, `getItem`, `parse`, `set`, `setItem`, `toString`.
All public members are accessible to any Typescript application after installing the Aspose.3D FOSS for Typescript package.
Properties: `length`, `length2`, `x`, `y`.

## Description

`Vector2` is a class in the Aspose.3D FOSS library for TypeScript that exposes 6 methods and 4 properties for programmatic use.

Core capabilities include: `number`; `number`; `number`. These operations enable developers to integrate vector2 functionality directly into TypeScript applications.

The class also provides the `length` property (gets the length), the `length2` property (gets the length2).

Instances are created through a single constructor that initializes the object with default values.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `x` | `number` | Read/Write | Gets the x. |
| `y` | `number` | Read/Write | Gets the y. |
| `length` | `number` | Read | Gets the length. |
| `length2` | `number` | Read | Gets the length2. |

## Methods

| Signature | Description |
|-----------|-------------|
| `constructor(x: number, y: number)` |  |
| `set(newX: number, newY: number)` | Updates the vector's x and y components to new values |
| `parse(input: string)` → `Vector2` | Creates a Vector2 instance from a string representation |
| `getItem(key: number)` → `number` | Returns the component value at the given index (0 for x, 1 for y) |
| `setItem(key: number, value: number)` | Sets the item value. |
| `toString()` → `string` |  |
| `equals(other: Vector2)` → `boolean` | Checks whether another Vector2 has identical x and y values |

## See Also

- [Aspose.3D — Enterprise API Reference](https://reference.aspose.com/3d/)