@Override public boolean isWithin(final double x, final double y, final double z) { return plane.evaluateIsZero(x, y, z) && boundingPlane.isWithin(x, y, z); }
@Override public boolean intersects(final Plane plane, final GeoPoint[] notablePoints, final Membership... bounds) { // If not on the plane, no intersection if (!plane.evaluateIsZero(this)) return false; for (Membership m : bounds) { if (!m.isWithin(this)) return false; } return true; }
private boolean edgeCrossesEnvelope(final Plane edgePlane, final GeoPoint intersectionPoint, final Plane envelopePlane) { final GeoPoint[] adjoiningPoints = findAdjoiningPoints(edgePlane, intersectionPoint, envelopePlane); if (adjoiningPoints == null) { return true; } int withinCount = 0; for (final GeoPoint adjoining : adjoiningPoints) { if (plane.evaluateIsZero(adjoining) && bound.isWithin(adjoining)) { withinCount++; } } return (withinCount & 1) != 0; }
/** Determine if this endpoint intersects a specified plane. *@param planetModel is the planet model. *@param p is the plane. *@param notablePoints are the points associated with the plane. *@param bounds are any bounds which the intersection must lie within. *@return true if there is a matching intersection. */ public boolean intersects(final PlanetModel planetModel, final Plane p, final GeoPoint[] notablePoints, final Membership[] bounds) { // If not on the plane, no intersection if (!p.evaluateIsZero(point)) return false; for (Membership m : bounds) { if (!m.isWithin(point)) return false; } return true; }
public FullLinearCrossingEdgeIterator(final GeoPoint testPoint, final Plane plane, final Plane abovePlane, final Plane belowPlane, final double thePointX, final double thePointY, final double thePointZ) { assert plane.evaluateIsZero(thePointX, thePointY, thePointZ) : "Check point is not on travel plane"; assert plane.evaluateIsZero(testPoint) : "Test point is not on travel plane"; this.testPoint = testPoint; this.plane = plane; this.abovePlane = abovePlane; this.belowPlane = belowPlane; if (plane.isNumericallyIdentical(testPoint)) { throw new IllegalArgumentException("Plane vector identical to testpoint vector"); } // It doesn't matter which 1/2 of the world we choose, but we must choose only one. this.bound = new SidedPlane(plane, testPoint); this.thePointX = thePointX; this.thePointY = thePointY; this.thePointZ = thePointZ; //System.out.println(" Constructing full linear crossing edge iterator"); //debugIntersectAllEdges(plane, bound); }
/** Check if point is within this segment. *@param point is the point. *@return true of within. */ public boolean isWithin(final Vector point) { return startCutoffPlane.isWithin(point) && endCutoffPlane.isWithin(point) && normalizedConnectingPlane.evaluateIsZero(point); }
@Override public boolean isWithin(final double x, final double y, final double z) { return plane.evaluateIsZero(x, y, z) && leftPlane.isWithin(x, y, z) && rightPlane.isWithin(x, y, z); }
@Override public boolean isWithin(final double x, final double y, final double z) { return plane.evaluateIsZero(x, y, z) && (leftPlane.isWithin(x, y, z) || rightPlane.isWithin(x, y, z)); }
/** Check if point is within this segment. *@param x is the point x. *@param y is the point y. *@param z is the point z. *@return true of within. */ public boolean isWithin(final double x, final double y, final double z) { return startCutoffPlane.isWithin(x, y, z) && endCutoffPlane.isWithin(x, y, z) && normalizedConnectingPlane.evaluateIsZero(x, y, z); }
public SectorLinearCrossingEdgeIterator(final GeoPoint testPoint, final Plane plane, final Plane abovePlane, final Plane belowPlane, final double thePointX, final double thePointY, final double thePointZ) { assert plane.evaluateIsZero(thePointX, thePointY, thePointZ) : "Check point is not on travel plane"; assert plane.evaluateIsZero(testPoint) : "Test point is not on travel plane"; this.testPoint = testPoint; this.plane = plane; this.abovePlane = abovePlane; this.belowPlane = belowPlane; // We have to be sure we don't accidently create two bounds that would exclude all points. // Not sure this can happen but... final SidedPlane bound1Plane = new SidedPlane(thePointX, thePointY, thePointZ, plane, testPoint); final SidedPlane bound2Plane = new SidedPlane(testPoint, plane, thePointX, thePointY, thePointZ); if (bound1Plane.isNumericallyIdentical(bound2Plane)) { throw new IllegalArgumentException("Sector iterator unreliable when bounds planes are numerically identical"); } this.bound1 = bound1Plane; this.bound2 = bound2Plane; this.thePointX = thePointX; this.thePointY = thePointY; this.thePointZ = thePointZ; //System.out.println(" Constructing sector linear crossing edge iterator"); //debugIntersectAllEdges(plane, bound1, bound2); }
private boolean edgeCrossesEnvelope(final Plane edgePlane, final GeoPoint intersectionPoint, final Plane envelopePlane) { final GeoPoint[] adjoiningPoints = findAdjoiningPoints(edgePlane, intersectionPoint, envelopePlane); if (adjoiningPoints == null) { //System.out.println(" No adjoining points"); return true; } int withinCount = 0; for (final GeoPoint adjoining : adjoiningPoints) { //System.out.println(" Adjoining point "+adjoining); if (plane.evaluateIsZero(adjoining) && bound1.isWithin(adjoining) && bound2.isWithin(adjoining)) { //System.out.println(" within!!"); withinCount++; } else { //System.out.println(" evaluateIsZero? "+plane.evaluateIsZero(adjoining)+" bound1.isWithin? "+bound1.isWithin(adjoining)+" bound2.isWithin? "+bound2.isWithin(adjoining)); } } return (withinCount & 1) != 0; }
/** Return true if the edge crosses the envelope plane, given the envelope intersection point. */ private boolean edgeCrossesEnvelope(final Plane edgePlane, final GeoPoint intersectionPoint, final Plane envelopePlane) { final GeoPoint[] adjoiningPoints = findAdjoiningPoints(edgePlane, intersectionPoint, envelopePlane); if (adjoiningPoints == null) { // Couldn't find good adjoining points, so just assume there is a crossing. return true; } int withinCount = 0; for (final GeoPoint adjoining : adjoiningPoints) { if ((travelPlane.evaluateIsZero(adjoining) && checkPointCutoffPlane.isWithin(adjoining) && checkPointOtherCutoffPlane.isWithin(adjoining)) || (testPointPlane.evaluateIsZero(adjoining) && testPointCutoffPlane.isWithin(adjoining) && testPointOtherCutoffPlane.isWithin(adjoining))) { //System.out.println(" Adjoining point "+adjoining+" (intersection dist = "+intersectionPoint.linearDistance(adjoining)+") is within"); withinCount++; } else { //System.out.println(" Adjoining point "+adjoining+" (intersection dist = "+intersectionPoint.linearDistance(adjoining)+"; travelPlane dist="+travelPlane.evaluate(adjoining)+"; testPointPlane dist="+testPointPlane.evaluate(adjoining)+") is not within"); } } return (withinCount & 1) != 0; }
@Override public boolean isWithin(final double x, final double y, final double z) { return plane.evaluateIsZero(x, y, z) && boundingPlane.isWithin(x, y, z) && topPlane.isWithin(x, y, z) && bottomPlane.isWithin(x, y, z); }
@Override public boolean matches(final Edge edge) { //System.out.println(" Edge ["+edge.startPoint+" --> "+edge.endPoint+"] potentially crosses travel plane "+plane); // Early exit if the point is on the edge. if (edge.isWithin(thePointX, thePointY, thePointZ)) { //System.out.println(" Point is on the edge; in-set"); onEdge = true; return false; } // This should precisely mirror what is in DualCrossingIterator, but without the dual crossings. // Some edges are going to be given to us even when there's no real intersection, so do that as a sanity check, first. final GeoPoint[] planeCrossings = plane.findIntersections(planetModel, edge.plane, bound, edge.startPlane, edge.endPlane); if (planeCrossings != null && planeCrossings.length == 0) { // Sometimes on the hairy edge an intersection will be missed. This check finds those. if (!plane.evaluateIsZero(edge.startPoint) && !plane.evaluateIsZero(edge.endPoint)) { return true; } } //System.out.println(" Edge intersects travel plane "+plane); // Determine crossings of this edge against all inside/outside planes. There's no further need to look at the actual travel plane itself. final int aboveCrossings = countCrossings(edge, abovePlane, bound); aboveCrossingCount += aboveCrossings; final int belowCrossings = countCrossings(edge, belowPlane, bound); belowCrossingCount += belowCrossings; //System.out.println(" Above crossings = "+aboveCrossings+"; below crossings = "+belowCrossings); return true; }
public boolean isWithin(final double thePointX, final double thePointY, final double thePointZ) { return plane.evaluateIsZero(thePointX, thePointY, thePointZ) && startPlane.isWithin(thePointX, thePointY, thePointZ) && endPlane.isWithin(thePointX, thePointY, thePointZ) && backingPlane.isWithin(thePointX, thePointY, thePointZ); }
@Override public boolean isWithin(final double x, final double y, final double z) { return minXPlane.isWithin(x, y, z) && maxXPlane.isWithin(x, y, z) && yPlane.evaluateIsZero(x, y, z) && minZPlane.isWithin(x, y, z) && maxZPlane.isWithin(x, y, z); }
@Override public boolean isWithin(final double x, final double y, final double z) { return xPlane.evaluateIsZero(x, y, z) && minYPlane.isWithin(x, y, z) && maxYPlane.isWithin(x, y, z) && minZPlane.isWithin(x, y, z) && maxZPlane.isWithin(x, y, z); }
@Override public boolean isWithin(final double x, final double y, final double z) { return minXPlane.isWithin(x, y, z) && maxXPlane.isWithin(x, y, z) && minYPlane.isWithin(x, y, z) && maxYPlane.isWithin(x, y, z) && zPlane.evaluateIsZero(x, y, z); }
if (evaluateIsZero(x,y,z)) { if (meetsAllBounds(x,y,z, bounds)) return 0.0;
if (evaluateIsZero(x,y,z)) { if (meetsAllBounds(x,y,z, bounds)) return 0.0;