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

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

Introduction

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

Prototype

public Rotation(RotationOrder order, double alpha1, double alpha2, double alpha3) 

Source Link

Document

Build a rotation from three Cardan or Euler elementary rotations.

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));

}