#include <AABB.h>
|
| | AABB ()=default |
| |
| | AABB (const glm::vec3 ¢er, const glm::vec3 &halfExtents) |
| |
| std::unique_ptr< ICollider > | getTransformed (const glm::mat4 &modelMatrix) const override |
| | Creates a transformed copy of this collider in world space.
|
| |
| bool | intersectsAABB (const AABB &other) const |
| |
| std::optional< float > | intersectRay (const Math::Ray &ray) const override |
| | Tests ray-collider intersection.
|
| |
| bool | contains (const glm::vec3 &p) const override |
| | Tests if a point is inside the collider volume.
|
| |
| ContactInfo | closestPoint (const glm::vec3 &p) const override |
| | Finds the closest point on the collider surface to a given point.
|
| |
| void | expand (const glm::vec3 &point) |
| |
| void | expand (const AABB &other) |
| |
| glm::vec3 | getAABBMin () const override |
| | Gets the minimum, maximum corner of the axis-aligned bounding box (AABB) that contains this collider.
|
| |
| glm::vec3 | getAABBMax () const override |
| |
| glm::vec3 | getCenter () const |
| |
| virtual | ~ICollider ()=default |
| | Virtual destructor for proper cleanup of derived classes.
|
| |
Definition at line 6 of file AABB.h.
◆ AABB() [1/2]
| Physics::Bounding::AABB::AABB |
( |
| ) |
|
|
default |
◆ AABB() [2/2]
| Physics::Bounding::AABB::AABB |
( |
const glm::vec3 & |
center, |
|
|
const glm::vec3 & |
halfExtents |
|
) |
| |
◆ closestPoint()
Finds the closest point on the collider surface to a given point.
- Parameters
-
| p | Query point in the same space as the collider |
- Returns
- ContactInfo containing closest point, normal, and penetration depth
- Note
- If p is inside the collider, penetration will be positive
-
The normal always points away from the collider surface
- Use Cases
- Collision resolution (finding separation vector)
- Distance queries
- Computing contact manifolds
- See also
- ContactInfo
Implements Physics::Bounding::ICollider.
Definition at line 56 of file AABB.cpp.
◆ contains()
| bool Physics::Bounding::AABB::contains |
( |
const glm::vec3 & |
p | ) |
const |
|
overridevirtual |
Tests if a point is inside the collider volume.
- Parameters
-
| p | Point to test, in the same coordinate space as this collider |
- Returns
true if point is inside or on the surface, false otherwise
- Note
- For box colliders, "inside" includes the surface (closed volume)
-
This test is typically performed in world space after transformation
Implements Physics::Bounding::ICollider.
Definition at line 50 of file AABB.cpp.
◆ expand() [1/2]
| void Physics::Bounding::AABB::expand |
( |
const AABB & |
other | ) |
|
◆ expand() [2/2]
| void Physics::Bounding::AABB::expand |
( |
const glm::vec3 & |
point | ) |
|
◆ getAABBMax()
| glm::vec3 Physics::Bounding::AABB::getAABBMax |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ getAABBMin()
| glm::vec3 Physics::Bounding::AABB::getAABBMin |
( |
| ) |
const |
|
inlineoverridevirtual |
Gets the minimum, maximum corner of the axis-aligned bounding box (AABB) that contains this collider.
- Returns
- Minimum or Maximum corner of AABB in local space
- Note
- This is used for broad-phase collision detection and spatial partitioning
-
For simple colliders like AABB, this is just the min,max corner. For others, it may require computation.
Implements Physics::Bounding::ICollider.
Definition at line 21 of file AABB.h.
◆ getCenter()
| glm::vec3 Physics::Bounding::AABB::getCenter |
( |
| ) |
const |
|
inline |
◆ getTransformed()
Creates a transformed copy of this collider in world space.
Applies a 4x4 transformation matrix to create a new collider instance representing this shape in world coordinates. This is used to transform local-space colliders to world space for collision testing.
- Parameters
-
| modelMatrix | Transformation matrix (typically from SceneObject) Encodes translation, rotation, and scale |
- Returns
- Unique pointer to transformed collider (ownership transferred)
- Note
- The transformation extracts:
- Translation: modelMatrix[3].xyz
- Rotation: Extracted via glm::decompose
- Scale: Applied to half-extents/radius
-
Caller receives ownership via std::unique_ptr
-
Returns nullptr only if transformation fails (rare)
Implements Physics::Bounding::ICollider.
Definition at line 11 of file AABB.cpp.
◆ intersectRay()
| std::optional< float > Physics::Bounding::AABB::intersectRay |
( |
const Math::Ray & |
ray | ) |
const |
|
overridevirtual |
Tests ray-collider intersection.
- Parameters
-
| ray | The ray to test against this collider |
- Returns
- Distance along ray if intersection occurs,
std::nullopt otherwise
- Note
- Negative distances may be rejected depending on implementation
- See also
- Ray
Implements Physics::Bounding::ICollider.
Definition at line 34 of file AABB.cpp.
◆ intersectsAABB()
| bool Physics::Bounding::AABB::intersectsAABB |
( |
const AABB & |
other | ) |
const |
The documentation for this class was generated from the following files: