List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Rotation Rotation
public Rotation(RotationOrder order, double alpha1, double alpha2, double alpha3)
From source file:org.orekit.frames.TopocentricFrame.java
/** Simple constructor. * @param parentShape body shape on which the local point is defined * @param point local surface point where topocentric frame is defined * @param name the string representation *//*from www. jav a 2 s . c o m*/ public TopocentricFrame(final BodyShape parentShape, final GeodeticPoint point, final String name) { super(parentShape.getBodyFrame(), new Transform(AbsoluteDate.J2000_EPOCH, new Transform(AbsoluteDate.J2000_EPOCH, parentShape.transform(point).negate()), new Transform(AbsoluteDate.J2000_EPOCH, new Rotation(point.getEast(), point.getZenith(), Vector3D.PLUS_I, Vector3D.PLUS_K), Vector3D.ZERO)), name, false); this.parentShape = parentShape; this.point = point; }
From source file:org.orekit.models.earth.tessellation.AlongTrackAiming.java
/** {@inheritDoc} */ @Override//from w ww . j ava 2 s . c om public Vector3D alongTileDirection(final Vector3D point, final GeodeticPoint gp) throws OrekitException { final double lStart = halfTrack.get(0).getFirst().getLatitude(); final double lEnd = halfTrack.get(halfTrack.size() - 1).getFirst().getLatitude(); // check the point can be reached if (gp.getLatitude() < FastMath.min(lStart, lEnd) || gp.getLatitude() > FastMath.max(lStart, lEnd)) { throw new OrekitException(OrekitMessages.OUT_OF_RANGE_LATITUDE, FastMath.toDegrees(gp.getLatitude()), FastMath.toDegrees(FastMath.min(lStart, lEnd)), FastMath.toDegrees(FastMath.max(lStart, lEnd))); } // bracket the point in the half track sample int iInf = 0; int iSup = halfTrack.size() - 1; while (iSup - iInf > 1) { final int iMiddle = (iSup + iInf) / 2; if ((lStart < lEnd) ^ (halfTrack.get(iMiddle).getFirst().getLatitude() > gp.getLatitude())) { // the specified latitude is in the second half iInf = iMiddle; } else { // the specified latitude is in the first half iSup = iMiddle; } } // ensure we can get points at iStart, iStart + 1, iStart + 2 and iStart + 3 final int iStart = FastMath.max(0, FastMath.min(iInf - 1, halfTrack.size() - 4)); // interpolate ground sliding point at specified latitude final HermiteInterpolator interpolator = new HermiteInterpolator(); for (int i = iStart; i < iStart + 4; ++i) { final Vector3D position = halfTrack.get(i).getSecond().getPosition(); final Vector3D velocity = halfTrack.get(i).getSecond().getVelocity(); interpolator.addSamplePoint(halfTrack.get(i).getFirst().getLatitude(), new double[] { position.getX(), position.getY(), position.getZ(), velocity.getX(), velocity.getY(), velocity.getZ() }); } final DerivativeStructure[] p = interpolator.value(new DerivativeStructure(1, 1, 0, gp.getLatitude())); // extract interpolated ground position/velocity final Vector3D position = new Vector3D(p[0].getValue(), p[1].getValue(), p[2].getValue()); final Vector3D velocity = new Vector3D(p[3].getValue(), p[4].getValue(), p[5].getValue()); // adjust longitude to match the specified one final Rotation rotation = new Rotation(Vector3D.PLUS_K, position, Vector3D.PLUS_K, point); final Vector3D fixedVelocity = rotation.applyTo(velocity); // the tile direction is aligned with sliding point velocity return fixedVelocity.normalize(); }
From source file:org.orekit.utils.AngularCoordinates.java
/** Build the rotation that transforms a pair of pv coordinates into another one. /*from w ww. j av a2 s . com*/ * <p><em>WARNING</em>! This method requires much more stringent assumptions on * its parameters than the similar {@link Rotation#Rotation(Vector3D, Vector3D, * Vector3D, Vector3D) constructor} from the {@link Rotation Rotation} class. * As far as the Rotation constructor is concerned, the {@code v} vector from * the second pair can be slightly misaligned. The Rotation constructor will * compensate for this misalignment and create a rotation that ensure {@code * v? = r(u?)} and {@code v plane (r(u?), r(u))}. <em>THIS IS NOT * TRUE ANYMORE IN THIS CLASS</em>! As derivatives are involved and must be * preserved, this constructor works <em>only</em> if the two pairs are fully * consistent, i.e. if a rotation exists that fulfill all the requirements: {@code * v? = r(u?)}, {@code v = r(u)}, {@code dv?/dt = dr(u?)/dt}, {@code dv/dt * = dr(u)/dt}, {@code dv?/dt = dr(u?)/dt}, {@code dv/dt = dr(u)/dt}.</p> * @param u1 first vector of the origin pair * @param u2 second vector of the origin pair * @param v1 desired image of u1 by the rotation * @param v2 desired image of u2 by the rotation * @param tolerance relative tolerance factor used to check singularities * @exception OrekitException if the vectors are inconsistent for the * rotation to be found (null, aligned, ...) */ public AngularCoordinates(final PVCoordinates u1, final PVCoordinates u2, final PVCoordinates v1, final PVCoordinates v2, final double tolerance) throws OrekitException { try { // find the initial fixed rotation rotation = new Rotation(u1.getPosition(), u2.getPosition(), v1.getPosition(), v2.getPosition()); // find rotation rate such that // v? = r(dot(u?)) - dot(v?) // v = r(dot(u)) - dot(v) final Vector3D ru1Dot = rotation.applyTo(u1.getVelocity()); final Vector3D ru2Dot = rotation.applyTo(u2.getVelocity()); rotationRate = inverseCrossProducts(v1.getPosition(), ru1Dot.subtract(v1.getVelocity()), v2.getPosition(), ru2Dot.subtract(v2.getVelocity()), tolerance); // find rotation acceleration dot() such that // dot() v? = r(dotdot(u?)) - 2 dot(v?) - ( v?) - dotdot(v?) // dot() v = r(dotdot(u)) - 2 dot(v) - ( v) - dotdot(v) final Vector3D ru1DotDot = rotation.applyTo(u1.getAcceleration()); final Vector3D oDotv1 = Vector3D.crossProduct(rotationRate, v1.getVelocity()); final Vector3D oov1 = Vector3D.crossProduct(rotationRate, Vector3D.crossProduct(rotationRate, v1.getPosition())); final Vector3D c1 = new Vector3D(1, ru1DotDot, -2, oDotv1, -1, oov1, -1, v1.getAcceleration()); final Vector3D ru2DotDot = rotation.applyTo(u2.getAcceleration()); final Vector3D oDotv2 = Vector3D.crossProduct(rotationRate, v2.getVelocity()); final Vector3D oov2 = Vector3D.crossProduct(rotationRate, Vector3D.crossProduct(rotationRate, v2.getPosition())); final Vector3D c2 = new Vector3D(1, ru2DotDot, -2, oDotv2, -1, oov2, -1, v2.getAcceleration()); rotationAcceleration = inverseCrossProducts(v1.getPosition(), c1, v2.getPosition(), c2, tolerance); } catch (MathIllegalArgumentException miae) { throw new OrekitException(miae); } catch (MathArithmeticException mae) { throw new OrekitException(mae); } }
From source file:sceneGraph.Rot.java
public Rot(DVector iv1, DVector iv2, DVector iu1, DVector iu2) { Vector3D v1 = new Vector3D((double) iv1.x, (double) iv1.y, (double) iv1.z); Vector3D v2 = new Vector3D((double) iv2.x, (double) iv2.y, (double) iv2.z); Vector3D u1 = new Vector3D((double) iu1.x, (double) iu1.y, (double) iu1.z); Vector3D u2 = new Vector3D((double) iu2.x, (double) iu2.y, (double) iu2.z); try {/*from w w w . ja v a 2 s . co m*/ rotation = new Rotation(v1, v2, u1, u2); } catch (Exception e) { rotation = new Rotation(v1, 0f); } }
From source file:sceneGraph.Rot.java
public Rot(PVector iv1, PVector iv2, PVector iu1, PVector iu2) { Vector3D v1 = new Vector3D((double) iv1.x, (double) iv1.y, (double) iv1.z); Vector3D v2 = new Vector3D((double) iv2.x, (double) iv2.y, (double) iv2.z); Vector3D u1 = new Vector3D((double) iu1.x, (double) iu1.y, (double) iu1.z); Vector3D u2 = new Vector3D((double) iu2.x, (double) iu2.y, (double) iu2.z); try {/*from w w w .j a v a 2s . c om*/ rotation = new Rotation(v1, v2, u1, u2); } catch (Exception e) { rotation = new Rotation(v1, 0f); } }