// subtract this point with the parameter point // and return the result public Point2D Subtract(Point2D Point) { Point2D NewPoint = new Point2D(); NewPoint.X = X - Point.X; NewPoint.Y = Y - Point.Y; return NewPoint; }
// checks whether this point is equal to the parameter point public Boolean IsEqualTo(Point2D Point) { if (X == Point.X && Y == Point.Y) return true; else return false; }
// add this point with the parameter point // and return the result public Point2D Add(Point2D Point) { Point2D NewPoint = new Point2D(); NewPoint.X = X + Point.X; NewPoint.Y = Y + Point.Y; return NewPoint; }
// find the distance between this point and the parameter point public Double DistanceTo(Point2D Point) { double xval = X - Point.X; double yval = Y - Point.Y; return System.Math.Sqrt(xval * xval + yval * yval); }
// copy constructor public Point2D(Point2D Point) { X = Point.X; Y = Point.Y; }
// set vector from two points public Vector2D(Point2D StartPt, Point2D EndPt) { X = EndPt.X - StartPt.X; Y = EndPt.Y - StartPt.Y; }