63 float c =
b2Dot(s, r);
64 float rr =
b2Dot(r, r);
65 float sigma = c * c - rr * b;
74 float a = -(c +
b2Sqrt(sigma));
81 output->
normal = s + a * r;
104 massData->
I = massData->
mass * (0.5f * m_radius * m_radius +
b2Dot(
m_p,
m_p));
float mass
The mass of the shape, usually in kilograms.
b2Vec2 b2Mul(const b2Mat22 &A, const b2Vec2 &v)
void ComputeMass(b2MassData *massData, float density) const override
int32 GetChildCount() const override
float b2Dot(const b2Vec2 &a, const b2Vec2 &b)
Perform the dot product on two vectors.
b2Vec2 lowerBound
the lower vertex
bool TestPoint(const b2Transform &transform, const b2Vec2 &p) const override
Implement b2Shape.
bool RayCast(b2RayCastOutput *output, const b2RayCastInput &input, const b2Transform &transform, int32 childIndex) const override
b2Vec2 center
The position of the shape's centroid relative to the shape's origin.
void * Allocate(int32 size)
Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize.
void Set(float x_, float y_)
Set this vector to some specified coordinates.
float I
The rotational inertia of the shape about the local origin.
void ComputeAABB(b2AABB *aabb, const b2Transform &transform, int32 childIndex) const override
An axis aligned bounding box.
float Normalize()
Convert this vector into a unit vector. Returns the length.
b2Shape * Clone(b2BlockAllocator *allocator) const override
Implement b2Shape.
This holds the mass data computed for a shape.
b2Vec2 upperBound
the upper vertex