Package org.apache.lucene.spatial3d.geom
Class PlanetModel
java.lang.Object
org.apache.lucene.spatial3d.geom.PlanetModel
- All Implemented Interfaces:
SerializableObject
Holds mathematical constants associated with the model of a planet.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Utility class for encoding / decoding from lat/lon (decimal degrees) into sortable doc value numerics (integers) -
Field Summary
Modifier and TypeFieldDescriptionfinal double
Semi-major axisfinal double
Semi-minor axisstatic final PlanetModel
Planet model corresponding to Clarke 1866 ellipsoidfinal double
scalar value used to decode from integer back into double spaceutility class used to encode/decode from lat/lon (decimal degrees) into doc value integersfinal double
The inverse of scalefinal double
The inverse of xyScalingfinal double
The square of the inverse of xyScalingfinal double
The inverse of zScalingfinal double
The square of the inverse of zScalingfinal int
Max encoded valuefinal double
maximum magnitude value for *this* planet modelfinal GeoPoint
Max X polefinal GeoPoint
Max Y polefinal double
The mean radius of the planetfinal int
Min encoded valuefinal GeoPoint
Min X polefinal GeoPoint
Min Y polefinal double
Minimum surface distance between polesfinal GeoPoint
North polefinal double
The scale of the planetfinal double
The scaled flattening valuefinal GeoPoint
South polestatic final PlanetModel
Planet model corresponding to sphere.final double
The square ratiostatic final PlanetModel
Planet model corresponding to WGS84 ellipsoidfinal double
The x/y scaling factorfinal double
The z scaling factor -
Constructor Summary
ConstructorDescriptionPlanetModel
(double semiMajorAxis, double semiMinorAxis) * Construct a Planet Model from the semi major axis, semi minor axis=.PlanetModel
(InputStream inputStream) Deserialization constructor. -
Method Summary
Modifier and TypeMethodDescriptionCompute a GeoPoint that's a bisection between two other GeoPoints.createSurfacePoint
(double x, double y, double z) Compute a GeoPoint that's based on (x,y,z) values, but is scaled to actually be on the planet surface.createSurfacePoint
(Vector vector) Compute a GeoPoint that's scaled to actually be on the planet surface.double
decodeValue
(int x) Decodes a given integer back into the radian value according to the defined planet modelint
encodeValue
(double x) encode the provided value from double to integer spaceboolean
return reference to the DocValueEncoder used to encode/decode Geo3DDocValuesdouble
Find the maximum magnitude of all points on the ellipsoid.double
Find the maximum x value.double
Find the maximum y value.double
Find the maximum z value.double
return the calculated mean radius (in units provided by ab and c)double
Find the minimum magnitude of all points on the ellipsoid.double
Find the minimum x value.double
Find the minimum y value.double
Find the minimum z value.int
hashCode()
boolean
isSphere()
Does this planet model describe a sphere?boolean
pointOnSurface
(double x, double y, double z) Check if point is on surface.boolean
Check if point is on surface.boolean
pointOutside
(double x, double y, double z) Check if point is outside surface.boolean
Check if point is outside surface.double
surfaceDistance
(GeoPoint pt1, GeoPoint pt2) Compute surface distance between two points.surfacePointOnBearing
(GeoPoint from, double dist, double bearing) Compute new point given original point, a bearing direction, and an adjusted angle (as would be computed by the surfaceDistance() method above).toString()
void
write
(OutputStream outputStream) Serialize to output stream.
-
Field Details
-
SPHERE
Planet model corresponding to sphere. -
WGS84
Planet model corresponding to WGS84 ellipsoid -
CLARKE_1866
Planet model corresponding to Clarke 1866 ellipsoid -
a
public final double aSemi-major axis -
b
public final double bSemi-minor axis -
xyScaling
public final double xyScalingThe x/y scaling factor -
zScaling
public final double zScalingThe z scaling factor -
inverseXYScaling
public final double inverseXYScalingThe inverse of xyScaling -
inverseZScaling
public final double inverseZScalingThe inverse of zScaling -
inverseXYScalingSquared
public final double inverseXYScalingSquaredThe square of the inverse of xyScaling -
inverseZScalingSquared
public final double inverseZScalingSquaredThe square of the inverse of zScaling -
scaledFlattening
public final double scaledFlatteningThe scaled flattening value -
squareRatio
public final double squareRatioThe square ratio -
meanRadius
public final double meanRadiusThe mean radius of the planet -
scale
public final double scaleThe scale of the planet -
inverseScale
public final double inverseScaleThe inverse of scale -
NORTH_POLE
North pole -
SOUTH_POLE
South pole -
MIN_X_POLE
Min X pole -
MAX_X_POLE
Max X pole -
MIN_Y_POLE
Min Y pole -
MAX_Y_POLE
Max Y pole -
minimumPoleDistance
public final double minimumPoleDistanceMinimum surface distance between poles -
MAX_VALUE
public final double MAX_VALUEmaximum magnitude value for *this* planet model -
DECODE
public final double DECODEscalar value used to decode from integer back into double space -
MAX_ENCODED_VALUE
public final int MAX_ENCODED_VALUEMax encoded value -
MIN_ENCODED_VALUE
public final int MIN_ENCODED_VALUEMin encoded value -
docValueEncoder
utility class used to encode/decode from lat/lon (decimal degrees) into doc value integers
-
-
Constructor Details
-
PlanetModel
public PlanetModel(double semiMajorAxis, double semiMinorAxis) * Construct a Planet Model from the semi major axis, semi minor axis=.- Parameters:
semiMajorAxis
- is the semi major axis (in meters) defined as 'a' in projection formulae.semiMinorAxis
- is the semi minor axis (in meters) defined as 'b' in projection formulae.
-
PlanetModel
Deserialization constructor.- Parameters:
inputStream
- is the input stream.- Throws:
IOException
-
-
Method Details
-
write
Description copied from interface:SerializableObject
Serialize to output stream.- Specified by:
write
in interfaceSerializableObject
- Parameters:
outputStream
- is the output stream to write to.- Throws:
IOException
-
isSphere
public boolean isSphere()Does this planet model describe a sphere?- Returns:
- true if so.
-
getMinimumMagnitude
public double getMinimumMagnitude()Find the minimum magnitude of all points on the ellipsoid.- Returns:
- the minimum magnitude for the planet.
-
getMaximumMagnitude
public double getMaximumMagnitude()Find the maximum magnitude of all points on the ellipsoid.- Returns:
- the maximum magnitude for the planet.
-
getMinimumXValue
public double getMinimumXValue()Find the minimum x value.- Returns:
- the minimum X value.
-
getMaximumXValue
public double getMaximumXValue()Find the maximum x value.- Returns:
- the maximum X value.
-
getMinimumYValue
public double getMinimumYValue()Find the minimum y value.- Returns:
- the minimum Y value.
-
getMaximumYValue
public double getMaximumYValue()Find the maximum y value.- Returns:
- the maximum Y value.
-
getMinimumZValue
public double getMinimumZValue()Find the minimum z value.- Returns:
- the minimum Z value.
-
getMaximumZValue
public double getMaximumZValue()Find the maximum z value.- Returns:
- the maximum Z value.
-
getMeanRadius
public double getMeanRadius()return the calculated mean radius (in units provided by ab and c) -
encodeValue
public int encodeValue(double x) encode the provided value from double to integer space -
decodeValue
public double decodeValue(int x) Decodes a given integer back into the radian value according to the defined planet model -
getDocValueEncoder
return reference to the DocValueEncoder used to encode/decode Geo3DDocValues -
pointOnSurface
Check if point is on surface.- Parameters:
v
- is the point to check.- Returns:
- true if the point is on the planet surface.
-
pointOnSurface
public boolean pointOnSurface(double x, double y, double z) Check if point is on surface.- Parameters:
x
- is the x coord.y
- is the y coord.z
- is the z coord.
-
pointOutside
Check if point is outside surface.- Parameters:
v
- is the point to check.- Returns:
- true if the point is outside the planet surface.
-
pointOutside
public boolean pointOutside(double x, double y, double z) Check if point is outside surface.- Parameters:
x
- is the x coord.y
- is the y coord.z
- is the z coord.
-
createSurfacePoint
Compute a GeoPoint that's scaled to actually be on the planet surface.- Parameters:
vector
- is the vector.- Returns:
- the scaled point.
-
createSurfacePoint
Compute a GeoPoint that's based on (x,y,z) values, but is scaled to actually be on the planet surface.- Parameters:
x
- is the x value.y
- is the y value.z
- is the z value.- Returns:
- the scaled point.
-
bisection
Compute a GeoPoint that's a bisection between two other GeoPoints.- Parameters:
pt1
- is the first point.pt2
- is the second point.- Returns:
- the bisection point, or null if a unique one cannot be found.
-
surfaceDistance
Compute surface distance between two points.- Parameters:
pt1
- is the first point.pt2
- is the second point.- Returns:
- the adjusted angle, when multiplied by the mean earth radius, yields a surface
distance. This will differ from GeoPoint.arcDistance() only when the planet model is not a
sphere. @see
GeoPoint.arcDistance(Vector)
-
surfacePointOnBearing
Compute new point given original point, a bearing direction, and an adjusted angle (as would be computed by the surfaceDistance() method above). The original point can be anywhere on the globe. The bearing direction ranges from 0 (due east at the equator) to pi/2 (due north) to pi (due west at the equator) to 3 pi/4 (due south) to 2 pi.- Parameters:
from
- is the starting point.dist
- is the adjusted angle.bearing
- is the direction to proceed.- Returns:
- the new point, consistent with the bearing direction and distance.
-
equals
-
hashCode
public int hashCode() -
toString
-