blaze.collision.shapes.circle
- class
CircleDef
: blaze.collision.shapes.shape.ShapeDef;
- This is used to build circle shapes.
- class
Circle
: blaze.collision.shapes.shape.Shape;
- A circle shape.
- this(ShapeDef def);
- Constructs a circle from a shape definition
- bool
testPoint
(bXForm xf, bVec2 p);
- Test a point for containment in this shape. This only works for convex
shapes.
Params:
bXForm xf |
the shape world transform. |
bVec2 p |
a point in world coordinates. |
Returns:
true if the point lies within the shape, false otherwise.
- AABB
aabb
();
- Returns the axis aligned bounding box associated with the shape, in
reference to the parent body's transform
- void
updateAABB
();
- Update the AABB
- bVec2
worldCenter
();
- Returns:
the shape's center in world coordinates
- SegmentCollide
testSegment
(bXForm xf, ref float lambda, ref bVec2 normal, Segment segment, float maxLambda);
- Perform a ray cast against this shape. Collision Detection in Interactive
3D Environments by Gino van den Bergen From Section 3.1.2 x = s + a * r
norm(x) = radius
Params:
bXForm xf |
the shape world transform. |
float lambda |
returns the hit fraction. You can use this to compute the
contact point p = (1 - lambda) * segment.p1 + lambda * segment.p2 |
bVec2 normal |
returns the normal at the contact point. If there is no
intersection, the normal is not set. |
Segment segment |
defines the begin and end point of the ray cast. |
float maxLambda |
a number typically in the range [0,1]. |
Returns:
a SegmentCollide representing the collision between this shape
and the segment
- void
computeAABB
(ref AABB aabb, bXForm xf);
- Given a transform, compute the associated axis aligned bounding box for
this shape.
This does not modify the shape's AABB
Params:
AABB aabb |
returns the axis aligned box. |
bXForm xf |
the world transform of the shape. |
- void
computeSweptAABB
(bXForm xf1, bXForm xf2);
- Given two transforms, compute the associated swept axis aligned bounding
box for this shape. This DOES modify the shape's AABB (see bugs)
Params:
bXForm xf1 |
the world transform of the shape. |
bXForm xf2 |
the velocity of the shape |
BUGS:
Why is this different from the way Box2d does it? And why does it
behave differently from computeAABB?
- void
computeMass
(ref MassData massData);
- Compute the mass properties of this shape using its dimensions and density.
The inertia tensor is computed about the local origin, not the centroid.
Params:
MassData massData |
returns the mass data for this shape. |
- bVec2
localPosition
();
- Returns:
the local position of this circle in its parent body.
- float
radius
();
- Returns:
the
radius
of this circle.
- bVec2
support
(bXForm xf, bVec2 d);
- Returns:
The shape's
support
point (for MPR & GJK)
|