All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OctreeDcdContact.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_COLLISION_OCTREEDCDCONTACT_H
17 #define SURGSIM_COLLISION_OCTREEDCDCONTACT_H
18 
19 #include <memory>
20 
23 
24 namespace SurgSim
25 {
26 namespace Collision
27 {
28 
29 class CollisionPair;
30 class ShapeCollisionRepresentation;
31 
34 {
35 public:
36 
39  explicit OctreeDcdContact(std::shared_ptr<ContactCalculation> calculator);
40 
43  virtual std::pair<int, int> getShapeTypes() override;
44 
45 private:
48  virtual void doCalculateContact(std::shared_ptr<CollisionPair> pair) override;
49 
58  void calculateContactWithNode(std::shared_ptr<const SurgSim::Math::OctreeShape::NodeType> node,
59  std::shared_ptr<CollisionPair> pair,
60  std::shared_ptr<SurgSim::DataStructures::OctreePath> nodePath);
61 
63  const std::shared_ptr<ContactCalculation> m_calculator;
64 
66  std::pair<int, int> m_shapeTypes;
67 
69  std::shared_ptr<ShapeCollisionRepresentation> m_nodeCollisionRepresentation;
70 };
71 
72 };
73 };
74 
75 
76 
77 #endif // SURGSIM_COLLISION_OCTREEDCDCONTACT_H
void calculateContactWithNode(std::shared_ptr< const SurgSim::Math::OctreeShape::NodeType > node, std::shared_ptr< CollisionPair > pair, std::shared_ptr< SurgSim::DataStructures::OctreePath > nodePath)
Calculate the collision between a specific octree node and a shape This function will check for conta...
Definition: OctreeDcdContact.cpp:54
const std::shared_ptr< ContactCalculation > m_calculator
The contact calculator to use on each octree node.
Definition: OctreeDcdContact.h:63
Base class responsible for calculating contact data between two given shapes, calculateContact needs ...
Definition: ContactCalculation.h:35
virtual std::pair< int, int > getShapeTypes() override
Function that returns the shapes between which this class performs collision detection.
Definition: OctreeDcdContact.cpp:42
virtual void doCalculateContact(std::shared_ptr< CollisionPair > pair) override
Calculate the actual contact between two shapes of the given CollisionPair.
Definition: OctreeDcdContact.cpp:47
Class to calculate intersections between an Octree and other shapes.
Definition: OctreeDcdContact.h:33
std::shared_ptr< ShapeCollisionRepresentation > m_nodeCollisionRepresentation
Collision Representation used to detect contacts with each octree node.
Definition: OctreeDcdContact.h:69
OctreeDcdContact(std::shared_ptr< ContactCalculation > calculator)
Constructor.
Definition: OctreeDcdContact.cpp:31
std::pair< int, int > m_shapeTypes
The shape types that this contact caculation handles.
Definition: OctreeDcdContact.h:66