code: double offset(/* const */Point2D pt1, /* const */Point2D pt2) {
  		double newDistance = distance(pt1, pt2);
  		Point2D p = construct(x, y);
  		if (newDistance == 0.0)
  			return distance(p, pt1);
  
  		// get vectors relative to pt_1
  		Point2D p2 = new Point2D();
  		p2.setCoords(pt2);
  		p2.sub(pt1);
  		p.sub(pt1);
  
  		double cross = p.crossProduct(p2);
  		return cross / newDistance;
  	}
docs: returns signed distance of point from infinite line represented by
  pt_1...pt_2. The returned distance is positive if this point lies on the
  right-hand side of the line, negative otherwise. If the two input points
  are equal, the (positive) distance of this point to p_1 is returned.