Exit Full View

Fizzy / docs / ref / Vector2.md

Vector2

A vector of two doubles. Unlike Dimension2, a Vector2 has no units, and it therefore not used to store points.

Creation

The long form :

Vector2( 10, 20 )

The short form :

( 10, 10 )

The brackets are actually optional, but adding them adds clarity. When passed as an argument to a function or method, the brackets become mandatory :

foo( ( 10, 10 ) ) // Correct
foo( 10, 10 ) // Wrong - two parameters of type Double, not a Vector2.

Fields

NameTypeComments
XDouble
YDouble
AngleAngle
LengthDouble

Methods

NameParametersReturn TypeComments
formatStringStringUses Java's DecimalFormat
normalisenoneVector2Creates a vector of length 1, in the same direction.
rotateAngleVector2Rotates the vector about the origin.
clampmin : Vector2, max : Vector2Vector2