Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef B2_SHAPE_H
00020 #define B2_SHAPE_H
00021
00022 #include <Box2D/Common/b2BlockAllocator.h>
00023 #include <Box2D/Common/b2Math.h>
00024 #include <Box2D/Collision/b2Collision.h>
00025
00027 struct b2MassData
00028 {
00030 float32 mass;
00031
00033 b2Vec2 center;
00034
00036 float32 I;
00037 };
00038
00042 class b2Shape
00043 {
00044 public:
00045
00046 enum Type
00047 {
00048 e_circle = 0,
00049 e_edge = 1,
00050 e_polygon = 2,
00051 e_chain = 3,
00052 e_typeCount = 4
00053 };
00054
00055 virtual ~b2Shape() {}
00056
00058 virtual b2Shape* Clone(b2BlockAllocator* allocator) const = 0;
00059
00062 Type GetType() const;
00063
00065 virtual int32 GetChildCount() const = 0;
00066
00070 virtual bool TestPoint(const b2Transform& xf, const b2Vec2& p) const = 0;
00071
00077 virtual bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input,
00078 const b2Transform& transform, int32 childIndex) const = 0;
00079
00084 virtual void ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 childIndex) const = 0;
00085
00090 virtual void ComputeMass(b2MassData* massData, float32 density) const = 0;
00091
00092 Type m_type;
00093 float32 m_radius;
00094 };
00095
00096 inline b2Shape::Type b2Shape::GetType() const
00097 {
00098 return m_type;
00099 }
00100
00101 #endif