49 EmbreeShapeModel::EmbreeShapeModel()
82 m_targetManager(targetManager),
112 QString msg =
"Cannot create a EmbreeShape from " +
m_shapeFile;
129 m_targetManager(targetManager),
130 m_tolerance(DBL_MAX),
131 m_shapeFile(shapefile) {
150 QString msg =
"Cannot create a EmbreeShape from " +
m_shapeFile;
179 std::vector<double> lookDirection) {
224 const std::vector<double> &observerPos,
225 const bool &backCheck) {
247 for (
int i = 0 ; i < hits.size() ; i++) {
253 obsRay.org[0] = observerPos[0];
254 obsRay.org[1] = observerPos[1];
255 obsRay.org[2] = observerPos[2];
256 obsRay.dir[0] = lookVector[0];
257 obsRay.dir[1] = lookVector[1];
258 obsRay.dir[2] = lookVector[2];
261 obsRay.instID = RTC_INVALID_GEOMETRY_ID;
262 obsRay.geomID = RTC_INVALID_GEOMETRY_ID;
263 obsRay.primID = RTC_INVALID_GEOMETRY_ID;
264 obsRay.mask = 0xFFFFFFFF;
302 const std::vector<double> &observerPos,
303 const bool &backCheck) {
333 for (
int i = 0 ; i < hits.size() ; i++) {
339 obsRay.org[0] = observerPos[0];
340 obsRay.org[1] = observerPos[1];
341 obsRay.org[2] = observerPos[2];
342 obsRay.dir[0] = lookVector[0];
343 obsRay.dir[1] = lookVector[1];
344 obsRay.dir[2] = lookVector[2];
347 obsRay.instID = RTC_INVALID_GEOMETRY_ID;
348 obsRay.geomID = RTC_INVALID_GEOMETRY_ID;
349 obsRay.primID = RTC_INVALID_GEOMETRY_ID;
350 obsRay.mask = 0xFFFFFFFF;
381 std::vector<double> intersectArray(3);
384 intersectArray.begin() );
466 const std::vector<double> lookDirection) {
482 std::vector<double> intersectVect(3);
520 QString mess =
"Intercept point does not exist - cannot provide normal vector";
565 QString msg =
"An intersection must be defined before computing the surface normal.";
570 QString msg =
"The surface point intersection must be valid to compute the surface normal.";
575 QString msg =
"A valid target must be defined before computing the surface normal.";
588 surfnm_c(radii[0].kilometers(), radii[1].kilometers(), radii[2].kilometers(),
615 std::vector<double> localNormal;
633 return ellipsoidEmission;
657 double latAngle = lat.
radians();
658 double lonAngle = lon.
radians();
659 ray.dir[0] = cos(latAngle) * cos(lonAngle);
660 ray.dir[1] = cos(latAngle) * sin(lonAngle);
661 ray.dir[2] = sin(latAngle);
686 ray.instID = RTC_INVALID_GEOMETRY_ID;
687 ray.geomID = RTC_INVALID_GEOMETRY_ID;
688 ray.primID = RTC_INVALID_GEOMETRY_ID;
689 ray.mask = 0xFFFFFFFF;
693 std::vector<double> surfVect(3);
701 ray.dir[0] = direction[0];
702 ray.dir[1] = direction[1];
703 ray.dir[2] = direction[2];
727 int hitCount = ray.
lastHit + 1;
731 for (
int i = 0 ; i < hitCount ; i++) {
This class defines a body-fixed surface point.
std::vector< double > normal()
Returns the local surface normal at the current intersection point.
static Vector vector(double v0, double v1, double v2)
Constructs a 3 dimensional vector with the given component values.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
virtual Distance localRadius(const Latitude &lat, const Longitude &lon)
Determine radius at a given lat/lon grid point.
virtual void clearSurfacePoint()
Flag that the ShapeModel does not have a surface point or normal.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
bool hasValidTarget() const
Returns the status of the target.
QVector< RayHitInformation > sortHits(RTCMultiHitRay &ray, LinearAlgebra::Vector &observer)
Sort all intersections by a ray based on distance to a point.
virtual void calculateSurfaceNormal()
Return the surface normal of the ellipsoid.
RTCMultiHitRay pointToRay(const SurfacePoint &point) const
Given a surface point, create a ray that goes from the origin of the target to the surface point...
void free(const QString &shapeFile)
Notify the manager that an EmbreeTargetShape is no longer in use.
virtual void calculateLocalNormal(QVector< double *> cornerNeighborPoints)
Compute the normal for a local region of surface points.
void setNormal(const std::vector< double >)
Sets the normal for the currect intersection point.
double radians() const
Convert an angle to a double.
virtual ~EmbreeShapeModel()
Destructor that notifies the target shape manager that the target shape is no longer in use...
bool hasIntersection()
Returns intersection status.
double m_tolerance
!< This manages EmbreeTargetShapes to allow for sharing of them between EmbreeShapeModels and deletes...
static double magnitude(const Vector &vector)
Computes the magnitude (i.e., the length) of the given vector using the Euclidean norm (L2 norm)...
Namespace for the standard library.
void setTolerance(const double &tolerance)
Set the tolerance used when checking if the stored surface point is visible.
double maximumSceneDistance() const
Return the maximum distance within the scene.
Struct for capturing multiple intersections when using embree::rtcintersectscene. ...
QString m_shapeFile
!< Tolerance for checking visibility.
This class is designed to encapsulate the concept of a Latitude.
The distance is being specified in kilometers.
SurfacePoint * surfaceIntersection() const
Returns the surface intersection for this ShapeModel.
static Vector normalize(const Vector &vector)
Returns a unit vector that is codirectional with the given vector by dividing each component of the v...
This error is for when a programmer made an API call that was illegal.
EmbreeShapeModel()
Default constructor sets type to a TIN.
double kilometers() const
Get the distance in kilometers.
Distance measurement, usually in meters.
double getTolerance() const
Get the tolerance used when checking if the stored surface point is visible.
Class for managing the construction and destruction of EmbreeTargetShapes.
std::vector< Distance > targetRadii() const
Returns the radii of the body in km.
void setHasIntersection(bool b)
Sets the flag to indicate whether this ShapeModel has an intersection.
This class is designed to encapsulate the concept of a Longitude.
boost::numeric::ublas::vector< double > Vector
Definition for an Isis::LinearAlgebra::Vector of doubles.
RTCMultiHitRay latlonToRay(const Latitude &lat, const Longitude &lon) const
Given a latitude and longitude, create a ray that goes from the origin of the target through that lat...
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
unsigned ignorePrimID
IDs of the primitives (trinagles) which should be ignored.
A type of error that could only have occurred due to a mistake on the user's part (e...
virtual double incidenceAngle(const std::vector< double > &uB)
Computes and returns incidence angle, in degrees, given the illuminator position. ...
virtual bool intersectSurface(std::vector< double > observerPos, std::vector< double > lookDirection)
This method computes an intercept point given an observer location and look direction using the Embre...
void intersectRay(RTCMultiHitRay &ray)
Intersect a ray with the target shape.
Container for cube-like labels.
virtual void clearSurfacePoint()
Clears or resets the current surface point.
This class is used to create and store valid Isis3 targets.
Define shapes and provide utilities for Isis3 targets.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
virtual bool isDEM() const
Indicates that this shape model is not from a DEM.
RayHitInformation getHitInformation(RTCMultiHitRay &ray, int hitIndex)
Extract the intersection point and unit surface normal from an RTCMultiHitRay that has been intersect...
Struct for capturing occluded plates when using embree::rtcintersectscene.
void ToNaifArray(double naifOutput[3]) const
A naif array is a c-style array of size 3.
virtual bool isVisibleFrom(const std::vector< double > observerPos, const std::vector< double > lookDirection)
Check if the current internalized surface point is visible from an observer position and look directi...
void FromNaifArray(const double naifValues[3])
A naif array is a c-style array of size 3.
virtual void setSurfacePoint(const SurfacePoint &surfacePoint)
Set surface intersection point.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Namespace for ISIS/Bullet specific routines.
void setName(QString name)
Sets the shape name.
void setHasNormal(bool status)
Sets the flag to indicate whether this ShapeModel has a surface normal.
virtual void calculateDefaultNormal()
Return the surface normal of the ellipsoid as the default.
QVector< double > ellipsoidNormal()
Compute the true surface normal vector of an ellipsoid.
int lastHit
Index of the last hit in the hit containers.
virtual double incidenceAngle(const std::vector< double > &uB)
Computes and returns incidence angle, in degrees, given the illuminator position. ...
bool isOccluded(RTCOcclusionRay &ray)
Check if a ray intersects the target body.
Distance GetLocalRadius() const
Return the radius of the surface point.
EmbreeTargetManager * m_targetManager
!< The target body and Embree objects for intersection.
void updateIntersection(const RayHitInformation hitInfo)
Update the ShapeModel given an intersection and normal.
bool hasNormal() const
Returns surface point normal status.
EmbreeTargetShape * create(const QString &shapeFile)
Get a pointer to an EmbreeTargetShape containing the information from a shape file.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.