org.apache.lucene.geo3d

## Class Vector

- java.lang.Object
- - org.apache.lucene.geo3d.Vector

- Direct Known Subclasses:
    GeoPoint, Plane

      public class Vector
      extends Object

  A 3d vector in space, not necessarily going through the origin.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static double` | `MINIMUM_RESOLUTION` Values that are all considered to be essentially zero have a magnitude less than this.
    `static double` | `MINIMUM_RESOLUTION_CUBED` For cubed quantities, cube the bound.
    `static double` | `MINIMUM_RESOLUTION_SQUARED` For squared quantities, the bound is squared too.
    `double` | `x` The x value
    `double` | `y` The y value
    `double` | `z` The z value

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Vector(double x, double y, double z)` Construct from (U.S.) x,y,z coordinates.
    `Vector(Vector A, Vector B)` Construct a vector that is perpendicular to two other (non-zero) vectors.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static double` | `computeDesiredEllipsoidMagnitude(PlanetModel planetModel, double z)` Compute the desired magnitude of a unit vector projected to a given planet model.
    `protected static double` | `computeDesiredEllipsoidMagnitude(PlanetModel planetModel, double x, double y, double z)` Compute the desired magnitude of a unit vector projected to a given planet model.
    `double` | `dotProduct(double x, double y, double z)` Do a dot product.
    `double` | `dotProduct(Vector v)` Do a dot product.
    `boolean` | `equals(Object o)`
    `int` | `hashCode()`
    `boolean` | `isWithin(Membership[] bounds, Membership[] moreBounds)` Determine if this vector, taken from the origin, describes a point within a set of planes.
    `double` | `linearDistance(double x, double y, double z)` Compute the straight-line distance to a point described by the vector taken from the origin.
    `double` | `linearDistance(Vector v)` Compute the straight-line distance to a point described by the vector taken from the origin.
    `double` | `linearDistanceSquared(double x, double y, double z)` Compute the square of a straight-line distance to a point described by the vector taken from the origin.
    `double` | `linearDistanceSquared(Vector v)` Compute the square of a straight-line distance to a point described by the vector taken from the origin.
    `double` | `magnitude()` Compute the magnitude of this vector.
    `static double` | `magnitude(double x, double y, double z)` Compute a magnitude of an x,y,z value.
    `double` | `normalDistance(double x, double y, double z)` Compute the normal (perpendicular) distance to a vector described by a vector taken from the origin.
    `double` | `normalDistance(Vector v)` Compute the normal (perpendicular) distance to a vector described by a vector taken from the origin.
    `double` | `normalDistanceSquared(double x, double y, double z)` Compute the square of the normal distance to a vector described by a vector taken from the origin.
    `double` | `normalDistanceSquared(Vector v)` Compute the square of the normal distance to a vector described by a vector taken from the origin.
    `Vector` | `normalize()` Compute a normalized unit vector based on the current vector.
    `Vector` | `rotateXY(double angle)` Rotate vector counter-clockwise in x-y by an angle.
    `Vector` | `rotateXY(double sinAngle, double cosAngle)` Rotate vector counter-clockwise in x-y by an angle, expressed as sin and cos.
    `Vector` | `rotateXZ(double angle)` Rotate vector counter-clockwise in x-z by an angle.
    `Vector` | `rotateXZ(double sinAngle, double cosAngle)` Rotate vector counter-clockwise in x-z by an angle, expressed as sin and cos.
    `Vector` | `rotateZY(double angle)` Rotate vector counter-clockwise in z-y by an angle.
    `Vector` | `rotateZY(double sinAngle, double cosAngle)` Rotate vector counter-clockwise in z-y by an angle, expressed as sin and cos.
    `String` | `toString()`
    `Vector` | `translate(double xOffset, double yOffset, double zOffset)` Translate vector.

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

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

- - ### Field Detail

    - #### MINIMUM_RESOLUTION

          public static final double MINIMUM_RESOLUTION

      Values that are all considered to be essentially zero have a magnitude less than this.
      See Also:
        Constant Field Values

    - #### MINIMUM_RESOLUTION_SQUARED

          public static final double MINIMUM_RESOLUTION_SQUARED

      For squared quantities, the bound is squared too.
      See Also:
        Constant Field Values

    - #### MINIMUM_RESOLUTION_CUBED

          public static final double MINIMUM_RESOLUTION_CUBED

      For cubed quantities, cube the bound.
      See Also:
        Constant Field Values

    - #### x

          public final double x

      The x value

    - #### y

          public final double y

      The y value

    - #### z

          public final double z

      The z value

  - ### Constructor Detail

    - #### Vector

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

      Construct from (U.S.) x,y,z coordinates.
      Parameters:
        `x` - is the x value.
        `y` - is the y value.
        `z` - is the z value.

    - #### Vector

          public Vector(Vector A,
                Vector B)

      Construct a vector that is perpendicular to two other (non-zero) vectors. If the vectors are parallel, IllegalArgumentException will be thrown. Produces a normalized final vector.
      Parameters:
        `A` - is the first vector
        `B` - is the second

  - ### Method Detail

    - #### magnitude

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

      Compute a magnitude of an x,y,z value.

    - #### normalize

          public Vector normalize()

      Compute a normalized unit vector based on the current vector.
      Returns:
        the normalized vector, or null if the current vector has a magnitude of zero.

    - #### dotProduct

          public double dotProduct(Vector v)

      Do a dot product.
      Parameters:
        `v` - is the vector to multiply.
      Returns:
        the result.

    - #### dotProduct

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

      Do a dot product.
      Parameters:
        `x` - is the x value of the vector to multiply.
        `y` - is the y value of the vector to multiply.
        `z` - is the z value of the vector to multiply.
      Returns:
        the result.

    - #### isWithin

          public boolean isWithin(Membership[] bounds,
                         Membership[] moreBounds)

      Determine if this vector, taken from the origin, describes a point within a set of planes.
      Parameters:
        `bounds` - is the first part of the set of planes.
        `moreBounds` - is the second part of the set of planes.
      Returns:
        true if the point is within the bounds.

    - #### translate

          public Vector translate(double xOffset,
                         double yOffset,
                         double zOffset)

      Translate vector.

    - #### rotateXY

          public Vector rotateXY(double angle)

      Rotate vector counter-clockwise in x-y by an angle.

    - #### rotateXY

          public Vector rotateXY(double sinAngle,
                        double cosAngle)

      Rotate vector counter-clockwise in x-y by an angle, expressed as sin and cos.

    - #### rotateXZ

          public Vector rotateXZ(double angle)

      Rotate vector counter-clockwise in x-z by an angle.

    - #### rotateXZ

          public Vector rotateXZ(double sinAngle,
                        double cosAngle)

      Rotate vector counter-clockwise in x-z by an angle, expressed as sin and cos.

    - #### rotateZY

          public Vector rotateZY(double angle)

      Rotate vector counter-clockwise in z-y by an angle.

    - #### rotateZY

          public Vector rotateZY(double sinAngle,
                        double cosAngle)

      Rotate vector counter-clockwise in z-y by an angle, expressed as sin and cos.

    - #### linearDistanceSquared

          public double linearDistanceSquared(Vector v)

      Compute the square of a straight-line distance to a point described by the vector taken from the origin. Monotonically increasing for arc distances up to PI.
      Parameters:
        `v` - is the vector to compute a distance to.
      Returns:
        the square of the linear distance.

    - #### linearDistanceSquared

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

      Compute the square of a straight-line distance to a point described by the vector taken from the origin. Monotonically increasing for arc distances up to PI.
      Parameters:
        `x` - is the x part of the vector to compute a distance to.
        `y` - is the y part of the vector to compute a distance to.
        `z` - is the z part of the vector to compute a distance to.
      Returns:
        the square of the linear distance.

    - #### linearDistance

          public double linearDistance(Vector v)

      Compute the straight-line distance to a point described by the vector taken from the origin. Monotonically increasing for arc distances up to PI.
      Parameters:
        `v` - is the vector to compute a distance to.
      Returns:
        the linear distance.

    - #### linearDistance

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

      Compute the straight-line distance to a point described by the vector taken from the origin. Monotonically increasing for arc distances up to PI.
      Parameters:
        `x` - is the x part of the vector to compute a distance to.
        `y` - is the y part of the vector to compute a distance to.
        `z` - is the z part of the vector to compute a distance to.
      Returns:
        the linear distance.

    - #### normalDistanceSquared

          public double normalDistanceSquared(Vector v)

      Compute the square of the normal distance to a vector described by a vector taken from the origin. Monotonically increasing for arc distances up to PI/2.
      Parameters:
        `v` - is the vector to compute a distance to.
      Returns:
        the square of the normal distance.

    - #### normalDistanceSquared

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

      Compute the square of the normal distance to a vector described by a vector taken from the origin. Monotonically increasing for arc distances up to PI/2.
      Parameters:
        `x` - is the x part of the vector to compute a distance to.
        `y` - is the y part of the vector to compute a distance to.
        `z` - is the z part of the vector to compute a distance to.
      Returns:
        the square of the normal distance.

    - #### normalDistance

          public double normalDistance(Vector v)

      Compute the normal (perpendicular) distance to a vector described by a vector taken from the origin. Monotonically increasing for arc distances up to PI/2.
      Parameters:
        `v` - is the vector to compute a distance to.
      Returns:
        the normal distance.

    - #### normalDistance

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

      Compute the normal (perpendicular) distance to a vector described by a vector taken from the origin. Monotonically increasing for arc distances up to PI/2.
      Parameters:
        `x` - is the x part of the vector to compute a distance to.
        `y` - is the y part of the vector to compute a distance to.
        `z` - is the z part of the vector to compute a distance to.
      Returns:
        the normal distance.

    - #### magnitude

          public double magnitude()

      Compute the magnitude of this vector.
      Returns:
        the magnitude.

    - #### computeDesiredEllipsoidMagnitude

          protected static double computeDesiredEllipsoidMagnitude(PlanetModel planetModel,
                                                double x,
                                                double y,
                                                double z)

      Compute the desired magnitude of a unit vector projected to a given planet model.
      Parameters:
        `planetModel` - is the planet model.
        `x` - is the unit vector x value.
        `y` - is the unit vector y value.
        `z` - is the unit vector z value.
      Returns:
        a magnitude value for that (x,y,z) that projects the vector onto the specified ellipsoid.

    - #### computeDesiredEllipsoidMagnitude

          protected static double computeDesiredEllipsoidMagnitude(PlanetModel planetModel,
                                                double z)

      Compute the desired magnitude of a unit vector projected to a given planet model. The unit vector is specified only by a z value.
      Parameters:
        `planetModel` - is the planet model.
        `z` - is the unit vector z value.
      Returns:
        a magnitude value for that z value that projects the vector onto the specified ellipsoid.

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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