Beispiel #1
0
 /// <summary>Computes the distance between this point and point p1.</summary>
 /// <remarks>Computes the distance between this point and point p1.</remarks>
 /// <param name="p1">the other point</param>
 public double Distance(Point2d p1)
 {
     double dx;
     double dy;
     dx = this.x - p1.x;
     dy = this.y - p1.y;
     return Math.Sqrt(dx * dx + dy * dy);
 }
Beispiel #2
0
 /// <summary>Constructs and initializes a Point2d from the specified Point2d.</summary>
 /// <remarks>Constructs and initializes a Point2d from the specified Point2d.</remarks>
 /// <param name="p1">the Point2d containing the initialization x y data</param>
 public Point2d(Point2d p1)
     : base(p1)
 {
 }
Beispiel #3
0
 /// <summary>
 /// Computes the L-infinite distance between this point and
 /// point p1.
 /// </summary>
 /// <remarks>
 /// Computes the L-infinite distance between this point and
 /// point p1.  The L-infinite distance is equal to
 /// MAX[abs(x1-x2), abs(y1-y2)].
 /// </remarks>
 /// <param name="p1">the other point</param>
 public double DistanceLinf(Point2d p1)
 {
     return (Math.Max(Math.Abs(this.x - p1.x), Math.Abs(this.y - p1.y)));
 }
Beispiel #4
0
 // Compatible with 1.1
 /// <summary>Computes the square of the distance between this point and point p1.</summary>
 /// <remarks>Computes the square of the distance between this point and point p1.</remarks>
 /// <param name="p1">the other point</param>
 public double DistanceSquared(Point2d p1)
 {
     double dx;
     double dy;
     dx = this.x - p1.x;
     dy = this.y - p1.y;
     return dx * dx + dy * dy;
 }
Beispiel #5
0
 /// <summary>
 /// Computes the L-1 (Manhattan) distance between this point and
 /// point p1.
 /// </summary>
 /// <remarks>
 /// Computes the L-1 (Manhattan) distance between this point and
 /// point p1.  The L-1 distance is equal to abs(x1-x2) + abs(y1-y2).
 /// </remarks>
 /// <param name="p1">the other point</param>
 public double DistanceL1(Point2d p1)
 {
     return (Math.Abs(this.x - p1.x) + Math.Abs(this.y - p1.y));
 }