List of usage examples for org.apache.commons.math3.geometry.euclidean.threed FieldRotation applyTo
public FieldRotation<T> applyTo(final Rotation r)
From source file:org.orekit.forces.BoxAndSolarArraySpacecraft.java
/** Get solar array normal in spacecraft frame. * @param date current date/* ww w .j a v a2s .c om*/ * @param frame inertial reference frame for state (both orbit and attitude) * @param position position of spacecraft in reference frame * @param rotation orientation (attitude) of the spacecraft with respect to reference frame * @return solar array normal in spacecraft frame * @exception OrekitException if sun direction cannot be computed in best lightning * configuration */ public synchronized FieldVector3D<DerivativeStructure> getNormal(final AbsoluteDate date, final Frame frame, final FieldVector3D<DerivativeStructure> position, final FieldRotation<DerivativeStructure> rotation) throws OrekitException { final DerivativeStructure one = position.getX().getField().getOne(); if (referenceDate != null) { // use a simple rotation at fixed rate final DerivativeStructure alpha = one.multiply(rotationRate * date.durationFrom(referenceDate)); return new FieldVector3D<DerivativeStructure>(alpha.cos(), saX, alpha.sin(), saY); } // compute orientation for best lightning final FieldVector3D<DerivativeStructure> sunInert = position .subtract(sun.getPVCoordinates(date, frame).getPosition()).negate().normalize(); final FieldVector3D<DerivativeStructure> sunSpacecraft = rotation.applyTo(sunInert); final DerivativeStructure d = FieldVector3D.dotProduct(sunSpacecraft, saZ); final DerivativeStructure f = d.multiply(d).subtract(1).negate(); if (f.getValue() < Precision.EPSILON) { // extremely rare case: the sun is along solar array rotation axis // (there will not be much output power ...) // we set up an arbitrary normal return new FieldVector3D<DerivativeStructure>(one, saZ.orthogonal()); } final DerivativeStructure s = f.sqrt().reciprocal(); return new FieldVector3D<DerivativeStructure>(s, sunSpacecraft) .subtract(new FieldVector3D<DerivativeStructure>(s.multiply(d), saZ)); }
From source file:org.orekit.forces.BoxAndSolarArraySpacecraft.java
/** {@inheritDoc} */ public FieldVector3D<DerivativeStructure> dragAcceleration(final AbsoluteDate date, final Frame frame, final FieldVector3D<DerivativeStructure> position, final FieldRotation<DerivativeStructure> rotation, final DerivativeStructure mass, final double density, final FieldVector3D<DerivativeStructure> relativeVelocity) throws OrekitException { // relative velocity in spacecraft frame final FieldVector3D<DerivativeStructure> v = rotation.applyTo(relativeVelocity); // solar array contribution final FieldVector3D<DerivativeStructure> solarArrayFacet = new FieldVector3D<DerivativeStructure>( solarArrayArea, getNormal(date, frame, position, rotation)); DerivativeStructure sv = FieldVector3D.dotProduct(v, solarArrayFacet).abs(); // body facets contribution for (final Facet facet : facets) { final DerivativeStructure dot = FieldVector3D.dotProduct(v, facet.getNormal()); if (dot.getValue() < 0) { // the facet intercepts the incoming flux sv = sv.subtract(dot.multiply(facet.getArea())); }/* w w w . j a v a2 s . c o m*/ } return new FieldVector3D<DerivativeStructure>(sv.multiply(density * dragCoeff / 2.0).divide(mass), relativeVelocity); }
From source file:org.orekit.forces.BoxAndSolarArraySpacecraft.java
/** {@inheritDoc} */ public FieldVector3D<DerivativeStructure> radiationPressureAcceleration(final AbsoluteDate date, final Frame frame, final FieldVector3D<DerivativeStructure> position, final FieldRotation<DerivativeStructure> rotation, final DerivativeStructure mass, final FieldVector3D<DerivativeStructure> flux) throws OrekitException { if (flux.getNormSq().getValue() < Precision.SAFE_MIN) { // null illumination (we are probably in umbra) return new FieldVector3D<DerivativeStructure>(0.0, flux); }/*www.ja v a 2s .c om*/ // radiation flux in spacecraft frame final FieldVector3D<DerivativeStructure> fluxSat = rotation.applyTo(flux); // solar array contribution FieldVector3D<DerivativeStructure> normal = getNormal(date, frame, position, rotation); DerivativeStructure dot = FieldVector3D.dotProduct(normal, fluxSat); if (dot.getValue() > 0) { // the solar array is illuminated backward, // fix signs to compute contribution correctly dot = dot.negate(); normal = normal.negate(); } FieldVector3D<DerivativeStructure> force = facetRadiationAcceleration(normal, solarArrayArea, fluxSat, dot); // body facets contribution for (final Facet bodyFacet : facets) { normal = new FieldVector3D<DerivativeStructure>(mass.getField().getOne(), bodyFacet.getNormal()); dot = FieldVector3D.dotProduct(normal, fluxSat); if (dot.getValue() < 0) { // the facet intercepts the incoming flux force = force.add(facetRadiationAcceleration(normal, bodyFacet.getArea(), fluxSat, dot)); } } // convert to inertial frame return rotation.applyInverseTo(new FieldVector3D<DerivativeStructure>(mass.reciprocal(), force)); }
From source file:org.orekit.utils.FieldAngularCoordinates.java
/** Estimate FieldRotation<T> rate between two orientations. * <p>Estimation is based on a simple fixed rate FieldRotation<T> * during the time interval between the two orientations.</p> * @param start start orientation/* w w w . j a va 2s .c o m*/ * @param end end orientation * @param dt time elapsed between the dates of the two orientations * @param <T> the type of the field elements * @return FieldRotation<T> rate allowing to go from start to end orientations */ public static <T extends RealFieldElement<T>> FieldVector3D<T> estimateRate(final FieldRotation<T> start, final FieldRotation<T> end, final double dt) { final FieldRotation<T> evolution = start.applyTo(end.revert()); return new FieldVector3D<T>(evolution.getAngle().divide(dt), evolution.getAxis()); }
From source file:org.orekit.utils.FieldAngularCoordinates.java
/** Get a time-shifted state. * <p>//from www. j a va 2s. c om * The state can be slightly shifted to close dates. This shift is based on * a simple quadratic model. It is <em>not</em> intended as a replacement for * proper attitude propagation but should be sufficient for either small * time shifts or coarse accuracy. * </p> * @param dt time shift in seconds * @return a new state, shifted with respect to the instance (which is immutable) */ public FieldAngularCoordinates<T> shiftedBy(final double dt) { // the shiftedBy method is based on a local approximation. // It considers separately the contribution of the constant // rotation, the linear contribution or the rate and the // quadratic contribution of the acceleration. The rate // and acceleration contributions are small rotations as long // as the time shift is small, which is the crux of the algorithm. // Small rotations are almost commutative, so we append these small // contributions one after the other, as if they really occurred // successively, despite this is not what really happens. // compute the linear contribution first, ignoring acceleration // BEWARE: there is really a minus sign here, because if // the target frame rotates in one direction, the vectors in the origin // frame seem to rotate in the opposite direction final T rate = rotationRate.getNorm(); final T zero = rate.getField().getZero(); final T one = rate.getField().getOne(); final FieldRotation<T> rateContribution = (rate.getReal() == 0.0) ? new FieldRotation<T>(one, zero, zero, zero, false) : new FieldRotation<T>(rotationRate, rate.multiply(-dt)); // append rotation and rate contribution final FieldAngularCoordinates<T> linearPart = new FieldAngularCoordinates<T>( rateContribution.applyTo(rotation), rotationRate); final T acc = rotationAcceleration.getNorm(); if (acc.getReal() == 0.0) { // no acceleration, the linear part is sufficient return linearPart; } // compute the quadratic contribution, ignoring initial rotation and rotation rate // BEWARE: there is really a minus sign here, because if // the target frame rotates in one direction, the vectors in the origin // frame seem to rotate in the opposite direction final FieldAngularCoordinates<T> quadraticContribution = new FieldAngularCoordinates<T>( new FieldRotation<T>(rotationAcceleration, acc.multiply(-0.5 * dt * dt)), new FieldVector3D<T>(dt, rotationAcceleration), rotationAcceleration); // the quadratic contribution is a small rotation: // its initial angle and angular rate are both zero. // small rotations are almost commutative, so we append the small // quadratic part after the linear part as a simple offset return quadraticContribution.addOffset(linearPart); }