b2PolygonShape.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_POLYGON_SHAPE_H
20 #define B2_POLYGON_SHAPE_H
21 
23 
28 class b2PolygonShape : public b2Shape
29 {
30 public:
32 
34  b2Shape* Clone(b2BlockAllocator* allocator) const;
35 
37  int32 GetChildCount() const;
38 
44  void Set(const b2Vec2* points, int32 count);
45 
49  void SetAsBox(float32 hx, float32 hy);
50 
56  void SetAsBox(float32 hx, float32 hy, const b2Vec2& center, float32 angle);
57 
59  bool TestPoint(const b2Transform& transform, const b2Vec2& p) const;
60 
62  bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input,
63  const b2Transform& transform, int32 childIndex) const;
64 
66  void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const;
67 
69  void ComputeMass(b2MassData* massData, float32 density) const;
70 
72  int32 GetVertexCount() const { return m_count; }
73 
75  const b2Vec2& GetVertex(int32 index) const;
76 
79  bool Validate() const;
80 
85 };
86 
88 {
89  m_type = e_polygon;
91  m_count = 0;
93 }
94 
96 {
97  b2Assert(0 <= index && index < m_count);
98  return m_vertices[index];
99 }
100 
101 #endif
CvPoint2D32f * center
int32 GetChildCount() const
GLenum GLenum GLenum input
bool RayCast(b2RayCastOutput *output, const b2RayCastInput &input, const b2Transform &transform, int32 childIndex) const
Implement b2Shape.
Ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).
Definition: b2Collision.h:147
#define b2_polygonRadius
Definition: b2Settings.h:77
float32 m_radius
Definition: b2Shape.h:93
void SetZero()
Set this vector to all zeros.
Definition: b2Math.h:61
A 2D column vector.
Definition: b2Math.h:52
GLuint GLenum GLenum transform
bool Validate() const
GLuint GLenum GLsizei GLsizei GLboolean void * points
signed int int32
Definition: b2Settings.h:31
void ComputeMass(b2MassData *massData, float32 density) const
b2Shape * Clone(b2BlockAllocator *allocator) const
Implement b2Shape.
bool TestPoint(const b2Transform &transform, const b2Vec2 &p) const
GLfloat GLfloat p
b2Vec2 m_vertices[b2_maxPolygonVertices]
int32 GetVertexCount() const
Get the vertex count.
#define b2_maxPolygonVertices
Definition: b2Settings.h:54
void SetAsBox(float32 hx, float32 hy)
GLuint index
An axis aligned bounding box.
Definition: b2Collision.h:162
void Set(const b2Vec2 *points, int32 count)
#define b2Assert(A)
Definition: b2Settings.h:27
void ComputeAABB(b2AABB *aabb, const b2Transform &transform, int32 childIndex) const
const b2Vec2 & GetVertex(int32 index) const
Get a vertex by index.
Type m_type
Definition: b2Shape.h:92
GLuint GLuint GLsizei count
GLdouble angle
This holds the mass data computed for a shape.
Definition: b2Shape.h:27
b2Vec2 m_normals[b2_maxPolygonVertices]
float float32
Definition: b2Settings.h:35


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