Example usage for org.apache.commons.math.geometry Vector3D dotProduct

List of usage examples for org.apache.commons.math.geometry Vector3D dotProduct

Introduction

In this page you can find the example usage for org.apache.commons.math.geometry Vector3D dotProduct.

Prototype

public static double dotProduct(Vector3D v1, Vector3D v2) 

Source Link

Document

Compute the dot-product of two vectors.

Usage

From source file:org.orekit.utils.Line.java

/** Build a line from a point and a direction.
 * @param p point belonging to the line (this can be any point)
 * @param direction direction of the line
 * @exception IllegalArgumentException if the direction norm is too small
 *///  w  ww.ja  va 2s  . com
public Line(final Vector3D p, final Vector3D direction) {
    this.direction = direction.normalize();
    zero = new Vector3D(1.0, p, -Vector3D.dotProduct(p, this.direction), this.direction);
}

From source file:org.orekit.utils.Line.java

/** Get the abscissa of a point with respect to the line.
 * <p>The abscissa is 0 if the projection of the point and the
 * projection of the frame origin on the line are the same
 * point.</p>/*from w  w w .j  a  va2  s .  c o m*/
 * @param point point to check
 * @return abscissa of the point
 */
public double getAbscissa(final Vector3D point) {
    return Vector3D.dotProduct(point.subtract(zero), direction);
}

From source file:org.orekit.utils.Line.java

/** Compute the distance between the instance and a point.
 * @param p to check/*from  w w  w .  j a v  a  2  s .com*/
 * @return distance between the instance and the point
 */
public double distance(final Vector3D p) {
    final Vector3D d = p.subtract(zero);
    return new Vector3D(1.0, d, -Vector3D.dotProduct(d, direction), direction).getNorm();
}