Isis Developer Reference
BulletShapeModel.h
Go to the documentation of this file.
1 #ifndef BulletShapeModel_h
2 #define BulletShapeModel_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 #include "ShapeModel.h"
10 
11 #include <vector>
12 
13 #include <QList>
14 #include <QMap>
15 
16 #include "Intercept.h"
19 #include "BulletTargetShape.h"
20 #include "BulletWorldManager.h"
21 #include "Target.h"
22 
23 namespace Isis {
24  class Target;
25 
35  class BulletShapeModel : public ShapeModel {
36  public:
37  // Constructors
39  BulletShapeModel(Target *target, Pvl &pvl);
40  BulletShapeModel(const QString &shapefile, Target *target, Pvl &pvl);
41  BulletShapeModel(BulletTargetShape *shape, Target *target, Pvl &pvl);
43 
44  // Destructor
46 
47  double getTolerance() const;
48  void setTolerance(const double &tolerance);
49 
50  // Intersect the shape model
51  bool intersectSurface(std::vector<double> observerPos,
52  std::vector<double> lookDirection);
53  virtual bool intersectSurface(const Latitude &lat, const Longitude &lon,
54  const std::vector<double> &observerPos,
55  const bool &checkOcclusion = true);
56  virtual bool intersectSurface(const SurfacePoint &surfpt,
57  const std::vector<double> &observerPos,
58  const bool &checkOcclusion = true);
59 
60  virtual void setSurfacePoint(const SurfacePoint &surfacePoint);
61  virtual void clearSurfacePoint();
62 
63  // Calculate the default normal of the current intersection point
65 
66  bool isDEM() const;
67 
68  // Calculate the surface normal of the current intersection point
70  void calculateLocalNormal(QVector<double *> cornerNeighborPoints);
72 
73  Distance localRadius(const Latitude &lat, const Longitude &lon);
74 
76 
77  const BulletWorldManager &model() const;
78 
79 
80  // Determine if the internal intercept is occluded from the observer/lookdir
81  virtual bool isVisibleFrom(const std::vector<double> observerPos,
82  const std::vector<double> lookDirection);
83 
84  private:
85  // Disallow copying because ShapeModel is not copyable
86  Q_DISABLE_COPY(BulletShapeModel)
87 
88  QScopedPointer<BulletWorldManager> m_model;
90  double m_tolerance;
92  BulletClosestRayCallback m_intercept;
94  btScalar maxDistance() const;
95 
96  btVector3 castLookDir(const btVector3 &observer, const btVector3 &lookdir) const;
97  btVector3 latlonToVector(const Latitude &lat, const Longitude &lon) const;
98  btVector3 pointToVector(const SurfacePoint &point) const;
99  SurfacePoint makeSurfacePoint(const btVector3 &point) const;
100 
102  const btVector3 &sortPoint) const;
103  bool isOccluded(const BulletClosestRayCallback &hit,
104  const btVector3 &observer) const;
105 
106  void updateShapeModel(const BulletClosestRayCallback &result);
107 
108 
109  };
110 }
111 
112 #endif
Isis::BulletShapeModel::calculateSurfaceNormal
void calculateSurfaceNormal()
compute the ellipsoid surface normal of the target
Definition: BulletShapeModel.cpp:539
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::ShapeModel::clearSurfacePoint
virtual void clearSurfacePoint()
Clears or resets the current surface point.
Definition: ShapeModel.cpp:386
Isis::BulletShapeModel::BulletShapeModel
BulletShapeModel()
Default constructor that creates a shape model without any internal model.
Definition: BulletShapeModel.cpp:53
Isis::BulletClosestRayCallback::normal
btVector3 normal() const
Return the local surface normal at the intersection, if an intersection exists.
Definition: BulletClosestRayCallback.cpp:183
Isis::Latitude
This class is designed to encapsulate the concept of a Latitude.
Definition: Latitude.h:51
Isis::BulletShapeModel::clearSurfacePoint
virtual void clearSurfacePoint()
Clear the saved surface point and reset the saved intersection.
Definition: BulletShapeModel.cpp:388
Isis::BulletShapeModel::~BulletShapeModel
~BulletShapeModel()
Destructor.
Definition: BulletShapeModel.cpp:159
Isis::ShapeModel::surfaceIntersection
SurfacePoint * surfaceIntersection() const
Returns the surface intersection for this ShapeModel.
Definition: ShapeModel.cpp:358
Isis::ShapeModel::setSurfacePoint
virtual void setSurfacePoint(const SurfacePoint &surfacePoint)
Set surface intersection point.
Definition: ShapeModel.cpp:565
Isis::BulletAllHitsRayCallback
Bullet ray tracing callback to return all intersections along a ray's path.
Definition: BulletAllHitsRayCallback.h:30
SpecialPixel.h
ShapeModel.h
Isis::ShapeModel::targetRadii
std::vector< Distance > targetRadii() const
Returns the radii of the body in km.
Definition: ShapeModel.cpp:465
Target.h
Isis::BulletShapeModel::setLocalNormalFromIntercept
void setLocalNormalFromIntercept()
Set the normal vector to the intercept point normal.
Definition: BulletShapeModel.cpp:436
Longitude.h
NaifStatus.h
Isis::PvlContainer::hasKeyword
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Definition: PvlContainer.cpp:159
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::NaifStatus::CheckErrors
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:28
Isis::ShapeModel::setNormal
void setNormal(const std::vector< double >)
Sets the normal for the currect intersection point.
Definition: ShapeModel.cpp:487
Isis::BulletWorldManager
Bullet World manager maintains a proper state for target bodies.
Definition: BulletWorldManager.h:41
Isis::BulletTargetShape::load
static BulletTargetShape * load(const QString &dem, const Pvl *conf=0)
Load a DEM file into the target shape.
Definition: BulletTargetShape.cpp:84
Isis::BulletClosestRayCallback::point
btVector3 point() const
Return the intersection point, if one exists.
Definition: BulletClosestRayCallback.cpp:167
IString.h
Isis::Distance
Distance measurement, usually in meters.
Definition: Distance.h:34
Isis::Longitude
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:40
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::Distance::Kilometers
@ Kilometers
The distance is being specified in kilometers.
Definition: Distance.h:45
Isis::BulletShapeModel::setTolerance
void setTolerance(const double &tolerance)
Sets the occlusion tolerance.
Definition: BulletShapeModel.cpp:177
Isis::BulletShapeModel::isVisibleFrom
virtual bool isVisibleFrom(const std::vector< double > observerPos, const std::vector< double > lookDirection)
Check if the saved intercept is visible from a observer with a given look direction.
Definition: BulletShapeModel.cpp:470
Isis::BulletShapeModel::model
const BulletWorldManager & model() const
Returns a direct reference to the Bullet world that contains the target shape and can perform ray cas...
Definition: BulletShapeModel.cpp:598
Isis::ShapeModel::setName
void setName(QString name)
Sets the shape name.
Definition: ShapeModel.cpp:532
Latitude.h
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Pvl.h
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::BulletShapeModel::calculateLocalNormal
void calculateLocalNormal(QVector< double * > cornerNeighborPoints)
Compute the normal for a local region of surface points.
Definition: BulletShapeModel.cpp:516
Isis::BulletAllHitsRayCallback::hit
const BulletClosestRayCallback & hit(const int &index=0) const
Return a callback for the intersection at a given index.
Definition: BulletAllHitsRayCallback.cpp:112
Isis::BulletShapeModel::BulletShapeModel
BulletShapeModel(const QString &shapefile, Target *target, Pvl &pvl)
Isis::BulletShapeModel::calculateDefaultNormal
void calculateDefaultNormal()
Calculate the surface normal of the ellipsoid as the default.
Definition: BulletShapeModel.cpp:531
SurfacePoint.h
Intercept.h
BulletTargetShape.h
BulletShapeModel.h
Isis::BulletTargetShape::name
QString name() const
Return name of the target shape.
Definition: BulletTargetShape.cpp:71
Isis::BulletShapeModel::ellipsoidNormal
QVector< double > ellipsoidNormal()
Compute the true surface normal vector of an ellipsoid.
Definition: BulletShapeModel.cpp:559
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::BulletShapeModel::localRadius
Distance localRadius(const Latitude &lat, const Longitude &lon)
Compute the radius of the body at a lat/lon point.
Definition: BulletShapeModel.cpp:410
Isis::BulletClosestRayCallback::isValid
bool isValid() const
Checks if the callback is valid/has a valid intersection.
Definition: BulletClosestRayCallback.cpp:120
Isis::BulletShapeModel::isDEM
bool isDEM() const
Indicates that this shape model is not from a DEM.
Definition: BulletShapeModel.cpp:456
Isis::ShapeModel::setHasNormal
void setHasNormal(bool status)
Sets the flag to indicate whether this ShapeModel has a surface normal.
Definition: ShapeModel.cpp:581
BulletClosestRayCallback.h
Statistics.h
IException.h
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
BulletWorldManager.h
std
Namespace for the standard library.
Isis::ShapeModel::hasValidTarget
bool hasValidTarget() const
Returns the status of the target.
Definition: ShapeModel.cpp:449
Isis::ShapeModel
Define shapes and provide utilities for Isis targets.
Definition: ShapeModel.h:62
Isis::BulletTargetShape
Bullet Target Shape for planetary bodies.
Definition: BulletTargetShape.h:33
Isis::SurfacePoint::ToNaifArray
void ToNaifArray(double naifOutput[3]) const
A naif array is a c-style array of size 3.
Definition: SurfacePoint.cpp:870
BulletAllHitsRayCallback.h
QMap
This is free and unencumbered software released into the public domain.
Definition: CubeIoHandler.h:22
Isis::BulletShapeModel
Shape model that uses the Bullet library to perform ray tracing.
Definition: BulletShapeModel.h:35
Isis::BulletClosestRayCallback::isVisible
bool isVisible(const BulletClosestRayCallback &other, const btScalar tolerance=DBL_MAX) const
Check if the intersection in this is visible based on another callback.
Definition: BulletClosestRayCallback.cpp:291
Isis::ShapeModel::hasIntersection
bool hasIntersection()
Returns intersection status.
Definition: ShapeModel.cpp:368
Isis::BulletShapeModel::intersectSurface
bool intersectSurface(std::vector< double > observerPos, std::vector< double > lookDirection)
This method computes a DEM intercept point given an observer location and look direction using the Bu...
Definition: BulletShapeModel.cpp:193
QVector
This is free and unencumbered software released into the public domain.
Definition: Calculator.h:18
Isis::BulletClosestRayCallback
Bullet ray tracing callback for closest hit on target surface.
Definition: BulletClosestRayCallback.h:33
Isis::BulletShapeModel::getTolerance
double getTolerance() const
Returns the occlusion tolerance in kilometers.
Definition: BulletShapeModel.cpp:167
Isis::Target
This class is used to create and store valid Isis targets.
Definition: Target.h:63
Isis::RAD2DEG
const double RAD2DEG
Multiplier for converting from radians to degrees.
Definition: Constants.h:44
Isis::BulletShapeModel::setSurfacePoint
virtual void setSurfacePoint(const SurfacePoint &surfacePoint)
Set the internal surface point.
Definition: BulletShapeModel.cpp:379
Isis::SurfacePoint
This class defines a body-fixed surface point.
Definition: SurfacePoint.h:132
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::IException::User
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition: IException.h:126
Isis::ShapeModel::normal
std::vector< double > normal()
Returns the local surface normal at the current intersection point.
Definition: ShapeModel.cpp:401