use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.
the class AbstractParametricAcceleration method acceleration.
/**
* {@inheritDoc}
*/
@Override
public Vector3D acceleration(final SpacecraftState state, final double[] parameters) throws OrekitException {
final Vector3D inertialDirection;
if (isInertial) {
// the acceleration direction is already defined in the inertial frame
inertialDirection = direction;
} else {
final Attitude attitude;
if (attitudeOverride == null) {
// the acceleration direction is defined in spacecraft frame as set by the propagator
attitude = state.getAttitude();
} else {
// the acceleration direction is defined in a dedicated frame
attitude = attitudeOverride.getAttitude(state.getOrbit(), state.getDate(), state.getFrame());
}
inertialDirection = attitude.getRotation().applyInverseTo(direction);
}
return new Vector3D(signedAmplitude(state, parameters), inertialDirection);
}
use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.
the class Atmosphere method getVelocity.
/**
* Get the inertial velocity of atmosphere molecules.
* <p>By default, atmosphere is supposed to have a null
* velocity in the central body frame.</p>
*
* @param date current date
* @param position current position in frame
* @param frame the frame in which is defined the position
* @return velocity (m/s) (defined in the same frame as the position)
* @exception OrekitException if some conversion cannot be performed
*/
default Vector3D getVelocity(AbsoluteDate date, Vector3D position, Frame frame) throws OrekitException {
final Transform bodyToFrame = getFrame().getTransformTo(frame, date);
final Vector3D posInBody = bodyToFrame.getInverse().transformPosition(position);
final PVCoordinates pvBody = new PVCoordinates(posInBody, Vector3D.ZERO);
final PVCoordinates pvFrame = bodyToFrame.transformPVCoordinates(pvBody);
return pvFrame.getVelocity();
}
use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraft method radiationPressureAcceleration.
/**
* {@inheritDoc}
*/
@Override
public Vector3D radiationPressureAcceleration(final AbsoluteDate date, final Frame frame, final Vector3D position, final Rotation rotation, final double mass, final Vector3D flux, final double[] parameters) throws OrekitException {
if (flux.getNormSq() < Precision.SAFE_MIN) {
// null illumination (we are probably in umbra)
return Vector3D.ZERO;
}
// radiation flux in spacecraft frame
final Vector3D fluxSat = rotation.applyTo(flux);
// solar array contribution
Vector3D normal = getNormal(date, frame, position, rotation);
double dot = Vector3D.dotProduct(normal, fluxSat);
if (dot > 0) {
// the solar array is illuminated backward,
// fix signs to compute contribution correctly
dot = -dot;
normal = normal.negate();
}
Vector3D force = facetRadiationAcceleration(normal, solarArrayArea, fluxSat, dot, parameters);
// body facets contribution
for (final Facet bodyFacet : facets) {
normal = bodyFacet.getNormal();
dot = Vector3D.dotProduct(normal, fluxSat);
if (dot < 0) {
// the facet intercepts the incoming flux
force = force.add(facetRadiationAcceleration(normal, bodyFacet.getArea(), fluxSat, dot, parameters));
}
}
// convert to inertial frame
return rotation.applyInverseTo(new Vector3D(1.0 / mass, force));
}
use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraft method dragAcceleration.
/**
* {@inheritDoc}
*/
@Override
public Vector3D dragAcceleration(final AbsoluteDate date, final Frame frame, final Vector3D position, final Rotation rotation, final double mass, final double density, final Vector3D relativeVelocity, final double[] parameters) throws OrekitException {
final double dragCoeff = parameters[0];
final double liftRatio = liftParameterDriver == null ? 0.0 : parameters[1];
// relative velocity in spacecraft frame
final double vNorm2 = relativeVelocity.getNormSq();
final double vNorm = FastMath.sqrt(vNorm2);
final Vector3D vDir = rotation.applyTo(relativeVelocity.scalarMultiply(1.0 / vNorm));
final double coeff = density * dragCoeff * vNorm2 / (2.0 * mass);
final double oMr = 1 - liftRatio;
// solar array contribution
final Vector3D frontNormal = getNormal(date, frame, position, rotation);
final double s = coeff * solarArrayArea * Vector3D.dotProduct(frontNormal, vDir);
Vector3D acceleration = new Vector3D(oMr * FastMath.abs(s), vDir, liftRatio * s * 2, frontNormal);
// body facets contribution
for (final Facet facet : facets) {
final double dot = Vector3D.dotProduct(facet.getNormal(), vDir);
if (dot < 0) {
// the facet intercepts the incoming flux
final double f = coeff * facet.getArea() * dot;
acceleration = new Vector3D(1, acceleration, oMr * FastMath.abs(f), vDir, liftRatio * f * 2, facet.getNormal());
}
}
// convert back to inertial frame
return rotation.applyInverseTo(acceleration);
}
use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.
the class DragForce method acceleration.
/**
* {@inheritDoc}
*/
@Override
public Vector3D acceleration(final SpacecraftState s, final double[] parameters) throws OrekitException {
final AbsoluteDate date = s.getDate();
final Frame frame = s.getFrame();
final Vector3D position = s.getPVCoordinates().getPosition();
final double rho = atmosphere.getDensity(date, position, frame);
final Vector3D vAtm = atmosphere.getVelocity(date, position, frame);
final Vector3D relativeVelocity = vAtm.subtract(s.getPVCoordinates().getVelocity());
return spacecraft.dragAcceleration(date, frame, position, s.getAttitude().getRotation(), s.getMass(), rho, relativeVelocity, parameters);
}
Aggregations