Package org.apache.lucene.spatial3d.geom
Class Plane
java.lang.Object
org.apache.lucene.spatial3d.geom.Vector
org.apache.lucene.spatial3d.geom.Plane
- Direct Known Subclasses:
SidedPlane
We know about three kinds of planes. First kind: general plain through two points and origin
Second kind: horizontal plane at specified height. Third kind: vertical plane with specified x
and y value, through origin.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
Modifier and TypeFieldDescriptionfinal double
Ax + By + Cz + D = 0static final Membership[]
An array with no bounds in itstatic final GeoPoint[]
An array with no points in itstatic final Plane
A vertical plane normal to the X axisstatic final Plane
A vertical plane normal to the Y axisstatic final Plane
A vertical plane normal to the Z axisFields inherited from class org.apache.lucene.spatial3d.geom.Vector
MINIMUM_ANGULAR_RESOLUTION, MINIMUM_RESOLUTION, MINIMUM_RESOLUTION_CUBED, MINIMUM_RESOLUTION_SQUARED, x, y, z
-
Constructor Summary
ConstructorDescriptionPlane
(double x, double y) Construct a vertical plane through a specified x, y and origin.Plane
(double A, double B, double C, double D) Construct a plane with all four coefficients defined.Construct a plane that is parallel to the one provided, but which is just barely numerically distinguishable from it, in the direction desired.Plane
(PlanetModel planetModel, double sinLat) Construct a horizontal plane at a specified Z.Construct a plane with a specific vector, and D offset from origin.Construct a plane through two points and origin.Construct a plane through two points and origin. -
Method Summary
Modifier and TypeMethodDescriptiondouble
arcDistance
(PlanetModel planetModel, double x, double y, double z, Membership... bounds) Compute arc distance from plane to a vector.double
arcDistance
(PlanetModel planetModel, GeoPoint v, Membership... bounds) Compute arc distance from plane to a vector expressed with aGeoPoint
.static boolean
arePointsCoplanar
(GeoPoint A, GeoPoint B, GeoPoint C) Checks if three points are coplanar in any of the three planes they can describe.static Plane
constructNormalizedXPlane
(double y, double z, double DValue) Construct a normalized plane through a y-z point and parallel to the X axis.static Plane
constructNormalizedXPlane
(Vector... planePoints) Construct the most accurate normalized plane through an y-z point and including the X axis.static Plane
constructNormalizedYPlane
(double x, double z, double DValue) Construct a normalized plane through an x-z point and parallel to the Y axis.static Plane
constructNormalizedYPlane
(Vector... planePoints) Construct the most accurate normalized plane through an x-z point and including the Y axis.static Plane
constructNormalizedZPlane
(double x, double y) Construct a normalized plane through an x-y point and including the Z axis.static Plane
constructNormalizedZPlane
(Vector... planePoints) Construct the most accurate normalized plane through an x-y point and including the Z axis.boolean
crosses
(PlanetModel planetModel, Plane q, GeoPoint[] notablePoints, GeoPoint[] moreNotablePoints, Membership[] bounds, Membership... moreBounds) Determine whether the plane crosses another plane within the bounds provided.boolean
double
evaluate
(double x, double y, double z) Evaluate the plane equation for a given point, as represented by a vector.double
Evaluate the plane equation for a given point, as represented by a vector.boolean
evaluateIsZero
(double x, double y, double z) Evaluate the plane equation for a given point, as represented by a vector.boolean
Evaluate the plane equation for a given point, as represented by a vector.GeoPoint[]
findArcDistancePoints
(PlanetModel planetModel, double arcDistanceValue, GeoPoint startPoint, Membership... bounds) Locate a point that is within the specified bounds and on the specified plane, that has an arcDistance as specified from the startPoint.GeoPoint[]
findCrossings
(PlanetModel planetModel, Plane q, Membership... bounds) Find the points between two planes, where one plane crosses the other, given a set of bounds.protected GeoPoint[]
findCrossings
(PlanetModel planetModel, Plane q, Membership[] bounds, Membership[] moreBounds) Find the points between two planes, where one plane crosses the other, given a set of bounds.protected void
findIntersectionBounds
(PlanetModel planetModel, Bounds boundsInfo, Plane q, Membership... bounds) Record intersection points for planes with error bounds.GeoPoint[]
findIntersections
(PlanetModel planetModel, Plane q, Membership... bounds) Find the intersection points between two planes, given a set of bounds.protected GeoPoint[]
findIntersections
(PlanetModel planetModel, Plane q, Membership[] bounds, Membership[] moreBounds) Find the intersection points between two planes, given a set of bounds.getSampleIntersectionPoint
(PlanetModel planetModel, Plane q) Find a sample point on the intersection between two planes and the world.int
hashCode()
GeoPoint[]
interpolate
(PlanetModel planetModel, GeoPoint start, GeoPoint end, double[] proportions) Find points on the boundary of the intersection of a plane and the unit sphere, given a starting point, and ending point, and a list of proportions of the arc (e.g.boolean
intersects
(PlanetModel planetModel, Plane q, GeoPoint[] notablePoints, GeoPoint[] moreNotablePoints, Membership[] bounds, Membership... moreBounds) Determine whether the plane intersects another plane within the bounds provided.boolean
Returns true if this plane and the other plane are functionally identical within the margin of error.boolean
Returns true if this plane and the other plane are identical within the margin of error.double
linearDistance
(PlanetModel planetModel, double x, double y, double z, Membership... bounds) Compute linear distance from plane to a vector.double
linearDistance
(PlanetModel planetModel, GeoPoint v, Membership... bounds) Compute linear distance from plane to a vector.double
linearDistanceSquared
(PlanetModel planetModel, double x, double y, double z, Membership... bounds) Compute linear distance squared from plane to a vector.double
linearDistanceSquared
(PlanetModel planetModel, GeoPoint v, Membership... bounds) Compute linear distance squared from plane to a vector.protected static Vector
modify
(GeoPoint start, double transX, double transY, double transZ, double sinRA, double cosRA, double sinHA, double cosHA) Modify a point to produce a vector in translated/rotated space.double
normalDistance
(double x, double y, double z, Membership... bounds) Compute normal distance from plane to a vector.double
normalDistance
(Vector v, Membership... bounds) Compute normal distance from plane to a vector.double
normalDistanceSquared
(double x, double y, double z, Membership... bounds) Compute normal distance squared from plane to a vector.double
normalDistanceSquared
(Vector v, Membership... bounds) Compute normal distance squared from plane to a vector.Build a normalized plane, so that the vector is normalized.void
recordBounds
(PlanetModel planetModel, LatLonBounds boundsInfo, Membership... bounds) Accumulate bounds information for this plane, intersected with the unit sphere.void
recordBounds
(PlanetModel planetModel, LatLonBounds boundsInfo, Plane p, Membership... bounds) Accumulate bounds information for this plane, intersected with another plane and the world.void
recordBounds
(PlanetModel planetModel, XYZBounds boundsInfo, Membership... bounds) Accumulate (x,y,z) bounds information for this plane, intersected with the unit sphere.void
recordBounds
(PlanetModel planetModel, XYZBounds boundsInfo, Plane p, Membership... bounds) Accumulate (x,y,z) bounds information for this plane, intersected with another and the world.protected static GeoPoint
reverseModify
(PlanetModel planetModel, Vector point, double transX, double transY, double transZ, double sinRA, double cosRA, double sinHA, double cosHA) Reverse modify a point to produce a GeoPoint in normal space.toString()
Methods inherited from class org.apache.lucene.spatial3d.geom.Vector
crossProductEvaluateIsZero, dotProduct, dotProduct, isNumericallyIdentical, isNumericallyIdentical, isParallel, isParallel, isWithin, linearDistance, linearDistance, linearDistanceSquared, linearDistanceSquared, magnitude, magnitude, normalDistance, normalDistance, normalDistanceSquared, normalDistanceSquared, rotateXY, rotateXY, rotateXZ, rotateXZ, rotateZY, rotateZY, translate
-
Field Details
-
NO_POINTS
An array with no points in it -
NO_BOUNDS
An array with no bounds in it -
normalYPlane
A vertical plane normal to the Y axis -
normalXPlane
A vertical plane normal to the X axis -
normalZPlane
A vertical plane normal to the Z axis -
D
public final double DAx + By + Cz + D = 0
-
-
Constructor Details
-
Plane
public Plane(double A, double B, double C, double D) Construct a plane with all four coefficients defined.- Parameters:
A
- is AB
- is BC
- is CD
- is D
-
Plane
Construct a plane through two points and origin.- Parameters:
A
- is the first point (origin based).BX
- is the second point X (origin based).BY
- is the second point Y (origin based).BZ
- is the second point Z (origin based).
-
Plane
Construct a plane through two points and origin.- Parameters:
A
- is the first point (origin based).B
- is the second point (origin based).
-
Plane
Construct a horizontal plane at a specified Z.- Parameters:
planetModel
- is the planet model.sinLat
- is the sin(latitude).
-
Plane
public Plane(double x, double y) Construct a vertical plane through a specified x, y and origin.- Parameters:
x
- is the specified x value.y
- is the specified y value.
-
Plane
Construct a plane with a specific vector, and D offset from origin.- Parameters:
v
- is the normal vector.D
- is the D offset from the origin.
-
Plane
Construct a plane that is parallel to the one provided, but which is just barely numerically distinguishable from it, in the direction desired.- Parameters:
basePlane
- is the starting plane.above
- is set to true if the desired plane is in the positive direction from the base plane, or false in the negative direction.
-
-
Method Details
-
constructNormalizedZPlane
Construct the most accurate normalized plane through an x-y point and including the Z axis. If none of the points can determine the plane, return null.- Parameters:
planePoints
- is a set of points to choose from. The best one for constructing the most precise plane is picked.- Returns:
- the plane
-
constructNormalizedYPlane
Construct the most accurate normalized plane through an x-z point and including the Y axis. If none of the points can determine the plane, return null.- Parameters:
planePoints
- is a set of points to choose from. The best one for constructing the most precise plane is picked.- Returns:
- the plane
-
constructNormalizedXPlane
Construct the most accurate normalized plane through an y-z point and including the X axis. If none of the points can determine the plane, return null.- Parameters:
planePoints
- is a set of points to choose from. The best one for constructing the most precise plane is picked.- Returns:
- the plane
-
constructNormalizedZPlane
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.- Parameters:
x
- is the x value.y
- is the y value.- Returns:
- a plane passing through the Z axis and (x,y,0).
-
constructNormalizedYPlane
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.- Parameters:
x
- is the x value.z
- is the z value.DValue
- is the offset from the origin for the plane.- Returns:
- a plane parallel to the Y axis and perpendicular to the x and z values given.
-
constructNormalizedXPlane
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.- Parameters:
y
- is the y value.z
- is the z value.DValue
- is the offset from the origin for the plane.- Returns:
- a plane parallel to the X axis and perpendicular to the y and z values given.
-
evaluate
Evaluate the plane equation for a given point, as represented by a vector.- Parameters:
v
- is the vector.- Returns:
- the result of the evaluation.
-
evaluate
public double evaluate(double x, double y, double z) Evaluate the plane equation for a given point, as represented by a vector.- Parameters:
x
- is the x value.y
- is the y value.z
- is the z value.- Returns:
- the result of the evaluation.
-
evaluateIsZero
Evaluate the plane equation for a given point, as represented by a vector.- Parameters:
v
- is the vector.- Returns:
- true if the result is on the plane.
-
evaluateIsZero
public boolean evaluateIsZero(double x, double y, double z) Evaluate the plane equation for a given point, as represented by a vector.- Parameters:
x
- is the x value.y
- is the y value.z
- is the z value.- Returns:
- true if the result is on the plane.
-
normalize
Build a normalized plane, so that the vector is normalized. -
arcDistance
Compute arc distance from plane to a vector expressed with aGeoPoint
. -
arcDistance
public double arcDistance(PlanetModel planetModel, double x, double y, double z, Membership... bounds) Compute arc distance from plane to a vector.- Parameters:
planetModel
- is the planet model.x
- is the x vector value.y
- is the y vector value.z
- is the z vector value.bounds
- are the bounds which constrain the intersection point.- Returns:
- the arc distance.
-
normalDistance
Compute normal distance from plane to a vector.- Parameters:
v
- is the vector.bounds
- are the bounds which constrain the intersection point.- Returns:
- the normal distance.
-
normalDistance
Compute normal distance from plane to a vector.- Parameters:
x
- is the vector x.y
- is the vector y.z
- is the vector z.bounds
- are the bounds which constrain the intersection point.- Returns:
- the normal distance.
-
normalDistanceSquared
Compute normal distance squared from plane to a vector.- Parameters:
v
- is the vector.bounds
- are the bounds which constrain the intersection point.- Returns:
- the normal distance squared.
-
normalDistanceSquared
Compute normal distance squared from plane to a vector.- Parameters:
x
- is the vector x.y
- is the vector y.z
- is the vector z.bounds
- are the bounds which constrain the intersection point.- Returns:
- the normal distance squared.
-
linearDistance
Compute linear distance from plane to a vector. This is defined as the distance from the given point to the nearest intersection of this plane with the planet surface.- Parameters:
planetModel
- is the planet model.v
- is the point.bounds
- are the bounds which constrain the intersection point.- Returns:
- the linear distance.
-
linearDistance
public double linearDistance(PlanetModel planetModel, double x, double y, double z, Membership... bounds) Compute linear distance from plane to a vector. This is defined as the distance from the given point to the nearest intersection of this plane with the planet surface.- Parameters:
planetModel
- is the planet model.x
- is the vector x.y
- is the vector y.z
- is the vector z.bounds
- are the bounds which constrain the intersection point.- Returns:
- the linear distance.
-
linearDistanceSquared
Compute linear distance squared from plane to a vector. This is defined as the distance from the given point to the nearest intersection of this plane with the planet surface.- Parameters:
planetModel
- is the planet model.v
- is the point.bounds
- are the bounds which constrain the intersection point.- Returns:
- the linear distance squared.
-
linearDistanceSquared
public double linearDistanceSquared(PlanetModel planetModel, double x, double y, double z, Membership... bounds) Compute linear distance squared from plane to a vector. This is defined as the distance from the given point to the nearest intersection of this plane with the planet surface.- Parameters:
planetModel
- is the planet model.x
- is the vector x.y
- is the vector y.z
- is the vector z.bounds
- are the bounds which constrain the intersection point.- Returns:
- the linear distance squared.
-
interpolate
public GeoPoint[] interpolate(PlanetModel planetModel, GeoPoint start, GeoPoint end, double[] proportions) Find points on the boundary of the intersection of a plane and the unit sphere, given a starting point, and ending point, and a list of proportions of the arc (e.g. 0.25, 0.5, 0.75). The angle between the starting point and ending point is assumed to be less than pi.- Parameters:
planetModel
- is the planet model.start
- is the start point.end
- is the end point.proportions
- is an array of fractional proportions measured between start and end.- Returns:
- an array of points corresponding to the proportions passed in.
-
modify
protected static Vector modify(GeoPoint start, double transX, double transY, double transZ, double sinRA, double cosRA, double sinHA, double cosHA) Modify a point to produce a vector in translated/rotated space.- Parameters:
start
- is the start point.transX
- is the translation x value.transY
- is the translation y value.transZ
- is the translation z value.sinRA
- is the sine of the ascension angle.cosRA
- is the cosine of the ascension angle.sinHA
- is the sine of the height angle.cosHA
- is the cosine of the height angle.- Returns:
- the modified point.
-
reverseModify
protected static GeoPoint reverseModify(PlanetModel planetModel, Vector point, double transX, double transY, double transZ, double sinRA, double cosRA, double sinHA, double cosHA) Reverse modify a point to produce a GeoPoint in normal space.- Parameters:
planetModel
- is the planet model.point
- is the translated point.transX
- is the translation x value.transY
- is the translation y value.transZ
- is the translation z value.sinRA
- is the sine of the ascension angle.cosRA
- is the cosine of the ascension angle.sinHA
- is the sine of the height angle.cosHA
- is the cosine of the height angle.- Returns:
- the original point.
-
findIntersections
Find the intersection points between two planes, given a set of bounds.- Parameters:
planetModel
- is the planet model.q
- is the plane to intersect with.bounds
- are the bounds to consider to determine legal intersection points.- Returns:
- the set of legal intersection points, or null if the planes are numerically identical.
-
findCrossings
Find the points between two planes, where one plane crosses the other, given a set of bounds. Crossing is not just intersection; the planes cannot touch at just one point on the ellipsoid, but must cross at two.- Parameters:
planetModel
- is the planet model.q
- is the plane to intersect with.bounds
- are the bounds to consider to determine legal intersection points.- Returns:
- the set of legal crossing points, or null if the planes are numerically identical.
-
arePointsCoplanar
Checks if three points are coplanar in any of the three planes they can describe. The planes are all assumed to go through the origin.- Parameters:
A
- The first point.B
- The second point.C
- The third point- Returns:
- true if provided points are coplanar in any of the three planes they can describe.
-
findIntersections
protected GeoPoint[] findIntersections(PlanetModel planetModel, Plane q, Membership[] bounds, Membership[] moreBounds) Find the intersection points between two planes, given a set of bounds.- Parameters:
planetModel
- is the planet model to use in finding points.q
- is the plane to intersect with.bounds
- is the set of bounds.moreBounds
- is another set of bounds.- Returns:
- the intersection point(s) on the unit sphere, if there are any.
-
findCrossings
protected GeoPoint[] findCrossings(PlanetModel planetModel, Plane q, Membership[] bounds, Membership[] moreBounds) Find the points between two planes, where one plane crosses the other, given a set of bounds. Crossing is not just intersection; the planes cannot touch at just one point on the ellipsoid, but must cross at two.- Parameters:
planetModel
- is the planet model to use in finding points.q
- is the plane to intersect with.bounds
- is the set of bounds.moreBounds
- is another set of bounds.- Returns:
- the intersection point(s) on the ellipsoid, if there are any.
-
findIntersectionBounds
protected void findIntersectionBounds(PlanetModel planetModel, Bounds boundsInfo, Plane q, Membership... bounds) Record intersection points for planes with error bounds. This method calls the Bounds object with every intersection point it can find that matches the criteria. Each plane is considered to have two sides, one that is D + MINIMUM_RESOLUTION, and one that is D - MINIMUM_RESOLUTION. Both are examined and intersection points determined. -
recordBounds
public void recordBounds(PlanetModel planetModel, XYZBounds boundsInfo, Plane p, Membership... bounds) Accumulate (x,y,z) bounds information for this plane, intersected with another and the world. Updates min/max information using intersection points found. These include the error envelope for the planes (D +/- MINIMUM_RESOLUTION).- Parameters:
planetModel
- is the planet model to use in determining bounds.boundsInfo
- is the xyz info to update with additional bounding information.p
- is the other plane.bounds
- are the surfaces delineating what's inside the shape.
-
recordBounds
Accumulate (x,y,z) bounds information for this plane, intersected with the unit sphere. Updates min/max information, using max/min points found within the specified bounds.- Parameters:
planetModel
- is the planet model to use in determining bounds.boundsInfo
- is the xyz info to update with additional bounding information.bounds
- are the surfaces delineating what's inside the shape.
-
recordBounds
public void recordBounds(PlanetModel planetModel, LatLonBounds boundsInfo, Plane p, Membership... bounds) Accumulate bounds information for this plane, intersected with another plane and the world. Updates both latitude and longitude information, using max/min points found within the specified bounds. Also takes into account the error envelope for all planes being intersected.- Parameters:
planetModel
- is the planet model to use in determining bounds.boundsInfo
- is the lat/lon info to update with additional bounding information.p
- is the other plane.bounds
- are the surfaces delineating what's inside the shape.
-
recordBounds
Accumulate bounds information for this plane, intersected with the unit sphere. Updates both latitude and longitude information, using max/min points found within the specified bounds.- Parameters:
planetModel
- is the planet model to use in determining bounds.boundsInfo
- is the lat/lon info to update with additional bounding information.bounds
- are the surfaces delineating what's inside the shape.
-
intersects
public boolean intersects(PlanetModel planetModel, Plane q, GeoPoint[] notablePoints, GeoPoint[] moreNotablePoints, Membership[] bounds, Membership... moreBounds) Determine whether the plane intersects another plane within the bounds provided.- Parameters:
planetModel
- is the planet model to use in determining intersection.q
- is the other plane.notablePoints
- are points to look at to disambiguate cases when the two planes are identical.moreNotablePoints
- are additional points to look at to disambiguate cases when the two planes are identical.bounds
- is one part of the bounds.moreBounds
- are more bounds.- Returns:
- true if there's an intersection.
-
crosses
public boolean crosses(PlanetModel planetModel, Plane q, GeoPoint[] notablePoints, GeoPoint[] moreNotablePoints, Membership[] bounds, Membership... moreBounds) Determine whether the plane crosses another plane within the bounds provided. Crossing is defined as intersecting with the geo surface at two points.- Parameters:
planetModel
- is the planet model to use in determining intersection.q
- is the other plane.notablePoints
- are points to look at to disambiguate cases when the two planes are identical.moreNotablePoints
- are additional points to look at to disambiguate cases when the two planes are identical.bounds
- is one part of the bounds.moreBounds
- are more bounds.- Returns:
- true if there's a crossing.
-
isFunctionallyIdentical
Returns true if this plane and the other plane are functionally identical within the margin of error. Functionally identical means that the planes are so close to parallel that many aspects of planar math, like intersections, no longer have answers to within the required precision.- Parameters:
p
- is the plane to compare against.- Returns:
- true if the planes are functionally identical.
-
isNumericallyIdentical
Returns true if this plane and the other plane are identical within the margin of error.- Parameters:
p
- is the plane to compare against.- Returns:
- true if the planes are numerically identical.
-
findArcDistancePoints
public GeoPoint[] findArcDistancePoints(PlanetModel planetModel, double arcDistanceValue, GeoPoint startPoint, Membership... bounds) Locate a point that is within the specified bounds and on the specified plane, that has an arcDistance as specified from the startPoint.- Parameters:
planetModel
- is the planet model.arcDistanceValue
- is the arc distance.startPoint
- is the starting point.bounds
- are the bounds.- Returns:
- zero, one, or two points.
-
getSampleIntersectionPoint
Find a sample point on the intersection between two planes and the world.- Parameters:
planetModel
- is the planet model.q
- is the second plane to consider.- Returns:
- a sample point that is on the intersection between the two planes and the world.
-
toString
-
equals
-
hashCode
public int hashCode()
-