public class FacetBodyShape extends Object implements GeometricBodyShape
This class offers an optimal storage under a Binary Space Partition Tree (BSP Tree). Each of the body facet (class
Triangle) is linked to its neighbors. Each of the body vertex (class Vertex) is also linked to its
neighboring triangles Triangle. Hence this class provides very efficient methods (O(log n)) for intersection
computation, neighbors computation, etc.
This class implements the interface GeometricBodyShape:
GeometricBodyShape, this class can be used in conjunction with EclipseDetector and
SensorModel.| Modifier and Type | Class and Description |
|---|---|
static class |
FacetBodyShape.EllipsoidType
Type of ellipsoid to apply transformation methods on.
|
GeometricBodyShape.MarginTypeEPS_ALTITUDE| Constructor and Description |
|---|
FacetBodyShape(String name,
Frame bodyFrame,
PVCoordinatesProvider pvProv,
FacetBodyShape.EllipsoidType ellipsoidTypeIn,
MeshProvider meshLoader)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double |
distanceTo(Line line,
Frame frame,
AbsoluteDate date)
Computes the distance to a line.
|
Frame |
getBodyFrame()
Get body frame related to body shape.
|
FieldData |
getFieldData(SpacecraftState state,
IFieldOfView fieldOfView,
Vector3D lineOfSight)
Returns the field data as
FieldData for each state in provided list. |
ExtendedOneAxisEllipsoid |
getFittedEllipsoid()
Returns the fitted ellipsoid which is the ellipsoid (a, f) which minimizes the distance to all vertices.
|
ExtendedOneAxisEllipsoid |
getInnerEllipsoid()
Returns the inner ellipsoid which is the largest ellipsoid strictly contained in the mesh and centered around (0,
0, 0).
|
ExtendedOneAxisEllipsoid |
getInnerSphere()
Returns the inner sphere which is the largest sphere strictly contained in the mesh and centered around (0, 0,
0).
|
Intersection |
getIntersection(Line line,
Vector3D close,
Frame frame,
AbsoluteDate date)
Get the intersection point of a line with the surface of the body.
|
GeodeticPoint |
getIntersectionPoint(Line line,
Vector3D close,
Frame frame,
AbsoluteDate date)
Get the intersection point of a line with the surface of the body.
|
GeodeticPoint |
getIntersectionPoint(Line line,
Vector3D close,
Frame frame,
AbsoluteDate date,
double altitude)
Get the intersection point of a line with the surface of the body for a given altitude.
|
Vector3D[] |
getIntersectionPoints(Line line,
Frame frame,
AbsoluteDate date)
Compute the intersection points with a line.
|
double |
getLocalAltitude(double latitude,
double longitude)
Returns the altitude of body at point (latitude, longitude).
|
double |
getLocalAltitude(Vector3D direction)
Returns the altitude of body given provided direction in body frame.
|
double |
getLocalRadius(Vector3D posObserver,
Frame frame,
AbsoluteDate date,
PVCoordinatesProvider occultedBody)
Compute the apparent radius (in meters) of the occulting body from the spacecraft (observer) position.
|
double |
getMaxNorm()
Returns the distance from center to farthest vertex to center of body.
|
MeshProvider |
getMeshProvider()
Returns the mesh provider.
|
double |
getMinNorm()
Returns the distance from center to closest vertex to center of body.
|
String |
getName() |
Frame |
getNativeFrame(AbsoluteDate date,
Frame frame)
Get the native frame, i.e.
|
List<Triangle> |
getNeighbors(GeodeticPoint point,
double maxDistance)
Returns the neighbors of provided geodetic point whose center is closer than provided distance.
|
List<Triangle> |
getNeighbors(GeodeticPoint point,
int order)
Returns the neighbor triangles of provided geodetic point which are closer or equal to provided
order of "neighborhood".
|
List<Triangle> |
getNeighbors(Triangle triangle,
double maxDistance)
Returns the neighbors of provided triangle whose center is closer than provided distance of provided triangle
center.
|
List<Triangle> |
getNeighbors(Triangle triangle,
int order)
Returns the neighbors of provided triangle whose distance in terms of triangle is closer or equal to provided
order of "neighborhood".
|
List<Triangle> |
getNeighbors(Vector3D pos,
double maxDistance)
Returns the neighbors of provided cartesian point whose center is closer than provided distance.
|
List<Triangle> |
getNeighbors(Vector3D pos,
int order)
Returns the neighbor triangles of provided cartesian point which are closer or equal to provided
order of "neighborhood".
|
List<Triangle> |
getNeverEnlightenedTriangles(List<AbsoluteDate> dates,
PVCoordinatesProvider sun)
Returns the list of triangles never enlightened by the Sun at provided dates.
|
List<Triangle> |
getNeverVisibleTriangles(List<SpacecraftState> states,
IFieldOfView fieldOfView)
Returns the list of triangles never visible from the satellite field of view during the whole ephemeris.
|
ExtendedOneAxisEllipsoid |
getOuterEllipsoid()
Returns the outer ellipsoid which is the smallest ellipsoid englobing the shape and centered around (0, 0, 0).
|
ExtendedOneAxisEllipsoid |
getOuterSphere()
Returns the outer sphere which is the smallest sphere englobing the shape and centered around (0, 0, 0).
|
PVCoordinates |
getPVCoordinates(AbsoluteDate date,
Frame frame)
Get the
PVCoordinates of the body in the selected frame. |
List<SurfacePointedData> |
getSurfacePointedDataEphemeris(List<SpacecraftState> states,
Vector3D lineOfSight,
PVCoordinatesProvider sun,
double pixelFOV)
Returns the body surface pointed data as
SurfacePointedData for each state in provided list. |
double |
getThreshold()
Returns the threshold for apparent radius determination convergence.
|
Triangle[] |
getTriangles()
Returns the mesh under a list of triangles.
|
List<Triangle> |
getVisibleAndEnlightenedTriangles(List<SpacecraftState> states,
PVCoordinatesProvider sun,
IFieldOfView fieldOfView)
Returns the list of triangles enlightened (by the Sun) and visible at least once during the whole ephemeris
from the satellite field of view.
|
boolean |
isInEclipse(AbsoluteDate date,
Vector3D position,
Frame frame,
PVCoordinatesProvider sun)
Returns true if provided position in provided frame at provided date in in eclipse or not.
|
boolean |
isMasked(Triangle triangle,
Vector3D pos)
Returns true if the triangle is masked by another triangle as seen from the provided position.
|
boolean |
isVisible(Triangle triangle,
Vector3D pos,
IFieldOfView fieldOfView,
Transform t)
Returns true if the triangle is visible from the field of view, i.e.:
Is oriented toward the field of view
All points of the triangle are in the field of view
Triangle not masked by another facet
|
FacetBodyShape |
resize(GeometricBodyShape.MarginType marginType,
double marginValue)
Resize the geometric body shape by a margin.
|
void |
setThreshold(double threshold)
Set the threshold for apparent radius determination convergence.
|
Vector3D |
transform(GeodeticPoint point)
Transform a surface-relative point to a cartesian point.
|
GeodeticPoint |
transform(Vector3D point,
Frame frame,
AbsoluteDate date)
Transform a cartesian point to a surface-relative point.
|
public FacetBodyShape(String name, Frame bodyFrame, PVCoordinatesProvider pvProv, FacetBodyShape.EllipsoidType ellipsoidTypeIn, MeshProvider meshLoader) throws PatriusException
name - body namebodyFrame - frame in which celestial body coordinates are definedpvProv - body PV coordinates providerellipsoidTypeIn - ellipsoid type to apply the transform methods onmeshLoader - mesh loaderPatriusException - thrown if loading failedpublic Triangle[] getTriangles()
public final Frame getBodyFrame()
getBodyFrame in interface BodyShapepublic GeodeticPoint getIntersectionPoint(Line line, Vector3D close, Frame frame, AbsoluteDate date) throws PatriusException
A line may have several intersection points with a closed surface (we consider the one point case as a degenerated two points case). The close parameter is used to select which of these points should be returned. The selected point is the one that is closest to the close point.
getIntersectionPoint in interface BodyShapeline - test line (may intersect the body or not)close - point used for intersections selection expressed in the body frameframe - frame in which line is expresseddate - date of the line in given framePatriusException - if line cannot be converted to body framepublic Vector3D[] getIntersectionPoints(Line line, Frame frame, AbsoluteDate date) throws PatriusException
getIntersectionPoints in interface GeometricBodyShapeline - the lineframe - in which line is expresseddate - date of the line in given framePatriusException - if line cannot be converted to body framepublic Intersection getIntersection(Line line, Vector3D close, Frame frame, AbsoluteDate date) throws PatriusException
A line may have several intersection points with a closed surface (we consider the one point case as a degenerated two points case). The close parameter is used to select which of these points should be returned. The selected point is the one that is closest to the close point.
line - test line (may intersect the body or not)close - point used for intersections selection expressed in the body frameframe - frame in which line is expresseddate - date of the line in given framePatriusException - if line cannot be converted to body framepublic GeodeticPoint getIntersectionPoint(Line line, Vector3D close, Frame frame, AbsoluteDate date, double altitude) throws PatriusException
A line may have several intersection points with a closed surface (we consider the one point case as a degenerated two points case). The close parameter is used to select which of these points should be returned. The selected point is the one that is closest to the close point.
Warning: this method returns getIntersectionPoint(Line, Vector3D, Frame, AbsoluteDate) if altitude is
close to 0. An exception is thrown otherwise.
getIntersectionPoint in interface BodyShapeline - test line (may intersect the body or not)close - point used for intersections selection expressed in the body frameframe - frame in which line is expresseddate - date of the line in given framealtitude - altitude of the intersectionPatriusException - if line cannot be converted to body framepublic GeodeticPoint transform(Vector3D point, Frame frame, AbsoluteDate date) throws PatriusException
Warning: this method considers the body either as the inner sphere, the outer ellipsoid or the fitted ellipsoid
depending on the FacetBodyShape.EllipsoidType attribute.
transform in interface BodyShapepoint - cartesian pointframe - frame in which cartesian point is expresseddate - date of the computation (used for frames conversions)PatriusException - if point cannot be converted to body framepublic Vector3D transform(GeodeticPoint point)
Warning: this method considers the body either as the inner sphere, the outer ellipsoid or the fitted ellipsoid
depending on the FacetBodyShape.EllipsoidType attribute.
public double getLocalAltitude(double latitude,
double longitude)
throws PatriusException
Altitude is relative to the inner sphere to the body (which is the largest sphere strictly inside the mesh).
latitude - latitudelongitude - longitudePatriusException - thrown if failed to compute intersectionpublic double getLocalAltitude(Vector3D direction) throws PatriusException
Altitude is relative to the inner sphere to the body (which is the largest sphere strictly inside the mesh).
direction - direction in body framePatriusException - thrown if failed to compute intersectionpublic double distanceTo(Line line, Frame frame, AbsoluteDate date) throws PatriusException
Warning: in case of strongly not convex bodies, this methods may not return exact minimal distance.
distanceTo in interface GeometricBodyShapeline - the lineframe - in which line is expresseddate - date of the line in given framePatriusException - if line cannot be converted to body framepublic double getLocalRadius(Vector3D posObserver, Frame frame, AbsoluteDate date, PVCoordinatesProvider occultedBody) throws PatriusException
Please notice that this method will for the moment be used only with an instantaneous propagation delay type.
To compute the apparent radius (in meters), the algorithm iterates, until convergence, between the minimum and the maximum angles (and so radii too), given by the apparent angles (and so radii too) of the inner and outer ellipsoid of this occulting body. Given the plane containing the observer, the occulted body and this occulting body, if the line lying on this plane and connecting the observer to the hypothetical tangential point of this occulting body actually intersects this occulting body, the search for the correct angle value by which this line shall be rotated (within the given plane) to be tangential to this occulting body will continue towards a larger angle, otherwise it will continue towards a smaller angle. Each time, this line is rotated by the current value of the angle and the value of the apparent radius is computed thanks to the current angle and the distance between the observer and this occulting body. Convergence is reached when the absolute value of the difference between the current value of the apparent radius and the previous one is smaller than a specified threshold (in meters).
getLocalRadius in interface GeometricBodyShapeposObserver - the spacecraft (observer) positionframe - the reference frame in which the spacecraft (observer) position is expresseddate - the date at which the spacecraft (observer) position is expressedoccultedBody - the body which is occulted to the spacecraft (observer) by the occulting bodyPatriusException - if the PVCoordinatesProvider computation failspublic List<Triangle> getNeighbors(Triangle triangle, double maxDistance)
Provided triangle is included in the list of neighbors.
Beware not to confuse this method with getNeighbors(Triangle, int)
triangle - a trianglemaxDistance - max distancepublic List<Triangle> getNeighbors(Triangle triangle, int order)
Beware not to confuse this method with getNeighbors(Triangle, double)
triangle - a triangleorder - order of "neighborhood"public List<Triangle> getNeighbors(GeodeticPoint point, double maxDistance) throws PatriusException
point - a geodetic pointmaxDistance - max distancePatriusException - thrown if computation failed (should not happen)public List<Triangle> getNeighbors(GeodeticPoint point, int order) throws PatriusException
Beware not to confuse this method with getNeighbors(GeodeticPoint, double)
point - a geodetic pointorder - order of "neighborhood"PatriusException - thrown if computation failed (should not happen)public List<Triangle> getNeighbors(Vector3D pos, double maxDistance) throws PatriusException
pos - a point in body framemaxDistance - max distancePatriusException - thrown if computation failed (should not happen)public List<Triangle> getNeighbors(Vector3D pos, int order) throws PatriusException
Beware not to confuse this method with getNeighbors(Vector3D, double)
pos - a point in body frameorder - order of "neighborhood"PatriusException - thrown if computation failed (should not happen)public List<SurfacePointedData> getSurfacePointedDataEphemeris(List<SpacecraftState> states, Vector3D lineOfSight, PVCoordinatesProvider sun, double pixelFOV) throws PatriusException
SurfacePointedData for each state in provided list. The light
propagation is considered as instantaneous.states - list of spacecraft stateslineOfSight - line of sight in spacecraft framesun - Sun bodypixelFOV - aperture of field of view for one pixelSurfacePointedData, one per provided datePatriusException - thrown if state position could not be retrieved in body frame or if intersection is null
or Sun frame conversion failedpublic FieldData getFieldData(SpacecraftState state, IFieldOfView fieldOfView, Vector3D lineOfSight) throws PatriusException
FieldData for each state in provided list.state - spacecraft statefieldOfView - sensor field of viewlineOfSight - optional parameter in order to indicate field of view main line of sight in spacecraft frame.
If provided, this parameter may fasten algorithm by several order of magnitudes (O(log n) vs O(n)).
Be careful, in this case, strongly not convex bodies may lead to missing some triangles.FieldData for corresponding statePatriusException - thrown if state position could not be retrieved in body framepublic boolean isVisible(Triangle triangle, Vector3D pos, IFieldOfView fieldOfView, Transform t) throws PatriusException
triangle - a trianglefieldOfView - field of viewpos - spacecraft position in body framet - transform from body frame to spacecraft framePatriusException - thrown if intersection computation failedpublic boolean isMasked(Triangle triangle, Vector3D pos) throws PatriusException
triangle - a trianglepos - spacecraft position in body framePatriusException - thrown if intersection computation failedpublic boolean isInEclipse(AbsoluteDate date, Vector3D position, Frame frame, PVCoordinatesProvider sun) throws PatriusException
Computed eclipse status is exact and takes into account full body shape. This methods cannot however be used in
conjunction with EclipseDetector since they use a different framework.
date - dateposition - positionframe - frame in which position is expressedsun - Sun bodyPatriusException - thrown if failed to retrieve Sun position of intersection points with bodypublic List<Triangle> getNeverVisibleTriangles(List<SpacecraftState> states, IFieldOfView fieldOfView) throws PatriusException
states - list of spacecraft statesfieldOfView - field of viewTriangle never visible from the satellite field of view during the whole ephemerisPatriusException - thrown if state position could not be retrieved in body framepublic List<Triangle> getNeverEnlightenedTriangles(List<AbsoluteDate> dates, PVCoordinatesProvider sun) throws PatriusException
dates - list of datessun - Sun bodyTriangle never enlightened by the SunPatriusException - thrown if state position could not be retrieved in body framepublic List<Triangle> getVisibleAndEnlightenedTriangles(List<SpacecraftState> states, PVCoordinatesProvider sun, IFieldOfView fieldOfView) throws PatriusException
states - list of spacecraft statessun - sunfieldOfView - field of viewTriangle enlightened and visible at least once from the satellite field of viewPatriusException - thrown if state position could not be retrieved in body framepublic ExtendedOneAxisEllipsoid getFittedEllipsoid()
public ExtendedOneAxisEllipsoid getInnerEllipsoid()
public ExtendedOneAxisEllipsoid getOuterEllipsoid()
public ExtendedOneAxisEllipsoid getInnerSphere()
public ExtendedOneAxisEllipsoid getOuterSphere()
public double getMinNorm()
public double getMaxNorm()
public double getThreshold()
public MeshProvider getMeshProvider()
public void setThreshold(double threshold)
threshold - the threshold for apparent radius determination convergence to setpublic FacetBodyShape resize(GeometricBodyShape.MarginType marginType, double marginValue) throws PatriusException
resize in interface GeometricBodyShapemarginType - margin type to be usedmarginValue - margin value to be used (in meters if the margin type is DISTANCE)PatriusException - if the margin value is invalidpublic final String getName()
getName in interface GeometricBodyShapepublic PVCoordinates getPVCoordinates(AbsoluteDate date, Frame frame) throws PatriusException
PVCoordinates of the body in the selected frame.getPVCoordinates in interface PVCoordinatesProviderdate - current dateframe - the frame where to define the positionPatriusException - if position cannot be computed in given framepublic Frame getNativeFrame(AbsoluteDate date, Frame frame) throws PatriusException
getNativeFrame in interface PVCoordinatesProviderdate - a dateframe - a framePatriusException - thrown if native frame is undefined or unknownCopyright © 2022 CNES. All rights reserved.