Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
momentum::SDFColliderT< S > Struct Template Reference

SDF collision geometry for character collision detection. More...

#include <sdf_collision_geometry.h>

Public Types

using Scalar = S
using SDFType = axel::SignedDistanceField<S>

Public Member Functions

 SDFColliderT ()
 SDFColliderT (const TransformT< S > &transform, size_t parentJoint, std::shared_ptr< const SDFType > sdfPtr)
bool isApprox (const SDFColliderT &other, const S &tol=Eps< S >(1e-4f, 1e-10)) const
 Checks if the current SDF collider is approximately equal to another.
bool isValid () const
 Returns true when the collider holds a non-null SDF and is therefore usable for collision queries.
Duck-typed collider interface

These methods adapt SDFColliderT to the generic collider interface used by SDFCollisionErrorFunctionT, enabling it to be used interchangeably with other collider types (e.g., learned SDF runtimes).

template<typename T>
T evaluate (const Eigen::Vector3< T > &localPos) const
 Evaluate the SDF distance at a local-frame position.
template<typename T>
std::pair< T, Eigen::Vector3< T > > evaluateWithGradient (const Eigen::Vector3< T > &localPos) const
 Evaluate the SDF distance and gradient at a local-frame position.
axel::BoundingBox< S > bounds () const
 Bounding box of the SDF in local frame.
size_t parentJoint () const
 Parent joint index in the skeleton.
TransformT< S > localToParentTransform () const
 Transform from SDF local frame to parent joint frame.
template<typename T>
void update (const Eigen::VectorX< T > &)
 Per-iteration update (no-op for voxel SDFs).

Public Attributes

TransformT< S > transformation
 Transformation defining the orientation and position relative to the parent coordinate system.
size_t parent = kInvalidIndex
 Parent joint to which the geometry is attached.
std::shared_ptr< const SDFType > sdf
 Shared pointer to the SignedDistanceField data.

Detailed Description

template<typename S>
struct momentum::SDFColliderT< S >

SDF collision geometry for character collision detection.

Defined by a transformation, parent joint, and a shared pointer to a SignedDistanceField.

Definition at line 28 of file sdf_collision_geometry.h.

Member Typedef Documentation

◆ Scalar

template<typename S>
using momentum::SDFColliderT< S >::Scalar = S

Definition at line 29 of file sdf_collision_geometry.h.

◆ SDFType

template<typename S>
using momentum::SDFColliderT< S >::SDFType = axel::SignedDistanceField<S>

Definition at line 30 of file sdf_collision_geometry.h.

Constructor & Destructor Documentation

◆ SDFColliderT() [1/2]

template<typename S>
momentum::SDFColliderT< S >::SDFColliderT ( )
inline

Definition at line 44 of file sdf_collision_geometry.h.

◆ SDFColliderT() [2/2]

template<typename S>
momentum::SDFColliderT< S >::SDFColliderT ( const TransformT< S > & transform,
size_t parentJoint,
std::shared_ptr< const SDFType > sdfPtr )
inline

Definition at line 46 of file sdf_collision_geometry.h.

Member Function Documentation

◆ bounds()

template<typename S>
axel::BoundingBox< S > momentum::SDFColliderT< S >::bounds ( ) const
inlinenodiscard

Bounding box of the SDF in local frame.

Definition at line 102 of file sdf_collision_geometry.h.

◆ evaluate()

template<typename S>
template<typename T>
T momentum::SDFColliderT< S >::evaluate ( const Eigen::Vector3< T > & localPos) const
inlinenodiscard

Evaluate the SDF distance at a local-frame position.

Definition at line 89 of file sdf_collision_geometry.h.

◆ evaluateWithGradient()

template<typename S>
template<typename T>
std::pair< T, Eigen::Vector3< T > > momentum::SDFColliderT< S >::evaluateWithGradient ( const Eigen::Vector3< T > & localPos) const
inlinenodiscard

Evaluate the SDF distance and gradient at a local-frame position.

Definition at line 95 of file sdf_collision_geometry.h.

◆ isApprox()

template<typename S>
bool momentum::SDFColliderT< S >::isApprox ( const SDFColliderT< S > & other,
const S & tol = Eps<S>(1e-4f, 1e-10) ) const
inlinenodiscard

Checks if the current SDF collider is approximately equal to another.

SDF data is compared by pointer identity, not by value: two colliders sharing the same SignedDistanceField instance are considered equal, but two colliders pointing to distinct instances with identical contents are not.

Definition at line 57 of file sdf_collision_geometry.h.

◆ isValid()

template<typename S>
bool momentum::SDFColliderT< S >::isValid ( ) const
inlinenodiscard

Returns true when the collider holds a non-null SDF and is therefore usable for collision queries.

Definition at line 76 of file sdf_collision_geometry.h.

◆ localToParentTransform()

template<typename S>
TransformT< S > momentum::SDFColliderT< S >::localToParentTransform ( ) const
inlinenodiscard

Transform from SDF local frame to parent joint frame.

Definition at line 112 of file sdf_collision_geometry.h.

◆ parentJoint()

template<typename S>
size_t momentum::SDFColliderT< S >::parentJoint ( ) const
inlinenodiscard

Parent joint index in the skeleton.

Definition at line 107 of file sdf_collision_geometry.h.

◆ update()

template<typename S>
template<typename T>
void momentum::SDFColliderT< S >::update ( const Eigen::VectorX< T > & )
inline

Per-iteration update (no-op for voxel SDFs).

Definition at line 118 of file sdf_collision_geometry.h.

Member Data Documentation

◆ parent

template<typename S>
size_t momentum::SDFColliderT< S >::parent = kInvalidIndex

Parent joint to which the geometry is attached.

Use kInvalidIndex to indicate it is fixed in world space.

Definition at line 38 of file sdf_collision_geometry.h.

Referenced by momentum::SDFColliderT< float >::isApprox().

◆ sdf

template<typename S>
std::shared_ptr<const SDFType> momentum::SDFColliderT< S >::sdf

Shared pointer to the SignedDistanceField data.

Uses shared_ptr to avoid expensive copies of potentially large SDF volumes.

Definition at line 42 of file sdf_collision_geometry.h.

Referenced by momentum::SDFColliderT< float >::isApprox().

◆ transformation

template<typename S>
TransformT<S> momentum::SDFColliderT< S >::transformation

Transformation defining the orientation and position relative to the parent coordinate system.

Definition at line 34 of file sdf_collision_geometry.h.

Referenced by momentum::SDFColliderT< float >::isApprox().


The documentation for this struct was generated from the following files: