public static Point Rotate(this Point point, double angle) { if (Math.Sign(angle) == 0) { return(new Point(point.X, point.Y)); } var cos = Math.Cos(angle); var sin = Math.Sin(angle); return(new Point(point.X * cos - point.Y * sin, point.X * sin + point.Y * cos)); }
public static Point Perpendicular(this Point lhs) { return(new Point(-lhs.Y, lhs.X)); }
public static Point Negative(this Point lhs) { return(new Point(-lhs.X, -lhs.Y)); }
public static void Negate(this Point lhs) { lhs.X = -lhs.X; lhs.Y = -lhs.Y; }
public static double Dot(this Point lhs, Point rhs) { return(lhs.X * rhs.X + lhs.Y * rhs.Y); }
public static double Dot(this Vertex vertex, Point point) { return((vertex.X * point.X) + (vertex.Y * point.Y)); }
public static bool IsZero(this Point point) { return(Math.Sign(point.X) == 0 && Math.Sign(point.Y) == 0); }
public static Point Sub(this Vertex vertex, Point point) { return(new Point(vertex.X - point.X, vertex.Y - point.Y)); }
public static Point Add(this Vertex vertex, Point point) { return(new Point(vertex.X + point.X, vertex.Y + point.Y)); }
public static double Cross(this Point point, Point point2) { return((point.X * point2.Y) - (point.Y * point2.X)); }
public BodyRenderStruct(Body body) { Fill = body.Static ? Color.FromArgb(0xee, 0xee, 0xee) : RandomColor.Random(); Stroke = ShadeColor(Fill, -20); Sprite = (body.Bounds.Min - body.Position) / (body.Bounds.Max - body.Bounds.Min); }