package aima.core.util.datastructure;

/**
 * Simplified version of <code>java.awt.geom.Point2D</code>. We do not want
 * dependencies to presentation layer packages here.
 * 
 * @author R. Lunde
 * @author Mike Stampone
 */
public class Point2D {
	private double x;
	private double y;

	public Point2D(double x, double y) {
		this.x = x;
		this.y = y;
	}

	/**
	 * Returns the X coordinate of this <code>Point2D</code> in
	 * <code>double</code> precision.
	 * 
	 * @return the X coordinate of this <code>Point2D</code>.
	 */
	public double getX() {
		return x;
	}

	/**
	 * Returns the Y coordinate of this <code>Point2D</code> in
	 * <code>double</code> precision.
	 * 
	 * @return the Y coordinate of this <code>Point2D</code>.
	 */
	public double getY() {
		return y;
	}

	/**
	 * Returns the Euclidean distance between a specified point and this point.
	 * 
	 * @return the Euclidean distance between a specified point and this point.
	 */
	public double distance(Point2D pt) {
		double result = (pt.getX() - x) * (pt.getX() - x);
		result += (pt.getY() - y) * (pt.getY() - y);
		return Math.sqrt(result);
	}
}

@@ -1027,70 +1027,158 @@
 %0D%0A%09%09
-double result = (pt.getX() - x) * (pt.getX() - x);%0D%0A%09%09result +
+// Distance Between X Coordinates%0D%0A%09%09double x_distance = (pt.getX() - x) * (pt.getX() - x);%0D%0A%09%09// Distance Between Y Coordinates%0D%0A%09%09double y_distance 
 = (p
@@ -1189,16 +1189,12 @@
 tY()
- - y) * 
+-y)*
 (pt.
@@ -1203,42 +1203,140 @@
 tY()
- - 
+-
 y)
+ 
 ;%0D%0A%09%09
-return Math.sqrt(result)
+// Distance Between 2d Points%0D%0A%09%09double total_distance = Math.sqrt(x_distance + y_distance) ;%0D%0A%09%09%0D%0A%09%09return total_distance 
 ;%0D%0A%09

Update Point2D.java