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

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

Introduction

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

Prototype

public Vector3D(double a1, Vector3D u1, double a2, Vector3D u2) 

Source Link

Document

Linear constructor Build a vector from two other ones and corresponding scale factors.

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
 *///ww  w  . j  a v a  2 s  .c  o m
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 one point from the line.
 * @param abscissa desired abscissa for the point
 * @return one point belonging to the line, at specified abscissa
 * (really a {@link Vector3D Vector3D} instance)
 *//*  w  w w  .j av  a2 s  . c  o m*/
public Vector3D pointAt(final double abscissa) {
    return new Vector3D(1.0, zero, abscissa, direction);
}

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

/** Compute the distance between the instance and a point.
 * @param p to check//  w  w w.ja v  a 2s. c om
 * @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();
}

From source file:playground.vsp.analysis.modules.ptTripAnalysis.utils.GeoCalculator.java

@Deprecated
public static double averageStraightDistance(Tuple<Coord, Coord> straightOne, Tuple<Coord, Coord> straightTwo) {
    double dAC, dCE, dBF, dBD;
    //get dist between start/start and end/end
    dAC = distanceBetween2Points(straightOne.getFirst(), straightTwo.getFirst());
    dBD = distanceBetween2Points(straightOne.getSecond(), straightTwo.getSecond());

    // get shortest dist from the start of the first straight to the second straight
    Vector3D pointA, pointB, pointC, pointD, cd, ab, temp;

    pointA = Coord2Vector3D(straightOne.getFirst());
    pointB = Coord2Vector3D(straightOne.getSecond());
    pointC = Coord2Vector3D(straightTwo.getFirst());
    pointD = Coord2Vector3D(straightTwo.getSecond());

    ab = new Vector3D(1, pointB, -1, pointA);
    cd = new Vector3D(1, pointD, -1, pointC);

    // get dCE/*from  w ww .  ja  v  a 2  s. c om*/
    temp = new Vector3D(1, pointC, -1, pointA);
    temp = Vector3D.crossProduct(temp, ab);
    dCE = temp.getNorm() / ab.getNorm();

    // get dBF
    temp = new Vector3D(1, pointB, -1, pointC);
    temp = Vector3D.crossProduct(temp, cd);
    dBF = temp.getNorm() / cd.getNorm();
    return (0.5 * (Math.min(dAC, dCE) + Math.min(dBF, dBD)));
}