52 for (
int32 i = 1; i < count; ++i)
72 for (
int32 i = 1; i < count; ++i)
143 int32 i1 = childIndex;
144 int32 i2 = childIndex + 1;
153 return edgeShape.
RayCast(output, input, xf, 0);
160 int32 i1 = childIndex;
161 int32 i2 = childIndex + 1;
182 massData->
mass = 0.0f;
float mass
The mass of the shape, usually in kilograms.
void * b2Alloc(int32 size)
Implement this function to use your own memory allocator.
b2Shape * Clone(b2BlockAllocator *allocator) const override
Implement b2Shape. Vertices are cloned using b2Alloc.
b2Vec2 * m_vertices
The vertices. Owned by this class.
b2Vec2 b2Mul(const b2Mat22 &A, const b2Vec2 &v)
b2Vec2 lowerBound
the lower vertex
void ComputeAABB(b2AABB *aabb, const b2Transform &transform, int32 childIndex) const override
bool TestPoint(const b2Transform &transform, const b2Vec2 &p) const override
b2Vec2 m_vertex0
Optional adjacent vertices. These are used for smooth collision.
~b2ChainShape()
The destructor frees the vertices using b2Free.
b2Vec2 center
The position of the shape's centroid relative to the shape's origin.
void SetZero()
Set this vector to all zeros.
int32 GetChildCount() const override
float b2DistanceSquared(const b2Vec2 &a, const b2Vec2 &b)
bool RayCast(b2RayCastOutput *output, const b2RayCastInput &input, const b2Transform &transform, int32 childIndex) const override
Implement b2Shape.
bool RayCast(b2RayCastOutput *output, const b2RayCastInput &input, const b2Transform &transform, int32 childIndex) const override
Implement b2Shape.
void * Allocate(int32 size)
Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize.
void CreateChain(const b2Vec2 *vertices, int32 count, const b2Vec2 &prevVertex, const b2Vec2 &nextVertex)
void Clear()
Clear all data.
void CreateLoop(const b2Vec2 *vertices, int32 count)
void GetChildEdge(b2EdgeShape *edge, int32 index) const
Get a child edge.
float I
The rotational inertia of the shape about the local origin.
An axis aligned bounding box.
void b2Free(void *mem)
If you implement b2Alloc, you should also implement this function.
b2Vec2 m_vertex1
These are the edge vertices.
void ComputeMass(b2MassData *massData, float density) const override
bool m_oneSided
Uses m_vertex0 and m_vertex3 to create smooth collision.
int32 m_count
The vertex count.
This holds the mass data computed for a shape.
b2Vec2 upperBound
the upper vertex