public class PointsTester {
    public static void main(String[] args) {
        Point p1 = new Point(3, 2);
        Point p2 = new Point(-1, -1);
        System.out.println("Point #1: " + p1);
        System.out.println("Point #2: " + p2);
        System.out.println("Distancia entre p1 i p2: " +
                p1.distance(p2));
        Point3D p3d1 = new Point3D(3, 2, 0);
        Point3D p3d2 = new Point3D(-1, -1, -1);
        System.out.println("Point3D #1: " + p3d1);
        System.out.println("Point3D #2: " + p3d2);
        System.out.println("Distancia entre p3D1 i p3D2: " +
                p3d1.distance(p3d2));
                // La distancia 3D (metodo: Point3d.distance())
        System.out.println("Distancia entre p3D1 i p2: " +
                p3d1.distance(p2));
                // La distancia 2D en el plano XY (metodo: Point.distance())
        double diff = p3d1.squaredDistanceToZero() -
                p2.squaredDistanceToZero();
        if (diff == 0) {
            System.out.println(p3d1 + " esta a la misma distancia de zero que "
                    + p2);
        } else if (diff > 0) {
            System.out.println(p3d1 + " esta mas lejos de zero que " + p2);
        } else {
            System.out.println(p3d1 + " esta mas cerca de zero que " + p2);
        }
    }
}
