org.apache.lucene.spatial3d.geom

## Class GeoPoint

- java.lang.Object
- - org.apache.lucene.spatial3d.geom.Vector
  - - org.apache.lucene.spatial3d.geom.GeoPoint

- All Implemented Interfaces:
    SerializableObject

      public class GeoPoint
      extends Vector
      implements SerializableObject

  This class represents a point on the surface of a sphere or ellipsoid.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected double` | `latitude` Lazily-evaluated latitude.
    `protected double` | `longitude` Lazily-evaluated longitude.
    `protected double` | `magnitude` This is the lazily-evaluated magnitude.

    - ### Fields 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

    Constructors
    Constructor and Description
    `GeoPoint(double x, double y, double z)` Construct a GeoPoint from an (x,y,z) value.
    `GeoPoint(double magnitude, double x, double y, double z)` Construct a GeoPoint from a unit (x,y,z) vector and a magnitude.
    `GeoPoint(double lat, double lon, double x, double y, double z)` Construct a GeoPoint from five unchecked parameters: lat, lon, x, y, z.
    `GeoPoint(double magnitude, double x, double y, double z, double lat, double lon)` Construct a GeoPoint from a unit (x,y,z) vector and a magnitude.
    `GeoPoint(InputStream inputStream)` Construct a GeoPoint from an input stream with no planet model.
    `GeoPoint(PlanetModel planetModel, double lat, double lon)` Construct a GeoPoint from a latitude/longitude pair.
    `GeoPoint(PlanetModel planetModel, double sinLat, double sinLon, double cosLat, double cosLon)` Construct a GeoPoint from the trig functions of a lat and lon pair.
    `GeoPoint(PlanetModel planetModel, double sinLat, double sinLon, double cosLat, double cosLon, double lat, double lon)` Construct a GeoPoint from the trig functions of a lat and lon pair.
    `GeoPoint(PlanetModel planetModel, InputStream inputStream)` Construct a GeoPoint from an input stream.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `arcDistance(double x, double y, double z)` Compute an arc distance between two points.
    `double` | `arcDistance(Vector v)` Compute an arc distance between two points.
    `double` | `getLatitude()` Compute the latitude for the point.
    `double` | `getLongitude()` Compute the longitude for the point.
    `boolean` | `isIdentical(double x, double y, double z)` Compute whether point matches another.
    `boolean` | `isIdentical(GeoPoint p)` Compute whether point matches another.
    `double` | `magnitude()` Compute the linear magnitude of the point.
    `String` | `toString()`
    `void` | `write(OutputStream outputStream)` Serialize to output stream.

    - ### Methods inherited from class org.apache.lucene.spatial3d.geom.Vector

      `crossProductEvaluateIsZero, dotProduct, dotProduct, equals, hashCode, isNumericallyIdentical, isNumericallyIdentical, isParallel, isParallel, isWithin, linearDistance, linearDistance, linearDistanceSquared, linearDistanceSquared, magnitude, normalDistance, normalDistance, normalDistanceSquared, normalDistanceSquared, normalize, rotateXY, rotateXY, rotateXZ, rotateXZ, rotateZY, rotateZY, translate`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.lucene.spatial3d.geom.SerializableObject

      `readBitSet, readBoolean, readByteArray, readClass, readDouble, readHeterogeneousArray, readHomogeneousArray, readInt, readLong, readObject, readObject, readObject, readObject, readPlanetObject, readPointArray, readPolygonArray, readString, writeBitSet, writeBoolean, writeByteArray, writeClass, writeDouble, writeHeterogeneousArray, writeHeterogeneousArray, writeHomogeneousArray, writeHomogeneousArray, writeInt, writeLong, writeObject, writePlanetObject, writePointArray, writePointArray, writePolygonArray, writePolygonArray, writeString`

- - ### Field Detail

    - #### magnitude

          protected volatile double magnitude

      This is the lazily-evaluated magnitude. Some constructors include it, but others don't, and we try not to create extra computation by always computing it. Does not need to be synchronized for thread safety, because depends wholly on immutable variables of this class.

    - #### latitude

          protected volatile double latitude

      Lazily-evaluated latitude. Does not need to be synchronized for thread safety, because depends wholly on immutable variables of this class.

    - #### longitude

          protected volatile double longitude

      Lazily-evaluated longitude. Does not need to be synchronized for thread safety, because depends wholly on immutable variables of this class.

  - ### Constructor Detail

    - #### GeoPoint

          public GeoPoint(PlanetModel planetModel,
                          double sinLat,
                          double sinLon,
                          double cosLat,
                          double cosLon,
                          double lat,
                          double lon)

      Construct a GeoPoint from the trig functions of a lat and lon pair.
      Parameters:
        `planetModel` - is the planetModel to put the point on.
        `sinLat` - is the sin of the latitude.
        `sinLon` - is the sin of the longitude.
        `cosLat` - is the cos of the latitude.
        `cosLon` - is the cos of the longitude.
        `lat` - is the latitude.
        `lon` - is the longitude.

    - #### GeoPoint

          public GeoPoint(PlanetModel planetModel,
                          double sinLat,
                          double sinLon,
                          double cosLat,
                          double cosLon)

      Construct a GeoPoint from the trig functions of a lat and lon pair.
      Parameters:
        `planetModel` - is the planetModel to put the point on.
        `sinLat` - is the sin of the latitude.
        `sinLon` - is the sin of the longitude.
        `cosLat` - is the cos of the latitude.
        `cosLon` - is the cos of the longitude.

    - #### GeoPoint

          public GeoPoint(PlanetModel planetModel,
                          double lat,
                          double lon)

      Construct a GeoPoint from a latitude/longitude pair.
      Parameters:
        `planetModel` - is the planetModel to put the point on.
        `lat` - is the latitude.
        `lon` - is the longitude.

    - #### GeoPoint

          public GeoPoint(PlanetModel planetModel,
                          InputStream inputStream)
                   throws IOException

      Construct a GeoPoint from an input stream.
      Parameters:
        `planetModel` - is the planet model
        `inputStream` - is the input stream
      Throws:
        `IOException`

    - #### GeoPoint

          public GeoPoint(InputStream inputStream)
                   throws IOException

      Construct a GeoPoint from an input stream with no planet model.
      Parameters:
        `inputStream` - is the input stream
      Throws:
        `IOException`

    - #### GeoPoint

          public GeoPoint(double lat,
                          double lon,
                          double x,
                          double y,
                          double z)

      Construct a GeoPoint from five unchecked parameters: lat, lon, x, y, z. This is primarily used for deserialization, but can also be used to fully initialize a point externally.
      Parameters:
        `lat` - is the latitude in radians
        `lon` - is the longitude in radians
        `x` - is the unit x value
        `y` - is the unit y value
        `z` - is the unit z value

    - #### GeoPoint

          public GeoPoint(double magnitude,
                          double x,
                          double y,
                          double z,
                          double lat,
                          double lon)

      Construct a GeoPoint from a unit (x,y,z) vector and a magnitude.
      Parameters:
        `magnitude` - is the desired magnitude, provided to put the point on the ellipsoid.
        `x` - is the unit x value.
        `y` - is the unit y value.
        `z` - is the unit z value.
        `lat` - is the latitude.
        `lon` - is the longitude.

    - #### GeoPoint

          public GeoPoint(double magnitude,
                          double x,
                          double y,
                          double z)

      Construct a GeoPoint from a unit (x,y,z) vector and a magnitude.
      Parameters:
        `magnitude` - is the desired magnitude, provided to put the point on the ellipsoid.
        `x` - is the unit x value.
        `y` - is the unit y value.
        `z` - is the unit z value.

    - #### GeoPoint

          public GeoPoint(double x,
                          double y,
                          double z)

      Construct a GeoPoint from an (x,y,z) value. The (x,y,z) tuple must be on the desired ellipsoid.
      Parameters:
        `x` - is the ellipsoid point x value.
        `y` - is the ellipsoid point y value.
        `z` - is the ellipsoid point z value.

  - ### Method Detail

    - #### write

          public void write(OutputStream outputStream)
                     throws IOException

      Description copied from interface: `SerializableObject`
      Serialize to output stream.
      Specified by:
        `write` in interface `SerializableObject`
      Parameters:
        `outputStream` - is the output stream to write to.
      Throws:
        `IOException`

    - #### arcDistance

          public double arcDistance(Vector v)

      Compute an arc distance between two points. Note: this is an angular distance, and not a surface distance, and is therefore independent of planet model. For surface distance, see `PlanetModel.surfaceDistance(GeoPoint, GeoPoint)`
      Parameters:
        `v` - is the second point.
      Returns:
        the angle, in radians, between the two points.

    - #### arcDistance

          public double arcDistance(double x,
                                    double y,
                                    double z)

      Compute an arc distance between two points.
      Parameters:
        `x` - is the x part of the second point.
        `y` - is the y part of the second point.
        `z` - is the z part of the second point.
      Returns:
        the angle, in radians, between the two points.

    - #### getLatitude

          public double getLatitude()

      Compute the latitude for the point.
      Returns:
        the latitude.

    - #### getLongitude

          public double getLongitude()

      Compute the longitude for the point.
      Returns:
        the longitude value. Uses 0.0 if there is no computable longitude.

    - #### magnitude

          public double magnitude()

      Compute the linear magnitude of the point.
      Overrides:
        `magnitude` in class `Vector`
      Returns:
        the magnitude.

    - #### isIdentical

          public boolean isIdentical(GeoPoint p)

      Compute whether point matches another.
      Parameters:
        `p` - is the other point.
      Returns:
        true if the same.

    - #### isIdentical

          public boolean isIdentical(double x,
                                     double y,
                                     double z)

      Compute whether point matches another.
      Parameters:
        `x` - is the x value
        `y` - is the y value
        `z` - is the z value
      Returns:
        true if the same.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Vector`

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.