public class FacetBodyShape extends AbstractBodyShape
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 BodyShape
:
BodyShape
, 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.
|
BodyShape.MarginType
DEFAULT_EPSILON_SIGNAL_PROPAGATION, distanceEpsilon, lLHCoordinatesSystem
DEFAULT_DISTANCE_EPSILON, DIRECTION_FACTOR
Constructor and Description |
---|
FacetBodyShape(String name,
CelestialBodyFrame bodyFrame,
MeshProvider meshLoader)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
FacetPoint |
buildPoint(LLHCoordinatesSystem coordSystem,
double latitude,
double longitude,
double height,
String nameIn)
Build a
BodyPoint from LLH coordinates. |
FacetPoint |
buildPoint(Vector3D position,
Frame frame,
AbsoluteDate date,
String nameIn)
Build a
BodyPoint from position in provided frame at provided date. |
FacetPoint |
buildPoint(Vector3D position,
String nameIn)
Build a
BodyPoint from position in body frame. |
FacetPoint[] |
closestPointTo(Line line)
This method computes the two points, on the line and on the body, that are the closest to each other.
|
FacetPoint[] |
closestPointTo(Line line,
Frame frame,
AbsoluteDate date)
This method computes the two points, on the line and on the body, that are the closest to each other.
|
FacetPoint |
closestPointTo(Vector3D point)
Computes the point on body surface that is the closest to provided point.
|
FacetPoint |
closestPointTo(Vector3D point,
Frame frame,
AbsoluteDate date)
Computes the point on body surface that is the closest to provided point.
|
FacetPoint |
closestPointTo(Vector3D point,
String nameIn)
Computes the point on body surface that is the closest to provided point.
|
double |
distanceTo(Line line,
Frame frame,
AbsoluteDate date)
Computes the distance to a line.
|
double |
getApparentRadius(PVCoordinatesProvider pvObserver,
AbsoluteDate date,
PVCoordinatesProvider occultedBody,
AbstractSignalPropagationDetector.PropagationDelayType propagationDelayType)
Compute the apparent radius (in meters) of the occulting body from the spacecraft (observer) position.
|
OneAxisEllipsoid |
getEllipsoid(FacetBodyShape.EllipsoidType ellipsoidTypeIn)
Getter for the ellipsoid of the desired type.
|
double |
getEncompassingSphereRadius()
Getter for the radius, in meters, of a sphere centered on the body frame origin and encompassing the shape.
|
FieldData |
getFieldData(SpacecraftState state,
IFieldOfView fieldOfView,
Vector3D lineOfSight)
Getter for the field data as
FieldData for each state in provided list. |
Intersection |
getIntersection(Line line,
Vector3D close,
Frame frame,
AbsoluteDate date)
Getter for the intersection point of a line with the surface of the body.
|
FacetPoint |
getIntersectionPoint(Line line,
Vector3D close,
Frame frame,
AbsoluteDate date)
Getter for the intersection point of a line with the surface of the body.
|
FacetPoint |
getIntersectionPoint(Line line,
Vector3D close,
Frame frame,
AbsoluteDate date,
double altitude)
Getter for the intersection point of a line with the surface of the body for a given altitude.
|
FacetPoint |
getIntersectionPoint(Line line,
Vector3D close,
Frame frame,
AbsoluteDate date,
String nameIn)
Getwter for the intersection point of a line with the surface of the body.
|
FacetPoint[] |
getIntersectionPoints(Line line,
Frame frame,
AbsoluteDate date)
Compute the intersection points with a line.
|
double |
getMaxNorm()
Getter for the distance from center to farthest vertex to center of body.
|
double |
getMaxSlope()
Getter for the maximum angle between the normal to a facet of the body and the vector from the
origin to the centre of the facet.
|
MeshProvider |
getMeshProvider()
Getter for the mesh provider.
|
double |
getMinNorm()
Getter for the distance from center to closest vertex to center of body.
|
List<Triangle> |
getNeighbors(BodyPoint point,
double maxDistance)
Getter for the neighbors of provided geodetic point whose center is closer than provided distance.
|
List<Triangle> |
getNeighbors(BodyPoint point,
int order)
Getter for the neighbor triangles of provided body point which are closer or equal to provided order of
"neighborhood".
For example: Order 0 returns closest triangle Order 1 returns closest triangle and the immediate neighbors of closest triangle Order 2 returns closest triangle, the immediate neighbors of closest triangle and also their own immediate neighbors |
List<Triangle> |
getNeighbors(Triangle triangle,
double maxDistance)
Getter for the neighbors of provided triangle whose center is closer than provided distance of provided triangle
center.
|
List<Triangle> |
getNeighbors(Triangle triangle,
int order)
Getter for 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)
Getter for the neighbors of provided cartesian point whose center is closer than provided distance.
|
List<Triangle> |
getNeighbors(Vector3D pos,
int order)
Getter for 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)
Getter for the list of triangles never enlightened by the Sun at provided dates.
|
List<Triangle> |
getNeverVisibleTriangles(List<SpacecraftState> states,
IFieldOfView fieldOfView)
Getter for the list of triangles never visible from the satellite field of view during the whole ephemeris.
|
List<Triangle> |
getOverPerpendicularSteepFacets()
Find all facets from the mesh that break the convexity property of the facet body shape: the
slope angle is over PI/2.
|
double |
getThreshold()
Getter for the threshold for apparent radius determination convergence.
|
Triangle[] |
getTriangles()
Getter for the mesh under a list of triangles.
|
List<Triangle> |
getVisibleAndEnlightenedTriangles(List<SpacecraftState> states,
PVCoordinatesProvider sun,
IFieldOfView fieldOfView)
Getter for the list of triangles enlightened (by the Sun) and visible at least once during the whole ephemeris
from
the satellite field of view.
|
boolean |
isDefaultLLHCoordinatesSystem()
Indicate if the current LLH coordinates system set for the body is the default one or not.
|
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(BodyShape.MarginType marginType,
double marginValue)
Resize the geometric body shape by a margin.
|
void |
setMaxApparentRadiusSteps(int newLimit)
Setter for the maximum number of steps in the while loop of
#getApparentRadius(PVCoordinatesProvider, AbsoluteDate, PVCoordinatesProvider, PropagationDelayType)
method. |
void |
setThreshold(double threshold)
Setter for the threshold for apparent radius determination convergence.
|
getBodyFrame, getDistanceEpsilon, getEpsilonSignalPropagation, getLLHCoordinatesSystem, getName, getNativeFrame, getPVCoordinates, setDistanceEpsilon, setEpsilonSignalPropagation, setLLHCoordinatesSystem
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
buildRadialPointOnShapeSurface
public FacetBodyShape(String name, CelestialBodyFrame bodyFrame, MeshProvider meshLoader)
name
- body namebodyFrame
- frame in which celestial body coordinates are definedmeshLoader
- mesh loaderpublic OneAxisEllipsoid getEllipsoid(FacetBodyShape.EllipsoidType ellipsoidTypeIn)
ellipsoidTypeIn
- the type of the ellipsoid to be returnedpublic Triangle[] getTriangles()
public 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 FacetPoint 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.
The returned facet point is associated with one or several triangles following the closest point on shape position:
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 FacetPoint getIntersectionPoint(Line line, Vector3D close, Frame frame, AbsoluteDate date, String nameIn) 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.
The returned facet point is associated with one or several triangles following the closest point on shape position:
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 framenameIn
- name of the pointPatriusException
- if line cannot be converted to body framepublic FacetPoint 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.
The returned facet point is associated with one or several triangles following the closest point on shape position:
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 framealtitude
- altitude of the intersectionPatriusException
- if entered altitude is not close to 0
if line cannot be converted to body framepublic FacetPoint[] getIntersectionPoints(Line line, Frame frame, AbsoluteDate date) throws PatriusException
Each facet point in the returned intersections array is associated with one single triangle (other possible belonging triangles not computed).
line
- the lineframe
- in which line is expresseddate
- date of the line in given framePatriusException
- if line cannot be converted to body framepublic List<Triangle> getOverPerpendicularSteepFacets()
maxSlope
.public double distanceTo(Line line, Frame frame, AbsoluteDate date) throws PatriusException
This method is exact and in O(n).
line
- the lineframe
- in which line is expresseddate
- date of the line in given framePatriusException
- if line cannot be converted to body framepublic double getApparentRadius(PVCoordinatesProvider pvObserver, AbsoluteDate date, PVCoordinatesProvider occultedBody, AbstractSignalPropagationDetector.PropagationDelayType propagationDelayType) throws PatriusException
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).
pvObserver
- the spacecraft (observer) position-velocitydate
- the date at which the signal is received by the observer (reception date)occultedBody
- the body which is occulted to the spacecraft (observer) by the occulting bodypropagationDelayType
- propagation delay typePatriusException
- 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(BodyPoint point, double maxDistance)
point
- a body pointmaxDistance
- max distancepublic List<Triangle> getNeighbors(BodyPoint point, int order)
Beware not to confuse this method with getNeighbors(BodyPoint, double)
point
- a body pointorder
- order of "neighborhood"public List<Triangle> getNeighbors(Vector3D pos, double maxDistance)
pos
- a point in body framemaxDistance
- max distancepublic List<Triangle> getNeighbors(Vector3D pos, int order)
Beware not to confuse this method with getNeighbors(Vector3D, double)
pos
- a point in body frameorder
- order of "neighborhood"public 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
- 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
- if intersection computation failedpublic boolean isMasked(Triangle triangle, Vector3D pos) throws PatriusException
triangle
- a trianglepos
- spacecraft position in body framePatriusException
- 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 method cannot however be used in
conjunction with EclipseDetector
since they use a different framework.
This method uses the two following hypotheses: the propagation of the Sun light is instantaneous and the Sun is a point source. Please note that the apparent angle of the Sun as seen from the Earth is about 0.5 degrees, while the one seen from Mars is, to the nearest, roughly 0.38 degrees.
date
- dateposition
- positionframe
- frame in which position is expressedsun
- Sun bodyPatriusException
- 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
- 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
- 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
- if state position could not be retrieved in body framepublic double getMinNorm()
public double getMaxNorm()
public double getThreshold()
public MeshProvider getMeshProvider()
public double getMaxSlope()
public void setThreshold(double threshold)
threshold
- the threshold for apparent radius determination convergence to setpublic FacetBodyShape resize(BodyShape.MarginType marginType, double marginValue)
marginType
- margin type to be usedmarginValue
- margin value to be used (in meters if the margin type is DISTANCE)IllegalArgumentException
- if the margin value is invalidpublic void setMaxApparentRadiusSteps(int newLimit)
#getApparentRadius(PVCoordinatesProvider, AbsoluteDate, PVCoordinatesProvider, PropagationDelayType)
method.newLimit
- new maximum number of steps for apparent radius computationpublic FacetPoint[] closestPointTo(Line line, Frame frame, AbsoluteDate date) throws PatriusException
Note: calculations take the line's minimum abscissa into account.
This method is exact and in O(n).
The returned facet points are associated with one or several triangles following the closest point on shape position:line
- the original line for the shortest distance computationframe
- the line's framedate
- the current dateBodyPoint
(depending on body shape)PatriusException
- if line cannot be converted to body framepublic FacetPoint[] closestPointTo(Line line)
Note: calculations take the line's minimum abscissa into account.
In this method we consider that the line's frame is the body frame, and the date is the
AbsoluteDate.J2000_EPOCH
.
This method is exact and in O(n).
The returned facet points are associated with one or several triangles following the closest point on shape position:line
- the original line for the shortest distance computationBodyPoint
(depending on body shape)public FacetPoint closestPointTo(Vector3D point, Frame frame, AbsoluteDate date) throws PatriusException
The returned facet point is associated with one or several triangles following the closest point position on the shape:
point
- a point expressed in provided frameframe
- framedate
- datePatriusException
- if computation failedpublic FacetPoint closestPointTo(Vector3D point)
The returned facet point is associated with one or several triangles following the closest point position on the shape:
point
- a point expressed in body framepublic FacetPoint closestPointTo(Vector3D point, String nameIn)
The returned facet point is associated with one or several triangles following the closest point position on the shape:
point
- a point expressed in body framenameIn
- name of the pointpublic FacetPoint buildPoint(LLHCoordinatesSystem coordSystem, double latitude, double longitude, double height, String nameIn)
BodyPoint
from LLH coordinates. Type of returned body point depends on body.coordSystem
- LLH coordinates system in which are expressed the entered lat/long/heightlatitude
- input latitudelongitude
- input longitudeheight
- input heightnameIn
- name of the pointpublic FacetPoint buildPoint(Vector3D position, String nameIn)
BodyPoint
from position in body frame. Type of returned body point depends on body.position
- position in body framenameIn
- name of the pointBodyPoint
from position in body framepublic FacetPoint buildPoint(Vector3D position, Frame frame, AbsoluteDate date, String nameIn) throws PatriusException
BodyPoint
from position in provided frame at provided date. Type of returned body point depends
on body.position
- position in provided frame at provided dateframe
- framedate
- datenameIn
- name of the pointBodyPoint
from position in provided frame at provided datePatriusException
- if failed to build pointpublic double getEncompassingSphereRadius()
public boolean isDefaultLLHCoordinatesSystem()
true
if the current LLH coordinates system is the default one, false
otherwiseCopyright © 2023 CNES. All rights reserved.