Esempio n. 1
0
 public Rectangle(Vector2f pos, Vector2f size)
 {
     X = pos.X;
     Y = pos.Y;
     Width = size.X;
     Height = size.Y;
 }
Esempio n. 2
0
 public Rectangle(Vector2f pos, float w, float h)
 {
     X = pos.X;
     Y = pos.Y;
     Width = w;
     Height = h;
 }
Esempio n. 3
0
        public void Draw(Texture2D texture, Vector2f position, Color color)
        {
            renderEffect.Begin();
            renderEffect.BeginPass(0);

            texture.Bind(0);
            renderEffect.SetColor("c", color);
            DrawPrimitive(new Rectangle(position, texture.Width, texture.Height));

            renderEffect.EndPass();
            renderEffect.End();
        }
Esempio n. 4
0
 public static float GetDistance(Vector2f A, Vector2f B)
 {
     float xd = A.X - B.X;
     float yd = A.Y - B.Y;
     return (float)M.Sqrt(xd * xd + yd * yd);
 }
Esempio n. 5
0
 public Vector2f(Vector2f other)
 {
     X = other.X;
     Y = other.Y;
 }
Esempio n. 6
0
 public Vector2f Set(Vector2f other)
 {
     X = other.X;
     Y = other.Y;
     return this;
 }
Esempio n. 7
0
 public float GetSquaredDistance(Vector2f other)
 {
     return GetSquaredDistance(this, other);
 }
Esempio n. 8
0
 public float Dot(Vector2f v)
 {
     return X * v.X + Y * v.Y;
 }
Esempio n. 9
0
 public Transform(Vector2f pos, Rotation rot)
 {
     P = pos;
     Q = rot;
 }
Esempio n. 10
0
 public void SetVector(string name, Vector2f v)
 {
     handle.SetValue(name, new Vector2(v.X, v.Y));
 }
Esempio n. 11
0
 public Vector2f Solve(Vector2f b)
 {
     float a11 = M00, a12 = M10, a21 = M01, a22 = M11;
     float det = a11 * a22 - a12 * a21;
     if (det != 0.0f)
     {
         det = 1.0f / det;
     }
     Vector2f x;
     x.X = det * (a22 * b.X - a12 * b.Y);
     x.Y = det * (a11 * b.Y - a21 * b.X);
     return x;
 }
Esempio n. 12
0
 public static Vector2f Min(Vector2f a, Vector2f b)
 {
     return new Vector2f(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y));
 }
Esempio n. 13
0
 public Vector2f Transform(Vector2f vec)
 {
     float rot = (float)Math.Atan(M10 / M11);
     float sx = (float)Math.Sqrt(M00 * M00 + M01 * M01);
     float sy = (float)Math.Sqrt(M10 * M10 + M11 * M11);
     return new Vector2f((float)(M02 + sx * (Math.Cos(rot) * vec.X - Math.Sin(rot) * vec.Y)), (float)(M12 + sy * (Math.Sin(rot) * vec.X - Math.Cos(rot) * vec.Y)));
 }
Esempio n. 14
0
 public Vector2f MulT(Vector2f v)
 {
     return new Vector2f(C * v.X + S * v.Y, -S * v.X + C * v.Y);
 }
Esempio n. 15
0
 public static float GetSquaredDistance(Vector2f A, Vector2f B)
 {
     float xd = A.X - B.X;
     float yd = A.Y - B.Y;
     return xd * xd + yd * yd;
 }
Esempio n. 16
0
 public float Cross(Vector2f v)
 {
     return X * v.X - Y * v.Y;
 }
Esempio n. 17
0
 public void Set(Vector2f pos, float rot)
 {
     P = pos;
     Q.Set(rot);
 }