Isis Developer Reference
BulletClosestRayCallback.h
Go to the documentation of this file.
1 #ifndef BulletClosestRayCallback_h
2 #define BulletClosestRayCallback_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 
10 #include <QScopedPointer>
11 #include <QString>
12 #include <QVector>
13 
14 #include "Constants.h"
15 #include "IException.h"
16 #include "IsisBullet.h"
17 #include "SurfacePoint.h"
18 
19 namespace Isis {
20 
21 class BulletTargetShape;
22 
33  class BulletClosestRayCallback : public btCollisionWorld::ClosestRayResultCallback {
34  public:
36  BulletClosestRayCallback(const BulletClosestRayCallback &result, const btVector3 &point,
37  const btVector3 &normal);
38  BulletClosestRayCallback(const btVector3 &observer, const btVector3 &lookdir);
39  BulletClosestRayCallback(const btVector3 &observer, const btVector3 &lookdir,
40  const btCollisionWorld::RayResultCallback &source,
41  btCollisionWorld::LocalRayResult &rayResult,
42  bool nornmalInWorldSpace);
43  virtual ~BulletClosestRayCallback();
44 
45  bool isValid() const;
46 
47  btVector3 observer() const;
48  btVector3 lookdir() const;
49 
50  btScalar fraction() const;
51  btVector3 point() const;
52  btVector3 normal() const;
53  int triangleIndex() const;
54  int partId() const;
55 
56  btScalar distance() const;
57  btScalar distance(const BulletClosestRayCallback &other) const;
58  btScalar distance(const btVector3 &other) const;
59  bool operator==(const BulletClosestRayCallback &other) const;
60 
61  bool isVisible(const BulletClosestRayCallback &other,
62  const btScalar tolerance = DBL_MAX) const;
63 
64  const BulletTargetShape *body() const;
65 
66  protected:
67  btVector3 m_point;
68  btVector3 m_normal;
71  int m_partId;
74  virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &rayResult,
75  bool normalInWorldSpace);
76 
77  private:
78  unsigned int defaultFlags() const;
79  void copyRayResult(btCollisionWorld::RayResultCallback &dest,
80  const btCollisionWorld::RayResultCallback &source);
81 
82  };
83 
84 } // namespace Isis
85 
86 #endif
87 
Isis::BulletClosestRayCallback::partId
int partId() const
Return the Bullet ID of the intersected collision object.
Definition: BulletClosestRayCallback.cpp:210
Isis::BulletClosestRayCallback::normal
btVector3 normal() const
Return the local surface normal at the intersection, if an intersection exists.
Definition: BulletClosestRayCallback.cpp:183
Isis::BulletClosestRayCallback::m_normal
btVector3 m_normal
! The intersection point in body fixed (x, y, z) kilometers.
Definition: BulletClosestRayCallback.h:68
Isis::BulletClosestRayCallback::m_triangleIndex
int m_triangleIndex
! The local surface normal at the intersection point in body fixed (x, y, z).
Definition: BulletClosestRayCallback.h:70
Isis::BulletClosestRayCallback::point
btVector3 point() const
Return the intersection point, if one exists.
Definition: BulletClosestRayCallback.cpp:167
Isis::BulletClosestRayCallback::fraction
btScalar fraction() const
Return the intersection hit fraction or fractional distance along the ray of the intersection.
Definition: BulletClosestRayCallback.cpp:157
Isis::BulletClosestRayCallback::BulletClosestRayCallback
BulletClosestRayCallback()
Default constructor.
Definition: BulletClosestRayCallback.cpp:31
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::BulletClosestRayCallback::addSingleResult
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &rayResult, bool normalInWorldSpace)
! The Bullet ID of the intersected collision object.
Definition: BulletClosestRayCallback.cpp:333
Isis::BulletClosestRayCallback::body
const BulletTargetShape * body() const
@breif Return pointer to target shape
Definition: BulletClosestRayCallback.cpp:313
Isis::BulletClosestRayCallback::~BulletClosestRayCallback
virtual ~BulletClosestRayCallback()
Destory a callback.
Definition: BulletClosestRayCallback.cpp:110
SurfacePoint.h
BulletTargetShape.h
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::BulletClosestRayCallback::isValid
bool isValid() const
Checks if the callback is valid/has a valid intersection.
Definition: BulletClosestRayCallback.cpp:120
Isis::BulletClosestRayCallback::triangleIndex
int triangleIndex() const
Return the 0-based index of the intersected triangle.
Definition: BulletClosestRayCallback.cpp:200
BulletClosestRayCallback.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
Isis::BulletTargetShape
Bullet Target Shape for planetary bodies.
Definition: BulletTargetShape.h:33
Isis::BulletClosestRayCallback::distance
btScalar distance() const
Returns the distance from the intersection point to the beginning of the ray.
Definition: BulletClosestRayCallback.cpp:221
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
Constants.h
Isis::BulletClosestRayCallback::operator==
bool operator==(const BulletClosestRayCallback &other) const
Equality operator to check if this callback is equivalent to another callback.
Definition: BulletClosestRayCallback.cpp:266
Isis::BulletClosestRayCallback
Bullet ray tracing callback for closest hit on target surface.
Definition: BulletClosestRayCallback.h:33
Isis::BulletClosestRayCallback::observer
btVector3 observer() const
Return the beginning of the ray.
Definition: BulletClosestRayCallback.cpp:130
Isis::BulletClosestRayCallback::lookdir
btVector3 lookdir() const
Return the end of the ray.
Definition: BulletClosestRayCallback.cpp:140
Isis::BulletClosestRayCallback::m_point
btVector3 m_point
Definition: BulletClosestRayCallback.h:67
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
IsisBullet.h
Isis::BulletClosestRayCallback::m_partId
int m_partId
! The 0-based index of the intersected triangle.
Definition: BulletClosestRayCallback.h:71