AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
FallbackConvexCollider.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
22
23namespace 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
This template class can be instantiated to use Convex-Convex for shape pairs where no explicit collid...
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
Base class for a shape.
Definition Shape.h:54
virtual bool hasSupportFunction() const
Definition Shape.h:494
This namespace consists of a set of classes for handling geometric intersection tests including boole...
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).