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_CHAIN_SHAPE_H
00020 #define B2_CHAIN_SHAPE_H
00021
00022 #include <Box2D/Collision/Shapes/b2Shape.h>
00023
00024 class b2EdgeShape;
00025
00032 class b2ChainShape : public b2Shape
00033 {
00034 public:
00035 b2ChainShape();
00036
00038 ~b2ChainShape();
00039
00041 void Clear();
00042
00046 void CreateLoop(const b2Vec2* vertices, int32 count);
00047
00051 void CreateChain(const b2Vec2* vertices, int32 count);
00052
00055 void SetPrevVertex(const b2Vec2& prevVertex);
00056
00059 void SetNextVertex(const b2Vec2& nextVertex);
00060
00062 b2Shape* Clone(b2BlockAllocator* allocator) const;
00063
00065 int32 GetChildCount() const;
00066
00068 void GetChildEdge(b2EdgeShape* edge, int32 index) const;
00069
00072 bool TestPoint(const b2Transform& transform, const b2Vec2& p) const;
00073
00075 bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input,
00076 const b2Transform& transform, int32 childIndex) const;
00077
00079 void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const;
00080
00083 void ComputeMass(b2MassData* massData, float32 density) const;
00084
00086 b2Vec2* m_vertices;
00087
00089 int32 m_count;
00090
00091 b2Vec2 m_prevVertex, m_nextVertex;
00092 bool m_hasPrevVertex, m_hasNextVertex;
00093 };
00094
00095 inline b2ChainShape::b2ChainShape()
00096 {
00097 m_type = e_chain;
00098 m_radius = b2_polygonRadius;
00099 m_vertices = NULL;
00100 m_count = 0;
00101 m_hasPrevVertex = false;
00102 m_hasNextVertex = false;
00103 }
00104
00105 #endif