Exemplo n.º 1
0
 // 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;
 }
Exemplo n.º 2
0
 // 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;
 }
Exemplo n.º 3
0
 // 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;
 }
Exemplo n.º 4
0
 // 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);
 }
Exemplo n.º 5
0
 // copy constructor
 public Point2D(Point2D Point)
 {
     X = Point.X;
     Y = Point.Y;
 }
Exemplo n.º 6
0
 // set vector from two points
 public Vector2D(Point2D StartPt, Point2D EndPt)
 {
     X = EndPt.X - StartPt.X;
     Y = EndPt.Y - StartPt.Y;
 }