/** * Check whether a point is strictly within a plane. * @param v is the point. * @return true if within. */ public boolean strictlyWithin(final Vector v) { double evalResult = evaluate(v.x, v.y, v.z); double sigNum = Math.signum(evalResult); return sigNum == 0.0 || sigNum == this.sigNum; }
/** * Check whether a point is strictly within a plane. * @param x is the point x value. * @param y is the point y value. * @param z is the point z value. * @return true if within. */ public boolean strictlyWithin(double x, double y, double z) { double evalResult = evaluate(x, y, z); double sigNum = Math.signum(evalResult); return sigNum == 0.0 || sigNum == this.sigNum; }
@Override public boolean isWithin(double x, double y, double z) { double evalResult = evaluate(x, y, z); //System.out.println(Math.abs(evalResult)); if (Math.abs(evalResult) < MINIMUM_RESOLUTION) return true; double sigNum = Math.signum(evalResult); return sigNum == this.sigNum; }
/** * Construct a sided plane from a pair of vectors describing points, and including * origin, plus a point p which describes the side. * * @param p point to evaluate * @param onSide is true if the point is on the correct side of the plane, false otherwise. * @param A is the first in-plane point * @param B is the second in-plane point */ public SidedPlane(final Vector p, final boolean onSide, final Vector A, final Vector B) { super(A, B); sigNum = onSide?Math.signum(evaluate(p)):-Math.signum(evaluate(p)); if (sigNum == 0.0) throw new IllegalArgumentException("Cannot determine sidedness because check point is on plane."); }
/** * Construct a sided vertical plane from a point and specified x and y coordinates. * * @param p point to evaluate. * @param x is the specified x. * @param y is the specified y. */ public SidedPlane(Vector p, double x, double y) { super(x, y); sigNum = Math.signum(evaluate(p)); if (sigNum == 0.0) throw new IllegalArgumentException("Cannot determine sidedness because check point is on plane."); }
/** * Construct a sided plane with a normal vector and offset. * * @param p point to evaluate. * @param v is the normal vector. * @param D is the origin offset for the plan. */ public SidedPlane(Vector p, Vector v, double D) { super(v, D); sigNum = Math.signum(evaluate(p)); if (sigNum == 0.0) throw new IllegalArgumentException("Cannot determine sidedness because check point is on plane."); }
/** * Construct a sided plane with a normal vector and offset. * * @param pX X coord of point to evaluate. * @param pY Y coord of point to evaluate. * @param pZ Z coord of point to evaluate. * @param v is the normal vector. * @param D is the origin offset for the plan. */ public SidedPlane(double pX, double pY, double pZ, Vector v, double D) { super(v, D); sigNum = Math.signum(evaluate(pX,pY,pZ)); if (sigNum == 0.0) throw new IllegalArgumentException("Cannot determine sidedness because check point is on plane."); }
/** * Construct a sided plane from a point and a Z coordinate. * * @param p point to evaluate. * @param planetModel is the planet model. * @param sinLat is the sin of the latitude of the plane. */ public SidedPlane(Vector p, final PlanetModel planetModel, double sinLat) { super(planetModel, sinLat); sigNum = Math.signum(evaluate(p)); if (sigNum == 0.0) throw new IllegalArgumentException("Cannot determine sidedness because check point is on plane."); }
/** * Construct a sided plane from a pair of vectors describing points, and including * origin, plus a point p which describes the side. * * @param p point to evaluate * @param A is the first in-plane point * @param B is the second in-plane point */ public SidedPlane(final Vector p, final Vector A, final Vector B) { super(A, B); sigNum = Math.signum(evaluate(p)); if (sigNum == 0.0) throw new IllegalArgumentException("Cannot determine sidedness because check point is on plane."); }
/** * Construct a sided plane from a pair of vectors describing points, and including * origin, plus a point p which describes the side. * * @param pX point X to evaluate * @param pY point Y to evaluate * @param pZ point Z to evaluate * @param A is the first in-plane point * @param B is the second in-plane point */ public SidedPlane(final double pX, final double pY, final double pZ, final Vector A, final Vector B) { super(A, B); sigNum = Math.signum(evaluate(pX, pY, pZ)); if (sigNum == 0.0) throw new IllegalArgumentException("Cannot determine sidedness because check point is on plane."); }
/** * Construct a sided plane with a normal vector and offset. * * @param p point to evaluate. * @param vX is the normal vector X. * @param vY is the normal vector Y. * @param vZ is the normal vector Z. * @param D is the origin offset for the plan. */ public SidedPlane(Vector p, double vX, double vY, double vZ, double D) { super(vX, vY, vZ, D); sigNum = Math.signum(evaluate(p)); if (sigNum == 0.0) throw new IllegalArgumentException("Cannot determine sidedness because check point is on plane."); }
/** * Construct a sided plane from a pair of vectors describing points, and including * origin, plus a point p which describes the side. * * @param p point to evaluate * @param A is the first in-plane point * @param BX is the X value of the second in-plane point * @param BY is the Y value of the second in-plane point * @param BZ is the Z value of the second in-plane point */ public SidedPlane(final Vector p, final Vector A, final double BX, final double BY, final double BZ) { super(A, BX, BY, BZ); sigNum = Math.signum(evaluate(p)); if (sigNum == 0.0) throw new IllegalArgumentException("Cannot determine sidedness because check point is on plane."); }