You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Add cartesian to polar conversion functions
This commit is contained in:
committed by
Rémi Verschelde
parent
fb801d4964
commit
054a2ac579
@@ -35,6 +35,11 @@ namespace Godot
|
||||
return (float)Math.Atan2(x, y);
|
||||
}
|
||||
|
||||
public static Vector2 cartesian2polar(float x, float y)
|
||||
{
|
||||
return new Vector2(sqrt(x * x + y * y), atan2(y, x));
|
||||
}
|
||||
|
||||
public static float ceil(float s)
|
||||
{
|
||||
return (float)Math.Ceiling(s);
|
||||
@@ -176,6 +181,11 @@ namespace Godot
|
||||
return val;
|
||||
}
|
||||
|
||||
public static Vector2 polar2cartesian(float r, float th)
|
||||
{
|
||||
return new Vector2(r * cos(th), r * sin(th));
|
||||
}
|
||||
|
||||
public static float pow(float x, float y)
|
||||
{
|
||||
return (float)Math.Pow(x, y);
|
||||
|
||||
Reference in New Issue
Block a user