TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Capsule.h
Go to the documentation of this file.
1 
13 #ifndef G3D_CAPSULE_H
14 #define G3D_CAPSULE_H
15 
16 #include "G3D/platform.h"
17 #include "G3D/g3dmath.h"
18 #include "G3D/Vector3.h"
19 
20 namespace G3D {
21 
22 class Line;
23 class AABox;
27 class Capsule {
28 private:
31 
32  float _radius;
33 public:
34 
35 
37  Capsule();
38  Capsule(class BinaryInput& b);
39  Capsule(const Vector3& _p1, const Vector3& _p2, float _r);
40  void serialize(class BinaryOutput& b) const;
41  void deserialize(class BinaryInput& b);
42 
44  Line axis() const;
45 
46  inline float radius() const {
47  return _radius;
48  }
49 
51  inline Vector3 point(int i) const {
52  debugAssert(i == 0 || i == 1);
53  return (i == 0) ? p1 : p2;
54  }
55 
58  inline float height() const {
59  return (p1 - p2).magnitude();
60  }
61 
62  inline Vector3 center() const {
63  return (p1 + p2) / 2.0;
64  }
65 
67  void getReferenceFrame(class CoordinateFrame& cframe) const;
68 
72  bool contains(const Vector3& p) const;
73 
74  float volume() const;
75 
76  float area() const;
77 
79  void getBounds(AABox& out) const;
80 
82  void getRandomSurfacePoint(Vector3& P, Vector3& N) const;
83 
86 };
87 
88 } // namespace
89 
90 #endif
Vector3 center() const
Definition: Capsule.h:62
Definition: BinaryInput.h:69
Definition: Line.h:25
A rigid body RT (rotation-translation) transformation.
Definition: CoordinateFrame.h:59
void getRandomSurfacePoint(Vector3 &P, Vector3 &N) const
Definition: Capsule.cpp:91
Vector3 p1
Definition: Capsule.h:29
Vector3 p2
Definition: Capsule.h:30
Capsule()
Definition: Capsule.cpp:29
Definition: AABox.h:25
Vector3 point(int i) const
Definition: Capsule.h:51
Definition: Vector3.h:58
float height() const
Definition: Capsule.h:58
float area() const
Definition: Capsule.cpp:67
float _radius
Definition: Capsule.h:32
void deserialize(class BinaryInput &b)
Definition: Capsule.cpp:45
Vector3 randomInteriorPoint() const
Definition: Capsule.cpp:142
#define debugAssert(exp)
Definition: debugAssert.h:160
Definition: Capsule.h:27
float radius() const
Definition: Capsule.h:46
void getBounds(AABox &out) const
Definition: Capsule.cpp:78
Line axis() const
Definition: Capsule.cpp:52
Definition: AABox.h:32
Definition: BinaryOutput.h:52
bool contains(const Vector3 &p) const
Definition: Capsule.cpp:86
float volume() const
Definition: Capsule.cpp:57
uint8 const P[]
Definition: AuthenticationPackets.cpp:225
void serialize(class BinaryOutput &b) const
Definition: Capsule.cpp:38
void getReferenceFrame(class CoordinateFrame &cframe) const
Definition: Capsule.cpp:129