Client LuaCsForBarotrauma
CoordinateSpace2D.cs
1 using Microsoft.Xna.Framework;
2 namespace Barotrauma.Utils;
3 
4 public struct CoordinateSpace2D
5 {
6  public static readonly CoordinateSpace2D CanonicalSpace = new CoordinateSpace2D
7  {
8  Origin = Vector2.Zero,
9  I = Vector2.UnitX,
10  J = Vector2.UnitY
11  };
12 
13  public Vector2 Origin;
14  public Vector2 I;
15  public Vector2 J;
16 
17  public Matrix LocalToCanonical
18  => new Matrix(
19  m11: I.X, m12: I.Y, m13: 0f, m14: 0f,
20  m21: J.X, m22: J.Y, m23: 0f, m24: 0f,
21  m31: 0f, m32: 0f, m33: 1f, m34: 0f,
22  m41: 0f, m42: 0f, m43: 0f, m44: 1f)
23  * Matrix.CreateTranslation(Origin.X, Origin.Y, 0f);
24 
25  public Matrix CanonicalToLocal => Matrix.Invert(LocalToCanonical);
26 }
static readonly CoordinateSpace2D CanonicalSpace