Scratch for Java

Diese Seite ist noch nicht übersetzt. Sie wird in ihrer Originalsprache angezeigt.

Vector2()

The Vector2 class represents a 2D vector with x and y coordinates. It provides various methods for vector operations such as addition, subtraction, scalar multiplication, dot product, rotation, and more.

Instances of this class are immutable.

Example usage:

Vector2 v1 = new Vector2(3, 4);
Vector2 v2 = new Vector2(1, 2);
Vector2 sum = v1.add(v2);
double length = v1.length();

Examples

View on GitHub

Syntax

Java

new Vector2()
new Vector2(x, y)
new Vector2(v)
Vector2()

Teilbare URL erstellen

Abschnitte auswählen