Isis 3 Programmer Reference
BulletShapeModel.h
1#ifndef BulletShapeModel_h
2#define BulletShapeModel_h
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"
17#include "BulletAllHitsRayCallback.h"
18#include "BulletClosestRayCallback.h"
19#include "BulletTargetShape.h"
20#include "BulletWorldManager.h"
21#include "Target.h"
22
23namespace Isis {
24 class Target;
25
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
75 QVector<double> ellipsoidNormal();
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;
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
101 QVector<BulletClosestRayCallback> sortHits(const BulletAllHitsRayCallback &hits,
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
Bullet ray tracing callback to return all intersections along a ray's path.
Bullet ray tracing callback for closest hit on target surface.
Shape model that uses the Bullet library to perform ray tracing.
const BulletWorldManager & model() const
Returns a direct reference to the Bullet world that contains the target shape and can perform ray cas...
BulletClosestRayCallback m_intercept
! Tolerance of occlusion check in kilometers.
void calculateSurfaceNormal()
compute the ellipsoid surface normal of the target
void updateShapeModel(const BulletClosestRayCallback &result)
Update shape model - carefully!!
void calculateLocalNormal(QVector< double * > cornerNeighborPoints)
Compute the normal for a local region of surface points.
Distance localRadius(const Latitude &lat, const Longitude &lon)
Compute the radius of the body at a lat/lon point.
SurfacePoint makeSurfacePoint(const btVector3 &point) const
Convert a vector into a surface point.
btVector3 latlonToVector(const Latitude &lat, const Longitude &lon) const
Convert a pair of latitude and longitude values into a unit vector pointing from the origin of the bo...
QVector< double > ellipsoidNormal()
Compute the true surface normal vector of an ellipsoid.
double getTolerance() const
Returns the occlusion tolerance in kilometers.
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.
BulletShapeModel()
Default constructor that creates a shape model without any internal model.
void calculateDefaultNormal()
Calculate the surface normal of the ellipsoid as the default.
btVector3 castLookDir(const btVector3 &observer, const btVector3 &lookdir) const
Compute the end point of a ray based on an observer and look direction.
QVector< BulletClosestRayCallback > sortHits(const BulletAllHitsRayCallback &hits, const btVector3 &sortPoint) const
Sort the hits in an AllHitsRayCallback based on distance to a point.
virtual void clearSurfacePoint()
Clear the saved surface point and reset the saved intersection.
double m_tolerance
! Bullet collision world that contains the representation of the body.
void setLocalNormalFromIntercept()
Set the normal vector to the intercept point normal.
btScalar maxDistance() const
! The results of the last ray cast.
bool isDEM() const
Indicates that this shape model is not from a DEM.
bool isOccluded(const BulletClosestRayCallback &hit, const btVector3 &observer) const
Check if an intersection is occluded from an observer.
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...
virtual void setSurfacePoint(const SurfacePoint &surfacePoint)
Set the internal surface point.
btVector3 pointToVector(const SurfacePoint &point) const
Convert a surface point into a vector.
void setTolerance(const double &tolerance)
Sets the occlusion tolerance.
Bullet Target Shape for planetary bodies.
Bullet World manager maintains a proper state for target bodies.
Distance measurement, usually in meters.
Definition Distance.h:34
This class is designed to encapsulate the concept of a Latitude.
Definition Latitude.h:51
This class is designed to encapsulate the concept of a Longitude.
Definition Longitude.h:40
Container for cube-like labels.
Definition Pvl.h:119
Define shapes and provide utilities for Isis targets.
Definition ShapeModel.h:66
This class defines a body-fixed surface point.
This class is used to create and store valid Isis targets.
Definition Target.h:63
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16