File mechanics/src/collision/SiconosCollisionManager.hpp

Go to the source code of this file

A mechanics world is a Siconos InteractionManager that supports static contactors and dynamic contactors attached to special Dynamical Systems (BodyDS, derived from NewtonEulerDS) found in the NonSmoothDynamicalSystem.

class SiconosCollisionManager : public InteractionManager

Public Types

typedef void *StaticContactorSetID

An opaque handle can be used to refer to a specific static contactor set previously added to the collision manager.

Public Functions

SiconosCollisionManager()
virtual ~SiconosCollisionManager()
virtual std::vector<SP::SiconosCollisionQueryResult> inBoxQuery(const SiconosVector &center, const SiconosVector &dimensions, bool closestOnly = false, bool sorted = true)

Find all shapes that are within a box defined by a center point and a dimensions (3-vector), and return them in an ordered list based on distance to the center.

Return
A vector of SiconosCollisionQueryResult that contain information about the query results.
Parameters
  • center: The center of the box in inertial frame (world) coordinates.
  • dimensions: The dimensions of the box (3-vector).
  • closestOnly: If true, indicates only interested in first result closest to half-space boundary, max size of returned vector = 1.
  • sorted: If true, results are sorted by distance.

virtual std::vector<SP::SiconosCollisionQueryResult> inHalfSpaceQuery(const SiconosVector &point, const SiconosVector &normal, bool closestOnly = false, bool sorted = true)

Find all shapes that are inside a half-space, defined by a point and a normal direction.

Return
A vector of SiconosCollisionQueryResult that contain information about the query results.
Parameters
  • point: The point defining the boundary of the half-space.
  • normal: The normal pointing away from the surface of the half-space.
  • closestOnly: If true, indicates only interested in first result closest to half-space boundary, max size of returned vector = 1.
  • sorted: If true, results are sorted by distance.

virtual StaticContactorSetID insertStaticContactorSet(SP::SiconosContactorSet cs, SP::SiconosVector position = SP::SiconosVector())

Insert a static contactor set.

virtual std::vector<SP::SiconosCollisionQueryResult> inSphereQuery(const SiconosVector &center, double radius, bool closestOnly = false, bool sorted = true)

Find all shapes that are within a sphere defined by a point and a radius and return them in an ordered list based on distance to the center.

Return
A vector of SiconosCollisionQueryResult that contain information about the query results.
Parameters
  • center: The center of the sphere in inertial frame (world) coordinates.
  • radius: The radius of the sphere.
  • closestOnly: If true, indicates only interested in first result closest to half-space boundary, max size of returned vector = 1.
  • sorted: If true, results are sorted by distance.

virtual std::vector<SP::SiconosCollisionQueryResult> lineIntersectionQuery(const SiconosVector &start, const SiconosVector &end, bool closestOnly = false, bool sorted = true)

Perform an intersection test on all shapes in the contactors and return a vector of all results, ordered by distance from start.

Return
A vector of SiconosCollisionQueryResult that contain information about the query results.
Parameters
  • start: The starting point of the line segment in inertial frame (world) coordinates.
  • end: The ending point of the line segment in inertial frame (world) coordinates.
  • closestOnly: If true, indicates only interested in first result closest to half-space boundary, max size of returned vector = 1.
  • sorted: If true, results are sorted by distance.

virtual void removeBody(const SP::BodyDS &body)

Remove a body from the collision detector.

This must be done after removing a body from the NonSmoothDynamicalSystem otherwise contact will occur with a non-graph body which results in failure.

virtual bool removeStaticContactorSet(StaticContactorSetID id)

Remove a static contactor set.

Parameters
  • id: An identifier returned by insertStaticContactorSet.

Protected Functions

ACCEPT_SERIALIZATION(SiconosCollisionManager)

serialization hooks