Add Vector2.from_angle() method
This commit is contained in:
parent
d085b2d04d
commit
3f3739ccb5
5 changed files with 30 additions and 0 deletions
|
|
@ -34,6 +34,10 @@ real_t Vector2::angle() const {
|
|||
return Math::atan2(y, x);
|
||||
}
|
||||
|
||||
Vector2 Vector2::from_angle(const real_t p_angle) {
|
||||
return Vector2(Math::cos(p_angle), Math::sin(p_angle));
|
||||
}
|
||||
|
||||
real_t Vector2::length() const {
|
||||
return Math::sqrt(x * x + y * y);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue