TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Cylinder.h
Go to the documentation of this file.
1 
13 #ifndef G3D_Cylinder_H
14 #define G3D_Cylinder_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 Cylinder {
28 private:
31 
32  float mRadius;
33 
34 public:
35 
37  Cylinder();
38  Cylinder(class BinaryInput& b);
39  Cylinder(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 
50  void getReferenceFrame(class CoordinateFrame& cframe) const;
51 
53  inline const Vector3& point(int i) const {
54  debugAssert(i >= 0 && i <= 1);
55  return (i == 0) ? p1 : p2;
56  }
57 
61  bool contains(const Vector3& p) const;
62 
63  float area() const;
64 
65  float volume() const;
66 
67  float radius() const;
68 
70  inline Vector3 center() const {
71  return (p1 + p2) / 2.0f;
72  }
73 
74  inline float height() const {
75  return (p1 - p2).magnitude();
76  }
77 
81  void getBounds(AABox& out) const;
82 
84  void getRandomSurfacePoint(Vector3& P, Vector3& N) const;
85 
88 };
89 
90 } // namespace
91 
92 #endif
Definition: BinaryInput.h:69
Definition: Line.h:25
A rigid body RT (rotation-translation) transformation.
Definition: CoordinateFrame.h:59
void deserialize(class BinaryInput &b)
Definition: Cylinder.cpp:45
Definition: AABox.h:25
float area() const
Definition: Cylinder.cpp:69
Vector3 center() const
Definition: Cylinder.h:70
void getBounds(AABox &out) const
Definition: Cylinder.cpp:78
Definition: Vector3.h:58
void getReferenceFrame(class CoordinateFrame &cframe) const
Definition: Cylinder.cpp:89
Cylinder()
Definition: Cylinder.cpp:29
#define debugAssert(exp)
Definition: debugAssert.h:160
Definition: Cylinder.h:27
Vector3 p1
Definition: Cylinder.h:29
float mRadius
Definition: Cylinder.h:32
Line axis() const
Definition: Cylinder.cpp:52
Vector3 p2
Definition: Cylinder.h:30
const Vector3 & point(int i) const
Definition: Cylinder.h:53
float volume() const
Definition: Cylinder.cpp:63
float height() const
Definition: Cylinder.h:74
Definition: AABox.h:32
float radius() const
Definition: Cylinder.cpp:58
Definition: BinaryOutput.h:52
bool contains(const Vector3 &p) const
Definition: Cylinder.cpp:84
void getRandomSurfacePoint(Vector3 &P, Vector3 &N) const
Definition: Cylinder.cpp:102
Vector3 randomInteriorPoint() const
Definition: Cylinder.cpp:154
void serialize(class BinaryOutput &b) const
Definition: Cylinder.cpp:38
uint8 const P[]
Definition: AuthenticationPackets.cpp:225