2
* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
4
* This software is provided 'as-is', without any express or implied
5
* warranty. In no event will the authors be held liable for any damages
6
* arising from the use of this software.
7
* Permission is granted to anyone to use this software for any purpose,
8
* including commercial applications, and to alter it and redistribute it
9
* freely, subject to the following restrictions:
10
* 1. The origin of this software must not be misrepresented; you must not
11
* claim that you wrote the original software. If you use this software
12
* in a product, an acknowledgment in the product documentation would be
13
* appreciated but is not required.
14
* 2. Altered source versions must be plainly marked as such, and must not be
15
* misrepresented as being the original software.
16
* 3. This notice may not be removed or altered from any source distribution.
19
#ifndef B2_CIRCLE_SHAPE_H
20
#define B2_CIRCLE_SHAPE_H
22
#include <Box2D/Collision/Shapes/b2Shape.h>
25
class b2CircleShape : public b2Shape
30
/// Implement b2Shape.
31
b2Shape* Clone(b2BlockAllocator* allocator) const;
33
/// @see b2Shape::GetChildCount
34
int32 GetChildCount() const;
36
/// Implement b2Shape.
37
bool TestPoint(const b2Transform& transform, const b2Vec2& p) const;
39
/// Implement b2Shape.
40
bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input,
41
const b2Transform& transform, int32 childIndex) const;
43
/// @see b2Shape::ComputeAABB
44
void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const;
46
/// @see b2Shape::ComputeMass
47
void ComputeMass(b2MassData* massData, float32 density) const;
49
/// Get the supporting vertex index in the given direction.
50
int32 GetSupport(const b2Vec2& d) const;
52
/// Get the supporting vertex in the given direction.
53
const b2Vec2& GetSupportVertex(const b2Vec2& d) const;
55
/// Get the vertex count.
56
int32 GetVertexCount() const { return 1; }
58
/// Get a vertex by index. Used by b2Distance.
59
const b2Vec2& GetVertex(int32 index) const;
65
inline b2CircleShape::b2CircleShape()
72
inline int32 b2CircleShape::GetSupport(const b2Vec2 &d) const
78
inline const b2Vec2& b2CircleShape::GetSupportVertex(const b2Vec2 &d) const
84
inline const b2Vec2& b2CircleShape::GetVertex(int32 index) const