Example #1
0
        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));
        }
Example #2
0
 public static Point Perpendicular(this Point lhs)
 {
     return(new Point(-lhs.Y, lhs.X));
 }
Example #3
0
 public static Point Negative(this Point lhs)
 {
     return(new Point(-lhs.X, -lhs.Y));
 }
Example #4
0
 public static void Negate(this Point lhs)
 {
     lhs.X = -lhs.X;
     lhs.Y = -lhs.Y;
 }
Example #5
0
 public static double Dot(this Point lhs, Point rhs)
 {
     return(lhs.X * rhs.X + lhs.Y * rhs.Y);
 }
Example #6
0
 public static double Dot(this Vertex vertex, Point point)
 {
     return((vertex.X * point.X) + (vertex.Y * point.Y));
 }
Example #7
0
 public static bool IsZero(this Point point)
 {
     return(Math.Sign(point.X) == 0 && Math.Sign(point.Y) == 0);
 }
Example #8
0
 public static Point Sub(this Vertex vertex, Point point)
 {
     return(new Point(vertex.X - point.X, vertex.Y - point.Y));
 }
Example #9
0
 public static Point Add(this Vertex vertex, Point point)
 {
     return(new Point(vertex.X + point.X, vertex.Y + point.Y));
 }
Example #10
0
 public static double Cross(this Point point, Point point2)
 {
     return((point.X * point2.Y) - (point.Y * point2.X));
 }
Example #11
0
 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);
 }