public void InitTest() { A = new Point2D(0, 0); B = new Point2D(0, 1); C = new Point2D(1, 0); D = new Point2D(1, 1); }
public static Point2D operator -(Point2D p1, Point2D p2) { Point2D res = new Point2D(); res.X = p1.X - p2.X; res.Y = p1.Y - p2.Y; return res; }
public Point Add(Point other) { Point2D res = new Point2D(); Point2D p2 = (Point2D)other; res.X = this.X + p2.X; res.Y = this.Y + p2.Y; return res; }
public Point Rotate(double angle) { Point2D point = new Point2D(); double angleInRad = angle * Math.PI / 180.0f; point.X = Math.Round(X * Math.Cos(angleInRad) - Y * Math.Sin(angleInRad)); point.Y = Math.Round(X * Math.Sin(angleInRad) + Y * Math.Cos(angleInRad)); return point; }