AGX Dynamics  2.37.2.0
FallbackConvexCollider.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
21 #include <agxCollide/ConvexUtils.h>
22 
23 namespace agxCollide
24 {
25 
34  template <agx::UInt8 ShapeType1, agx::UInt8 ShapeType2>
35  class FallbackConvexCollider : public ShapeCollider
36  {
37  public:
38  FallbackConvexCollider() : ShapeCollider(ShapeType1, ShapeType2) {}
40 
41  virtual void _calculateContacts(
42  agx::Physics::Geometry::ShapeInstance shape1, agx::Physics::Geometry::ShapeInstance shape2,
43  const agx::AffineMatrix4x4& transform1, const agx::AffineMatrix4x4& transform2,
44  const agx::Vec3& /*linearVelocity1*/, const agx::Vec3& /*linearVelocity2*/,
45  const agx::Vec3& /*angularVelocity1*/, const agx::Vec3& /*angularVelocity2*/,
46  bool /*earlyOut*/, LocalContactPointVector& result) override
47  {
48  const Shape* shape1ptr = shape1.model();
49  const Shape* shape2ptr = shape2.model();
50 
51  if ( !shape1ptr->hasSupportFunction() || !shape2ptr->hasSupportFunction() )
52  return;
53 
54  collideConvexConvex(shape1ptr, shape2ptr, transform1, transform2, result);
55  }
56 
57  };
58 
59 }
60 
61 
Base class for a shape.
Definition: Shape.h:53
This namespace consists of a set of classes for handling geometric intersection tests including boole...
virtual void _calculateContacts(agx::Physics::Geometry::ShapeInstance shape1, agx::Physics::Geometry::ShapeInstance shape2, const agx::AffineMatrix4x4 &transform1, const agx::AffineMatrix4x4 &transform2, const agx::Vec3 &, const agx::Vec3 &, const agx::Vec3 &, const agx::Vec3 &, bool, LocalContactPointVector &result) override
virtual bool hasSupportFunction() const
Definition: Shape.h:494
AGXPHYSICS_EXPORT void collideConvexConvex(const Shape *convexShape1, const Shape *convexShape2, const agx::AffineMatrix4x4 &transform1, const agx::AffineMatrix4x4 &transform2, ShapeCollider::LocalContactPointVector &result, const agx::Real epaAccuracy=agx::AGX_EQUIVALENT_EPSILON)
Collides two convex shapes (Box, Capsule, Convex, Cylinder, Sphere).
This template class can be instantiated to use Convex-Convex for shape pairs where no explicit collid...