134 inline bool isValid()
const
145 GeometryFrameTable m_geometryFrameTable;
149 %
template(OrientedBoxFrictionModelImpl) OrientedFrictionModelImpl<agx::BoxFrictionModel>;
150 %
template(OrientedScaleBoxFrictionModelImpl) OrientedFrictionModelImpl<agx::ScaleBoxFrictionModel>;
151 %
template(OrientedIterativeProjectedConeFrictionModelImpl) OrientedFrictionModelImpl<agx::IterativeProjectedConeFriction>;
302 const size_t numPoints )
const override;
314 SCALE_WITH_DEPTH = 1 << 0
316 using Flags = agx::BitState<Flag, agx::UInt16>;
327 : T( solveType ), m_refFrame( refFrame ), m_primaryDirection( primaryDirection )
345 m_refFrame = refFrame;
351 return m_primaryDirection;
357 m_primaryDirection = primaryDirection;
363 auto pruneIt = m_geometryFrameTable.begin();
364 while ( pruneIt != m_geometryFrameTable.end() ) {
365 if ( !pruneIt->second.isValid() )
366 pruneIt = m_geometryFrameTable.erase( pruneIt );
371 if ( geometry ==
nullptr )
374 auto it = m_geometryFrameTable.find( geometry );
376 if ( it == m_geometryFrameTable.end() && frame !=
nullptr )
377 it = m_geometryFrameTable.insert( geometry, { geometry, frame } );
379 else if ( it != m_geometryFrameTable.end() && frame ==
nullptr )
380 m_geometryFrameTable.erase( it );
382 else if ( it != m_geometryFrameTable.end() && frame != it->second.frame )
383 it->second.frame = frame;
393 setFrame( geometry, frame );
399 if (
const auto data = m_geometryFrameTable.try_get( geometry ) )
407 const auto frameTableIt = geometry !=
nullptr && !m_geometryFrameTable.empty() ?
408 m_geometryFrameTable.find( geometry ) :
409 m_geometryFrameTable.end();
410 return frameTableIt == m_geometryFrameTable.end() ?
412 frameTableIt->second.frame.get();
424 const auto f1 = getFrameOrReference( geometry1 );
425 const auto f2 = getFrameOrReference( geometry2 );
428 const auto f = f1 != m_refFrame ? f1 : f2;
429 agxAssert( f !=
nullptr || m_refFrame ==
nullptr );
432 f->transformVectorToWorld( m_primaryDirection ) :
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
The geometry representation used by the collision detection engine.
Oriented box friction model that uses the same normal force magnitude for all contact points associat...
virtual ~ConstantNormalForceOrientedBoxFrictionModel()
void setEnableScaleWithDepth(agx::Bool enable)
Enable/disable scale of the given normal force with the contact point depth resulting in a maximum fr...
virtual agx::Real calculateNormalForce(const agxCollide::Geometry *geometry1, const agxCollide::Geometry *geometry2, const agx::Vec3 &point, const agx::Vec3 &normal, const agx::Real depth, const agx::Real dt, const size_t numPoints) const override
agx::Real getNormalForceMagnitude() const
void setNormalForceMagnitude(agx::Real normalForceMagnitude)
Assign normal force magnitude.
ConstantNormalForceOrientedBoxFrictionModel(agx::Real normalForceMagnitude, const agx::Frame *refFrame, const agx::Vec3 &primaryDirection, agx::FrictionModel::SolveType solveType=agx::FrictionModel::SPLIT, agx::Bool scaleWithDepth=false)
Construct given normal force magnitude, reference frame and primary direction.
ConstantNormalForceOrientedBoxFrictionModel()
agx::Bool getEnableScaleWithDepth() const
The object defining a frame of reference and providing transformations operations.
@ SPLIT
First Normal equation is calculated in the DIRECT solver, then in a second pass the normal and the fr...
static void calculateTangentPlane(const Vec3 &primaryDirectionWorld, const Vec3 &normal, Vec3 &ret_u, Vec3 &ret_v)
Calculates friction tangents directions given primaryDirectionWorld and contact normal.
Inheritance with partial specialization due to bug with ref_ptr containers.
Box friction model with oriented friction box.
OrientedBoxFrictionModel(const agx::Frame *refFrame, const agx::Vec3 &primaryDirection, agx::FrictionModel::SolveType solveType=agx::FrictionModel::SPLIT)
Construct given frame of reference and primary friction direction.
virtual ~OrientedBoxFrictionModel()
OrientedBoxFrictionModel()
Oriented friction box base implementation containing a frame of reference and the primary direction g...
void setFrame(const agx::RigidBody *rb, const agx::Frame *frame)
Utility method to assign all current geometries of rb the explicit oriented frame frame.
virtual ~OrientedFrictionModelImpl()
OrientedFrictionModelImpl(const agx::Frame *refFrame, const agx::Vec3 &primaryDirection, agx::FrictionModel::SolveType solveType)
Construct given frame of reference and primary friction direction.
void setPrimaryDirection(const agx::Vec3 &primaryDirection)
Assign primary friction direction given in reference frame.
const agx::Frame * getFrameOrReference(const agxCollide::Geometry *geometry) const
Explicit oriented frame for geometry or reference frame of this model if not assigned.
const agx::Frame * getReferenceFrame() const
void setReferenceFrame(const agx::Frame *refFrame)
Assign frame of reference.
void setFrame(const agxCollide::Geometry *geometry, const agx::Frame *frame)
Assign reference frame override for the given geometry.
const agx::Vec3 & getPrimaryDirection() const
virtual void calculateTangentPlane(const agxCollide::Geometry *geometry1, const agxCollide::Geometry *geometry2, const agx::Vec3 &point, const agx::Vec3 &normal, const agx::Real depth, agx::Vec3 &ret_u, agx::Vec3 &ret_v) const
Calculates primary and secondary friction directions in world coordinates given contact point.
const agx::Frame * getFrame(const agxCollide::Geometry *geometry) const
Explicit oriented frame for geometry or nullptr if not assigned.
Iterative projected cone friction model with oriented friction box.
OrientedIterativeProjectedConeFrictionModel()
OrientedIterativeProjectedConeFrictionModel(const agx::Frame *refFrame, const agx::Vec3 &primaryDirection, agx::FrictionModel::SolveType solveType=agx::FrictionModel::SPLIT)
Construct given frame of reference and primary friction direction.
virtual ~OrientedIterativeProjectedConeFrictionModel()
Scale box friction model with oriented friction box.
OrientedScaleBoxFrictionModel(const agx::Frame *refFrame, const agx::Vec3 &primaryDirection, agx::FrictionModel::SolveType solveType=agx::FrictionModel::SPLIT)
Construct given frame of reference and primary friction direction.
virtual ~OrientedScaleBoxFrictionModel()
OrientedScaleBoxFrictionModel()
The rigid body class, combining a geometric model and a frame of reference.
const agxCollide::GeometryRefVector & getGeometries() const
The agx namespace contains the dynamics/math part of the AGX Dynamics API.