org.apache.lucene.spatial3d.geom

## Class Vector

- java.lang.Object
- - org.apache.lucene.spatial3d.geom.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
`static double` `MINIMUM_ANGULAR_RESOLUTION` Angular version of minimum resolution.
`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(double AX, double AY, double AZ, double BX, double BY, double BZ)` Construct a vector that is perpendicular to two other (non-zero) vectors.
`Vector(Vector A, double BX, double BY, double BZ)` Construct a vector that is perpendicular to two other (non-zero) vectors.
`Vector(Vector A, Vector B)` Construct a vector that is perpendicular to two other (non-zero) vectors.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static boolean` `crossProductEvaluateIsZero(Vector A, Vector B, Vector point)` Evaluate the cross product of two vectors against a point.
`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` `isNumericallyIdentical(double otherX, double otherY, double otherZ)` Compute whether two vectors are numerically identical.
`boolean` `isNumericallyIdentical(Vector other)` Compute whether two vectors are numerically identical.
`boolean` `isParallel(double otherX, double otherY, double otherZ)` Compute whether two vectors are parallel.
`boolean` `isParallel(Vector other)` Compute whether two vectors are numerically identical.
`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_ANGULAR_RESOLUTION

    public static final double MINIMUM_ANGULAR_RESOLUTION

Angular version of minimum resolution.

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,
                  double BX,
                  double BY,
                  double BZ)

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
  `BX` - is the X value of the second
  `BY` - is the Y value of the second
  `BZ` - is the Z value of the second

#### Vector

    public Vector(double AX,
                  double AY,
                  double AZ,
                  double BX,
                  double BY,
                  double BZ)

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:
  `AX` - is the X value of the first
  `AY` - is the Y value of the first
  `AZ` - is the Z value of the first
  `BX` - is the X value of the second
  `BY` - is the Y value of the second
  `BZ` - is the Z value of the second

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

#### crossProductEvaluateIsZero

    public static boolean crossProductEvaluateIsZero(Vector A,
                                                     Vector B,
                                                     Vector point)

Evaluate the cross product of two vectors against a point. If the dot product of the resultant vector resolves to "zero", then return true.

Parameters:
  `A` - is the first vector to use for the cross product.
  `B` - is the second vector to use for the cross product.
  `point` - is the point to evaluate.
Returns:
  true if we get a zero dot product.

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

#### isNumericallyIdentical

    public boolean isNumericallyIdentical(double otherX,
                                          double otherY,
                                          double otherZ)

Compute whether two vectors are numerically identical.

Parameters:
  `otherX` - is the other vector X.
  `otherY` - is the other vector Y.
  `otherZ` - is the other vector Z.
Returns:
  true if they are numerically identical.

#### isNumericallyIdentical

    public boolean isNumericallyIdentical(Vector other)

Compute whether two vectors are numerically identical.

Parameters:
  `other` - is the other vector.
Returns:
  true if they are numerically identical.

#### isParallel

    public boolean isParallel(double otherX,
                              double otherY,
                              double otherZ)

Compute whether two vectors are parallel.

Parameters:
  `otherX` - is the other vector X.
  `otherY` - is the other vector Y.
  `otherZ` - is the other vector Z.
Returns:
  true if they are parallel.

#### isParallel

    public boolean isParallel(Vector other)

Compute whether two vectors are numerically identical.

Parameters:
  `other` - is the other vector.
Returns:
  true if they are parallel.

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