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

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

Introduction

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

Prototype

public double getNormSq() 

Source Link

Document

Get the square of the norm for the vector.

Usage

From source file:org.orekit.frames.LocalOrbitalFrame.java

/** {@inheritDoc} */
protected void updateFrame(final AbsoluteDate date) throws OrekitException {

    // get position/velocity with respect to parent frame
    final PVCoordinates pv = provider.getPVCoordinates(date, getParent());
    final Vector3D p = pv.getPosition();
    final Vector3D v = pv.getVelocity();
    final Vector3D momentum = pv.getMomentum();

    // compute the translation part of the transform
    final Transform translation = new Transform(p.negate(), v.negate());

    // compute the rotation part of the transform
    final Rotation r = new Rotation((type == LOFType.TNW) ? v : p, momentum, Vector3D.PLUS_I, Vector3D.PLUS_K);
    final Transform rotation = new Transform(r, new Vector3D(1.0 / p.getNormSq(), r.applyTo(momentum)));

    // update the frame defining transform
    setTransform(new Transform(translation, rotation));

}