b2CircleShape.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 *
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.
17 */
18 
19 #ifndef B2_CIRCLE_SHAPE_H
20 #define B2_CIRCLE_SHAPE_H
21 
23 
25 class b2CircleShape : public b2Shape
26 {
27 public:
28  b2CircleShape();
29 
31  b2Shape* Clone(b2BlockAllocator* allocator) const;
32 
34  int32 GetChildCount() const;
35 
37  bool TestPoint(const b2Transform& transform, const b2Vec2& p) const;
38 
40  bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input,
41  const b2Transform& transform, int32 childIndex) const;
42 
44  void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const;
45 
47  void ComputeMass(b2MassData* massData, float32 density) const;
48 
50  int32 GetSupport(const b2Vec2& d) const;
51 
53  const b2Vec2& GetSupportVertex(const b2Vec2& d) const;
54 
56  int32 GetVertexCount() const { return 1; }
57 
59  const b2Vec2& GetVertex(int32 index) const;
60 
63 };
64 
66 {
67  m_type = e_circle;
68  m_radius = 0.0f;
69  m_p.SetZero();
70 }
71 
72 inline int32 b2CircleShape::GetSupport(const b2Vec2 &d) const
73 {
74  B2_NOT_USED(d);
75  return 0;
76 }
77 
78 inline const b2Vec2& b2CircleShape::GetSupportVertex(const b2Vec2 &d) const
79 {
80  B2_NOT_USED(d);
81  return m_p;
82 }
83 
85 {
86  B2_NOT_USED(index);
87  b2Assert(index == 0);
88  return m_p;
89 }
90 
91 #endif
d
void ComputeMass(b2MassData *massData, float32 density) const
GLenum GLenum GLenum input
Ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).
Definition: b2Collision.h:147
int32 GetVertexCount() const
Get the vertex count.
Definition: b2CircleShape.h:56
#define B2_NOT_USED(x)
Definition: b2Settings.h:26
float32 m_radius
Definition: b2Shape.h:93
void SetZero()
Set this vector to all zeros.
Definition: b2Math.h:61
A circle shape.
Definition: b2CircleShape.h:25
A 2D column vector.
Definition: b2Math.h:52
void ComputeAABB(b2AABB *aabb, const b2Transform &transform, int32 childIndex) const
GLuint GLenum GLenum transform
b2Vec2 m_p
Position.
Definition: b2CircleShape.h:62
signed int int32
Definition: b2Settings.h:31
b2Shape * Clone(b2BlockAllocator *allocator) const
Implement b2Shape.
const b2Vec2 & GetVertex(int32 index) const
Get a vertex by index. Used by b2Distance.
Definition: b2CircleShape.h:84
bool RayCast(b2RayCastOutput *output, const b2RayCastInput &input, const b2Transform &transform, int32 childIndex) const
Implement b2Shape.
int32 GetSupport(const b2Vec2 &d) const
Get the supporting vertex index in the given direction.
Definition: b2CircleShape.h:72
GLfloat GLfloat p
GLuint index
An axis aligned bounding box.
Definition: b2Collision.h:162
#define b2Assert(A)
Definition: b2Settings.h:27
const b2Vec2 & GetSupportVertex(const b2Vec2 &d) const
Get the supporting vertex in the given direction.
Definition: b2CircleShape.h:78
Type m_type
Definition: b2Shape.h:92
bool TestPoint(const b2Transform &transform, const b2Vec2 &p) const
Implement b2Shape.
This holds the mass data computed for a shape.
Definition: b2Shape.h:27
int32 GetChildCount() const
float float32
Definition: b2Settings.h:35


mvsim
Author(s):
autogenerated on Fri May 7 2021 03:05:51