Box2D: Box2D/Box2D/Collision/Shapes/b2CircleShape.h Source File

- Main Page
- Classes
- Files

- File List
- File Members

# Box2D/Box2D/Collision/Shapes/b2CircleShape.h

Go to the documentation of this file.

    00001 /*
    00002 * Copyright (c) 2006-2009 Erin Catto http://www.gphysics.com
    00003 *
    00004 * This software is provided 'as-is', without any express or implied
    00005 * warranty.  In no event will the authors be held liable for any damages
    00006 * arising from the use of this software.
    00007 * Permission is granted to anyone to use this software for any purpose,
    00008 * including commercial applications, and to alter it and redistribute it
    00009 * freely, subject to the following restrictions:
    00010 * 1. The origin of this software must not be misrepresented; you must not
    00011 * claim that you wrote the original software. If you use this software
    00012 * in a product, an acknowledgment in the product documentation would be
    00013 * appreciated but is not required.
    00014 * 2. Altered source versions must be plainly marked as such, and must not be
    00015 * misrepresented as being the original software.
    00016 * 3. This notice may not be removed or altered from any source distribution.
    00017 */
    00018
    00019 #ifndef B2_CIRCLE_SHAPE_H
    00020 #define B2_CIRCLE_SHAPE_H
    00021
    00022 #include <Box2D/Collision/Shapes/b2Shape.h>
    00023
    00025 class b2CircleShape : public b2Shape
    00026 {
    00027 public:
    00028         b2CircleShape();
    00029
    00031         b2Shape* Clone(b2BlockAllocator* allocator) const;
    00032
    00034         bool TestPoint(const b2Transform& transform, const b2Vec2& p) const;
    00035
    00037         bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, const b2Transform& transform) const;
    00038
    00040         void ComputeAABB(b2AABB* aabb, const b2Transform& transform) const;
    00041
    00043         void ComputeMass(b2MassData* massData, float32 density) const;
    00044
    00046         int32 GetSupport(const b2Vec2& d) const;
    00047
    00049         const b2Vec2& GetSupportVertex(const b2Vec2& d) const;
    00050
    00052         int32 GetVertexCount() const { return 1; }
    00053
    00055         const b2Vec2& GetVertex(int32 index) const;
    00056
    00058         b2Vec2 m_p;
    00059 };
    00060
    00061 inline b2CircleShape::b2CircleShape()
    00062 {
    00063         m_type = e_circle;
    00064         m_radius = 0.0f;
    00065         m_p.SetZero();
    00066 }
    00067
    00068 inline int32 b2CircleShape::GetSupport(const b2Vec2 &d) const
    00069 {
    00070         B2_NOT_USED(d);
    00071         return 0;
    00072 }
    00073
    00074 inline const b2Vec2& b2CircleShape::GetSupportVertex(const b2Vec2 &d) const
    00075 {
    00076         B2_NOT_USED(d);
    00077         return m_p;
    00078 }
    00079
    00080 inline const b2Vec2& b2CircleShape::GetVertex(int32 index) const
    00081 {
    00082         B2_NOT_USED(index);
    00083         b2Assert(index == 0);
    00084         return m_p;
    00085 }
    00086
    00087 #endif