public Rectangle(Vector2f pos, Vector2f size) { X = pos.X; Y = pos.Y; Width = size.X; Height = size.Y; }
public Rectangle(Vector2f pos, float w, float h) { X = pos.X; Y = pos.Y; Width = w; Height = h; }
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(); }
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); }
public Vector2f(Vector2f other) { X = other.X; Y = other.Y; }
public Vector2f Set(Vector2f other) { X = other.X; Y = other.Y; return this; }
public float GetSquaredDistance(Vector2f other) { return GetSquaredDistance(this, other); }
public float Dot(Vector2f v) { return X * v.X + Y * v.Y; }
public Transform(Vector2f pos, Rotation rot) { P = pos; Q = rot; }
public void SetVector(string name, Vector2f v) { handle.SetValue(name, new Vector2(v.X, v.Y)); }
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; }
public static Vector2f Min(Vector2f a, Vector2f b) { return new Vector2f(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y)); }
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))); }
public Vector2f MulT(Vector2f v) { return new Vector2f(C * v.X + S * v.Y, -S * v.X + C * v.Y); }
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; }
public float Cross(Vector2f v) { return X * v.X - Y * v.Y; }
public void Set(Vector2f pos, float rot) { P = pos; Q.Set(rot); }