Example usage for org.apache.commons.math3.geometry.euclidean.threed FieldVector3D dotProduct

List of usage examples for org.apache.commons.math3.geometry.euclidean.threed FieldVector3D dotProduct

Introduction

In this page you can find the example usage for org.apache.commons.math3.geometry.euclidean.threed FieldVector3D dotProduct.

Prototype

public T dotProduct(final Vector3D v) 

Source Link

Document

Compute the dot-product of the instance and another vector.

Usage

From source file:org.orekit.forces.gravity.Relativity.java

@Override
public FieldVector3D<DerivativeStructure> accelerationDerivatives(final AbsoluteDate date, final Frame frame,
        final FieldVector3D<DerivativeStructure> position, final FieldVector3D<DerivativeStructure> velocity,
        final FieldRotation<DerivativeStructure> rotation, final DerivativeStructure mass) {

    //radius/*from www.  j  a  v a 2  s  . com*/
    final DerivativeStructure r2 = position.getNormSq();
    final DerivativeStructure r = r2.sqrt();
    //speed squared
    final DerivativeStructure s2 = velocity.getNormSq();
    final double c2 = Constants.SPEED_OF_LIGHT * Constants.SPEED_OF_LIGHT;
    //eq. 3.146
    return new FieldVector3D<DerivativeStructure>(r.reciprocal().multiply(4 * this.gm).subtract(s2), position,
            position.dotProduct(velocity).multiply(4), velocity)
                    .scalarMultiply(r2.multiply(r).multiply(c2).reciprocal().multiply(this.gm));

}