b2Shape.h
Go to the documentation of this file.
00001 /*
00002 * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
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_SHAPE_H
00020 #define B2_SHAPE_H
00021 
00022 #include <Box2D/Common/b2BlockAllocator.h>
00023 #include <Box2D/Common/b2Math.h>
00024 #include <Box2D/Collision/b2Collision.h>
00025 
00027 struct b2MassData
00028 {
00030         float32 mass;
00031 
00033         b2Vec2 center;
00034 
00036         float32 I;
00037 };
00038 
00042 class b2Shape
00043 {
00044 public:
00045         
00046         enum Type
00047         {
00048                 e_circle = 0,
00049                 e_edge = 1,
00050                 e_polygon = 2,
00051                 e_chain = 3,
00052                 e_typeCount = 4
00053         };
00054 
00055         virtual ~b2Shape() {}
00056 
00058         virtual b2Shape* Clone(b2BlockAllocator* allocator) const = 0;
00059 
00062         Type GetType() const;
00063 
00065         virtual int32 GetChildCount() const = 0;
00066 
00070         virtual bool TestPoint(const b2Transform& xf, const b2Vec2& p) const = 0;
00071 
00077         virtual bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input,
00078                                                 const b2Transform& transform, int32 childIndex) const = 0;
00079 
00084         virtual void ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 childIndex) const = 0;
00085 
00090         virtual void ComputeMass(b2MassData* massData, float32 density) const = 0;
00091 
00092         Type m_type;
00093         float32 m_radius;
00094 };
00095 
00096 inline b2Shape::Type b2Shape::GetType() const
00097 {
00098         return m_type;
00099 }
00100 
00101 #endif


mvsim
Author(s):
autogenerated on Thu Sep 7 2017 09:27:48