Vec2
Representation of 2D vectors and points.
see Unknown
Properties
ONE Vec2 static
return a Vec2 object with x = 1 and y = 1
ZERO Vec2 static
return a Vec2 object with x = 0 and y = 0
up Vec2 static
return a Vec2 object with x = 0 and y = 1
RIGHT Vec2 static
return a Vec2 object with x = 1 and y = 0
Methods
set
(
-
newValue
)
Vec2
- newValue
equals
(
-
other
)
Boolean
- other
lerp
(
-
to
-
ratio
-
[out
]
)
Vec2
- to
- ratio
- [out ]
addSelf
(
-
vector
)
Vec2
- vector
add
(
-
vector
-
[out
]
)
Vec2
- vector
- [out ]
subSelf
(
-
vector
)
Vec2
- vector
sub
(
-
vector
-
[out
]
)
Vec2
- vector
- [out ]
mulSelf
(
-
num
)
Vec2
- num
mul
(
-
num
-
[out
]
)
Vec2
- num
- [out ]
scaleSelf
(
-
vector
)
Vec2
- vector
scale
(
-
vector
-
[out
]
)
Vec2
- vector
- [out ]
divSelf
(
-
vector
)
Vec2
- vector
div
(
-
vector
-
[out
]
)
Vec2
- vector
- [out ]
negSelf ( ) Vec2
Negates the components. If you want to save result to another vector, use neg() instead.
returns:
neg
(
-
[out
]
)
Vec2
- [out ]
dot
(
-
[vector
]
)
number
- [vector ]
cross
(
-
[vector
]
)
number
- [vector ]
normalize
(
-
[out
]
)
Vec2
- [out ]
Returns this vector with a magnitude of 1.
Note that the current vector is unchanged and a new normalized vector is returned. If you want to normalize the current vector, use normalizeSelf function.
name | type | description |
---|---|---|
out
optional
|
Vec2 |
optional, the receiving vector |
returns:
angle
(
-
vector
)
number
- vector
signAngle
(
-
vector
)
number
- vector
rotate
(
-
radians
-
[out
]
)
Vec2
- radians
- [out ]