/** Construct a normalized plane through a y-z point and parallel to the X axis. * If the y-z point is at (0,0), return null. * @param y is the y value. * @param z is the z value. * @param DValue is the offset from the origin for the plane. * @return a plane parallel to the X axis and perpendicular to the y and z values given. */ public static Plane constructNormalizedXPlane(final double y, final double z, final double DValue) { if (Math.abs(y) < MINIMUM_RESOLUTION && Math.abs(z) < MINIMUM_RESOLUTION) return null; final double denom = 1.0 / Math.sqrt(y*y + z*z); return new Plane(0.0, z * denom, -y * denom, DValue); }
/** Construct a normalized plane through an x-y point and including the Z axis. * If the x-y point is at (0,0), return null. * @param x is the x value. * @param y is the y value. * @return a plane passing through the Z axis and (x,y,0). */ public static Plane constructNormalizedZPlane(final double x, final double y) { if (Math.abs(x) < MINIMUM_RESOLUTION && Math.abs(y) < MINIMUM_RESOLUTION) return null; final double denom = 1.0 / Math.sqrt(x*x + y*y); return new Plane(y * denom, -x * denom, 0.0, 0.0); }
/** Construct a normalized plane through an x-z point and parallel to the Y axis. * If the x-z point is at (0,0), return null. * @param x is the x value. * @param z is the z value. * @param DValue is the offset from the origin for the plane. * @return a plane parallel to the Y axis and perpendicular to the x and z values given. */ public static Plane constructNormalizedYPlane(final double x, final double z, final double DValue) { if (Math.abs(x) < MINIMUM_RESOLUTION && Math.abs(z) < MINIMUM_RESOLUTION) return null; final double denom = 1.0 / Math.sqrt(x*x + z*z); return new Plane(z * denom, 0.0, -x * denom, DValue); }
/** * Build a normalized plane, so that the vector is normalized. * * @return the normalized plane object, or null if the plane is indeterminate. */ public Plane normalize() { Vector normVect = super.normalize(); if (normVect == null) return null; return new Plane(normVect, this.D); }
/** Constructor. *@param planetModel is the planet model to use. *@param latitude is the latitude of the latitude zone. */ public GeoDegenerateLatitudeZone(final PlanetModel planetModel, final double latitude) { super(planetModel); this.latitude = latitude; this.sinLatitude = Math.sin(latitude); double cosLatitude = Math.cos(latitude); this.plane = new Plane(planetModel, sinLatitude); // Compute an interior point. interiorPoint = new GeoPoint(planetModel, sinLatitude, 0.0, cosLatitude, 1.0); edgePoints = new GeoPoint[]{interiorPoint}; }
/** * Accepts only values in the following ranges: lon: {@code -PI -> PI} */ public GeoDegenerateLongitudeSlice(final PlanetModel planetModel, final double longitude) { super(planetModel); // Argument checking if (longitude < -Math.PI || longitude > Math.PI) throw new IllegalArgumentException("Longitude out of range"); this.longitude = longitude; final double sinLongitude = Math.sin(longitude); final double cosLongitude = Math.cos(longitude); this.plane = new Plane(cosLongitude, sinLongitude); // We need a bounding plane too, which is perpendicular to the longitude plane and sided so that the point (0.0, longitude) is inside. this.interiorPoint = new GeoPoint(planetModel, 0.0, sinLongitude, 1.0, cosLongitude); this.boundingPlane = new SidedPlane(interiorPoint, -sinLongitude, cosLongitude); this.edgePoints = new GeoPoint[]{interiorPoint}; this.planePoints = new GeoPoint[]{planetModel.NORTH_POLE, planetModel.SOUTH_POLE}; }
/** * Sole constructor * *@param planetModel is the planet model. *@param minX is the minimum X value. *@param maxX is the maximum X value. *@param Y is the Y value. *@param Z is the Z value. */ public XdYdZSolid(final PlanetModel planetModel, final double minX, final double maxX, final double Y, final double Z) { super(planetModel); // Argument checking if (maxX - minX < Vector.MINIMUM_RESOLUTION) throw new IllegalArgumentException("X values in wrong order or identical"); this.minX = minX; this.maxX = maxX; this.Y = Y; this.Z = Z; // Build the planes and intersect them. final Plane yPlane = new Plane(yUnitVector,-Y); final Plane zPlane = new Plane(zUnitVector,-Z); final SidedPlane minXPlane = new SidedPlane(maxX,0.0,0.0,xUnitVector,-minX); final SidedPlane maxXPlane = new SidedPlane(minX,0.0,0.0,xUnitVector,-maxX); surfacePoints = yPlane.findIntersections(planetModel,zPlane,minXPlane,maxXPlane); }
/** * Sole constructor * *@param planetModel is the planet model. *@param X is the X value. *@param minY is the minimum Y value. *@param maxY is the maximum Y value. *@param Z is the Z value. */ public dXYdZSolid(final PlanetModel planetModel, final double X, final double minY, final double maxY, final double Z) { super(planetModel); // Argument checking if (maxY - minY < Vector.MINIMUM_RESOLUTION) throw new IllegalArgumentException("Y values in wrong order or identical"); this.X = X; this.minY = minY; this.maxY = maxY; this.Z = Z; // Build the planes and intersect them. final Plane xPlane = new Plane(xUnitVector,-X); final Plane zPlane = new Plane(zUnitVector,-Z); final SidedPlane minYPlane = new SidedPlane(0.0,maxY,0.0,yUnitVector,-minY); final SidedPlane maxYPlane = new SidedPlane(0.0,minY,0.0,yUnitVector,-maxY); surfacePoints = xPlane.findIntersections(planetModel,zPlane,minYPlane,maxYPlane); }
/** * Sole constructor * *@param planetModel is the planet model. *@param X is the X value. *@param Y is the Y value. *@param minZ is the minimum Z value. *@param maxZ is the maximum Z value. */ public dXdYZSolid(final PlanetModel planetModel, final double X, final double Y, final double minZ, final double maxZ) { super(planetModel); // Argument checking if (maxZ - minZ < Vector.MINIMUM_RESOLUTION) throw new IllegalArgumentException("Z values in wrong order or identical"); this.X = X; this.Y = Y; this.minZ = minZ; this.maxZ = maxZ; // Build the planes and intersect them. final Plane xPlane = new Plane(xUnitVector,-X); final Plane yPlane = new Plane(yUnitVector,-Y); final SidedPlane minZPlane = new SidedPlane(0.0,0.0,maxZ,zUnitVector,-minZ); final SidedPlane maxZPlane = new SidedPlane(0.0,0.0,minZ,zUnitVector,-maxZ); surfacePoints = xPlane.findIntersections(planetModel,yPlane,minZPlane,maxZPlane); }
this.LHC = new GeoPoint(planetModel, sinBottomLat, sinLongitude, cosBottomLat, cosLongitude, bottomLat, longitude); this.plane = new Plane(cosLongitude, sinLongitude);
return distanceStyle.computeDistance(start, x, y, z); final double normFactor = 1.0/magnitude; final Plane normalizedPerpPlane = new Plane(perpX * normFactor, perpY * normFactor, perpZ * normFactor, 0.0);
return distanceStyle.computeDistance(start, x, y, z); final double normFactor = 1.0/magnitude; final Plane normalizedPerpPlane = new Plane(perpX * normFactor, perpY * normFactor, perpZ * normFactor, 0.0);
return distanceStyle.toAggregationForm(0.0); final double normFactor = 1.0/magnitude; final Plane normalizedPerpPlane = new Plane(perpX * normFactor, perpY * normFactor, perpZ * normFactor, 0.0);
return distanceStyle.toAggregationForm(0.0); final double normFactor = 1.0/magnitude; final Plane normalizedPerpPlane = new Plane(perpX * normFactor, perpY * normFactor, perpZ * normFactor, 0.0);
final Plane normalizedPerpPlane = new Plane(perpX * normFactor, perpY * normFactor, perpZ * normFactor, 0.0);
final Plane perpPlane = new Plane(this.y * z - this.z * y, this.z * x - this.x * z, this.x * y - this.y * x, 0.0);
public Edge(final PlanetModel pm, final GeoPoint startPoint, final GeoPoint endPoint) { this.startPoint = startPoint; this.endPoint = endPoint; this.notablePoints = new GeoPoint[]{startPoint, endPoint}; this.plane = new Plane(startPoint, endPoint); this.startPlane = new SidedPlane(endPoint, plane, startPoint); this.endPlane = new SidedPlane(startPoint, plane, endPoint); final GeoPoint interpolationPoint = plane.interpolate(pm, startPoint, endPoint, halfProportions)[0]; this.backingPlane = new SidedPlane(interpolationPoint, interpolationPoint, 0.0); this.planeBounds = new XYZBounds(); this.planeBounds.addPoint(startPoint); this.planeBounds.addPoint(endPoint); this.planeBounds.addPlane(pm, this.plane, this.startPlane, this.endPlane, this.backingPlane); //System.out.println("Recording edge ["+startPoint+" --> "+endPoint+"]; bounds = "+planeBounds); }
final Plane perpPlane = new Plane(this.y * z - this.z * y, this.z * x - this.x * z, this.x * y - this.y * x, 0.0);
return distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, x,y,z)); final double normFactor = 1.0/magnitude; final Plane normalizedPerpPlane = new Plane(perpX * normFactor, perpY * normFactor, perpZ * normFactor, 0.0);
return distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, x,y,z)); final double normFactor = 1.0/magnitude; final Plane normalizedPerpPlane = new Plane(perpX * normFactor, perpY * normFactor, perpZ * normFactor, 0.0);