Isis 3 Developer Reference
BulletClosestRayCallback.h
Go to the documentation of this file.
1 #ifndef BulletClosestRayCallback_h
2 #define BulletClosestRayCallback_h
3 
26 #include <QScopedPointer>
27 #include <QString>
28 #include <QVector>
29 
30 #include "Constants.h"
31 #include "IException.h"
32 #include "IsisBullet.h"
33 #include "SurfacePoint.h"
34 
35 namespace Isis {
36 
37 class BulletTargetShape;
38 
49  class BulletClosestRayCallback : public btCollisionWorld::ClosestRayResultCallback {
50  public:
52  BulletClosestRayCallback(const BulletClosestRayCallback &result, const btVector3 &point,
53  const btVector3 &normal);
54  BulletClosestRayCallback(const btVector3 &observer, const btVector3 &lookdir);
55  BulletClosestRayCallback(const btVector3 &observer, const btVector3 &lookdir,
56  const btCollisionWorld::RayResultCallback &source,
57  btCollisionWorld::LocalRayResult &rayResult,
58  bool nornmalInWorldSpace);
59  virtual ~BulletClosestRayCallback();
60 
61  bool isValid() const;
62 
63  btVector3 observer() const;
64  btVector3 lookdir() const;
65 
66  btScalar fraction() const;
67  btVector3 point() const;
68  btVector3 normal() const;
69  int triangleIndex() const;
70  int partId() const;
71 
72  btScalar distance() const;
73  btScalar distance(const BulletClosestRayCallback &other) const;
74  btScalar distance(const btVector3 &other) const;
75  bool operator==(const BulletClosestRayCallback &other) const;
76 
77  bool isVisible(const BulletClosestRayCallback &other,
78  const btScalar tolerance = DBL_MAX) const;
79 
80  const BulletTargetShape *body() const;
81 
82  protected:
83  btVector3 m_point;
84  btVector3 m_normal;
87  int m_partId;
90  virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &rayResult,
91  bool normalInWorldSpace);
92 
93  private:
94  unsigned int defaultFlags() const;
95  void copyRayResult(btCollisionWorld::RayResultCallback &dest,
96  const btCollisionWorld::RayResultCallback &source);
97 
98  };
99 
100 } // namespace Isis
101 
102 #endif
103 
btScalar distance() const
Returns the distance from the intersection point to the beginning of the ray.
Definition: BulletClosestRayCallback.cpp:237
virtual ~BulletClosestRayCallback()
Destory a callback.
Definition: BulletClosestRayCallback.cpp:126
btVector3 m_point
Definition: BulletClosestRayCallback.h:83
const BulletTargetShape * body() const
Return pointer to target shape
Definition: BulletClosestRayCallback.cpp:329
int m_partId
! The 0-based index of the intersected triangle.
Definition: BulletClosestRayCallback.h:87
int m_triangleIndex
! The local surface normal at the intersection point in body fixed (x, y, z).
Definition: BulletClosestRayCallback.h:86
bool operator==(const BulletClosestRayCallback &other) const
Equality operator to check if this callback is equivalent to another callback.
Definition: BulletClosestRayCallback.cpp:282
int partId() const
Return the Bullet ID of the intersected collision object.
Definition: BulletClosestRayCallback.cpp:226
btVector3 m_normal
! The intersection point in body fixed (x, y, z) kilometers.
Definition: BulletClosestRayCallback.h:84
btVector3 point() const
Return the intersection point, if one exists.
Definition: BulletClosestRayCallback.cpp:183
int triangleIndex() const
Return the 0-based index of the intersected triangle.
Definition: BulletClosestRayCallback.cpp:216
btVector3 normal() const
Return the local surface normal at the intersection, if an intersection exists.
Definition: BulletClosestRayCallback.cpp:199
Bullet ray tracing callback for closest hit on target surface.
Definition: BulletClosestRayCallback.h:49
btVector3 observer() const
Return the beginning of the ray.
Definition: BulletClosestRayCallback.cpp:146
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &rayResult, bool normalInWorldSpace)
! The Bullet ID of the intersected collision object.
Definition: BulletClosestRayCallback.cpp:349
btVector3 lookdir() const
Return the end of the ray.
Definition: BulletClosestRayCallback.cpp:156
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:307
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
btScalar fraction() const
Return the intersection hit fraction or fractional distance along the ray of the intersection.
Definition: BulletClosestRayCallback.cpp:173
bool isValid() const
Checks if the callback is valid/has a valid intersection.
Definition: BulletClosestRayCallback.cpp:136
Bullet Target Shape for planetary bodies.
Definition: BulletTargetShape.h:49
BulletClosestRayCallback()
Default constructor.
Definition: BulletClosestRayCallback.cpp:47