|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Stateful query helper for collision primitives against a fixed world plane. More...
#include <plane_collision_query.h>
Classes | |
| struct | Result |
| Collision information for one primitive selected by the current query state. More... | |
Public Member Functions | |
| PlaneCollisionQueryT (const CollisionGeometry &cg, const Vector3< T > &planeNormal, T planeOffset) | |
| Construct a query over explicit collision geometry. | |
| PlaneCollisionQueryT (const Character &character, const Vector3< T > &planeNormal, T planeOffset) | |
| Construct a query over a character's collision geometry and initialize it at the zero pose. | |
| void | setPlane (const Vector3< T > &planeNormal, T planeOffset) |
Set the collision plane after normalizing planeNormal and the matching offset. | |
| const Vector3< T > & | getPlaneNormal () const |
| Return the normalized plane normal used by collision and contact queries. | |
| T | getPlaneOffset () const |
| Return the plane offset after normalization by setPlane(). | |
| size_t | primitiveCount () const |
| Number of character-attached collision primitives owned by this query. | |
| size_t | candidatePrimitiveCount () const |
| Number of primitives retained by the most recent broad-phase update. | |
| void | update (const SkeletonStateT< T > &state, T contactMargin) |
| Update candidate primitive state for a skeleton state and signed plane-distance margin. | |
| void | update (std::span< const JointStateT< T > > states, T contactMargin) |
| Update candidate primitive state for explicit joint states and signed plane-distance margin. | |
| void | updateActiveParentCollisions () |
| Select the deepest active collision under each parent joint from current candidates. | |
| const std::vector< Result > & | activeParentCollisions () const |
| Return the current deepest active collisions, one per parent joint. | |
| std::vector< size_t > | getCollidingPrimitives () const |
| Return collision primitive indices that penetrate the plane in the current query state. | |
| std::vector< PlaneCollisionDebugEntryT< T > > | getCollisionDebugInfo () const |
| Query detailed collision state for all currently-colliding primitives. | |
| std::vector< Vector3< T > > | getContactPoints (std::span< const JointStateT< T > > states, T contactMargin) |
| Return world-space primitive surface points at or near the plane for explicit joint states. | |
| std::vector< Vector3< T > > | getContactPointsByParent (std::span< const JointStateT< T > > states, T contactMargin) |
| Return one world-space primitive surface point per parent joint at or near the plane. | |
| std::vector< PlaneCollisionContactPointT< T > > | getContactPointsByParentWithDetails (std::span< const JointStateT< T > > states, T contactMargin) |
| Return one detailed world-space primitive surface point per parent joint at or near the plane. | |
Stateful query helper for collision primitives against a fixed world plane.
The plane is represented by planeNormal.dot(x) - planeOffset = 0; the non-penetrating side is planeNormal.dot(x) >= planeOffset. Capsules, ellipsoids, and boxes use the same collision geometry state and support-radius convention as CollisionErrorFunctionT.
Definition at line 54 of file plane_collision_query.h.
|
explicit |
Construct a query over explicit collision geometry.
The primitive list is initialized immediately, but candidate and active collision state remain empty until update() is called for a skeleton state. Contact-point helpers that take explicit joint states update that state internally for the duration of the query.
Definition at line 36 of file plane_collision_query.cpp.
References setPlane().
Referenced by PlaneCollisionQueryT().
|
explicit |
Construct a query over a character's collision geometry and initialize it at the zero pose.
Definition at line 46 of file plane_collision_query.cpp.
References momentum::cast(), momentum::Character::parameterTransform, PlaneCollisionQueryT(), momentum::Character::skeleton, update(), and momentum::ParameterTransformT< T >::zero().
|
inlinenodiscard |
Return the current deepest active collisions, one per parent joint.
Definition at line 124 of file plane_collision_query.h.
|
inlinenodiscard |
Number of primitives retained by the most recent broad-phase update.
Definition at line 110 of file plane_collision_query.h.
|
nodiscard |
Return collision primitive indices that penetrate the plane in the current query state.
Definition at line 260 of file plane_collision_query.cpp.
|
nodiscard |
Query detailed collision state for all currently-colliding primitives.
Definition at line 272 of file plane_collision_query.cpp.
References momentum::PlaneCollisionQueryT< T >::Result::overlap, momentum::PlaneCollisionQueryT< T >::Result::parentJoint, momentum::PlaneCollisionQueryT< T >::Result::position, momentum::PlaneCollisionQueryT< T >::Result::primitiveIndex, momentum::PlaneCollisionQueryT< T >::Result::radius, and momentum::PlaneCollisionQueryT< T >::Result::signedDistance.
|
nodiscard |
Return world-space primitive surface points at or near the plane for explicit joint states.
A primitive contributes when its signed surface distance to the plane is <= contactMargin. The returned point is on the primitive surface, deepest toward the plane.
Definition at line 290 of file plane_collision_query.cpp.
References momentum::PlaneCollisionQueryT< T >::Result::position, momentum::PlaneCollisionQueryT< T >::Result::surfaceDistance(), and update().
|
nodiscard |
Return one world-space primitive surface point per parent joint at or near the plane.
A primitive contributes when its signed surface distance to the plane is <= contactMargin. When multiple primitives under the same parent joint contribute, the returned point is the deepest one toward the plane.
Definition at line 307 of file plane_collision_query.cpp.
References getContactPointsByParentWithDetails().
|
nodiscard |
Return one detailed world-space primitive surface point per parent joint at or near the plane.
A primitive contributes when its signed surface distance to the plane is <= contactMargin. When multiple primitives under the same parent joint contribute, the returned point is the deepest one toward the plane.
Definition at line 322 of file plane_collision_query.cpp.
References momentum::kInvalidIndex, momentum::PlaneCollisionQueryT< T >::Result::parentJoint, momentum::PlaneCollisionQueryT< T >::Result::position, momentum::PlaneCollisionQueryT< T >::Result::surfaceDistance(), and update().
Referenced by momentum::computePlaneCollisionSupportContacts(), and getContactPointsByParent().
|
inlinenodiscard |
Return the normalized plane normal used by collision and contact queries.
Definition at line 95 of file plane_collision_query.h.
|
inlinenodiscard |
Return the plane offset after normalization by setPlane().
Definition at line 100 of file plane_collision_query.h.
|
inlinenodiscard |
Number of character-attached collision primitives owned by this query.
Definition at line 105 of file plane_collision_query.h.
| void momentum::PlaneCollisionQueryT< T >::setPlane | ( | const Vector3< T > & | planeNormal, |
| T | planeOffset ) |
Set the collision plane after normalizing planeNormal and the matching offset.
planeOffset must use the same scale as planeNormal. Equivalent plane equations such as 2 * normal.dot(x) - 2 * offset = 0 are stored in one canonical form, so getPlaneOffset() returns the offset divided by the input normal length.
Definition at line 57 of file plane_collision_query.cpp.
References momentum::Eps(), and MT_CHECK.
Referenced by PlaneCollisionQueryT().
| void momentum::PlaneCollisionQueryT< T >::update | ( | const SkeletonStateT< T > & | state, |
| T | contactMargin ) |
Update candidate primitive state for a skeleton state and signed plane-distance margin.
Definition at line 143 of file plane_collision_query.cpp.
References MT_PROFILE_EVENT.
Referenced by getContactPoints(), getContactPointsByParentWithDetails(), PlaneCollisionQueryT(), and update().
| void momentum::PlaneCollisionQueryT< T >::update | ( | std::span< const JointStateT< T > > | states, |
| T | contactMargin ) |
Update candidate primitive state for explicit joint states and signed plane-distance margin.
Definition at line 162 of file plane_collision_query.cpp.
References momentum::SkeletonStateT< T >::jointState, and update().
| void momentum::PlaneCollisionQueryT< T >::updateActiveParentCollisions | ( | ) |
Select the deepest active collision under each parent joint from current candidates.
Definition at line 235 of file plane_collision_query.cpp.
References momentum::PlaneCollisionQueryT< T >::Result::overlap, and momentum::PlaneCollisionQueryT< T >::Result::parentJoint.