/** * Computes the oriented distance from a point to the plane. * The distance is: * <ul> * <li><b>positive</b> if the point lies above the plane (relative to the plane normal) * <li><b>zero</b> if the point is on the plane * <li><b>negative</b> if the point lies below the plane (relative to the plane normal) * </ul> * * @param p the point to compute the distance for * @return the oriented distance to the plane */ public double orientedDistance(Coordinate p) { Vector3D pb = new Vector3D(p, basePt); double pbdDotNormal = pb.dot(normal); if (Double.isNaN(pbdDotNormal)) throw new IllegalArgumentException("3D Coordinate has NaN ordinate"); double d = pbdDotNormal / normal.length(); return d; }
/** * Computes the oriented distance from a point to the plane. * The distance is: * <ul> * <li><b>positive</b> if the point lies above the plane (relative to the plane normal) * <li><b>zero</b> if the point is on the plane * <li><b>negative</b> if the point lies below the plane (relative to the plane normal) * </ul> * * @param p the point to compute the distance for * @return the oriented distance to the plane */ public double orientedDistance(Coordinate p) { Vector3D pb = new Vector3D(p, basePt); double pbdDotNormal = pb.dot(normal); if (Double.isNaN(pbdDotNormal)) throw new IllegalArgumentException("3D Coordinate has NaN ordinate"); double d = pbdDotNormal / normal.length(); return d; }