add extension method: Vector2.Rotate()
GitOrigin-RevId: ee1e84ff188d5a3134dafb1f5150199682c4e063
This commit is contained in:
parent
82cf612834
commit
7cc953a44e
@ -5,6 +5,16 @@ using System;
|
|||||||
|
|
||||||
namespace SemiColinGames {
|
namespace SemiColinGames {
|
||||||
|
|
||||||
|
public static class Geometry {
|
||||||
|
public static Vector2 Rotate(this Vector2 point, float angle) {
|
||||||
|
float cos = FMath.Cos(angle);
|
||||||
|
float sin = FMath.Sin(angle);
|
||||||
|
return new Vector2(
|
||||||
|
point.X * cos - point.Y * sin,
|
||||||
|
point.Y * cos + point.X * sin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Math functions that return floats rather than doubles, for convenience.
|
// Math functions that return floats rather than doubles, for convenience.
|
||||||
public static class FMath {
|
public static class FMath {
|
||||||
public const float PI = (float) Math.PI;
|
public const float PI = (float) Math.PI;
|
||||||
|
Loading…
Reference in New Issue
Block a user