//  Data Structures with Java by John R. Hubbard
//  Copyright McGraw-Hill, 2001
//  Problem 3.2 on page 71

  public static final Point3D ORIGIN = new Point3D();

  public Point3D()
  { this.x = 0;
    this.y = 0;
    this.z = 0;
  }

  public double distance(Point3D point)
  { double dx = this.x - point.x;
    double dy = this.y - point.y;
    double dz = this.z - point.z;
    return Math.sqrt(dx*dx+dy*dy+dz*dz);
  } 

  public double magnitude()
  { return distance(ORIGIN);
  }

  public void expand(double dr)
  { x *= dr;
    y *= dr;
    z *= dr;
  }

