DcdCollision.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_PHYSICS_DCDCOLLISION_H
17 #define SURGSIM_PHYSICS_DCDCOLLISION_H
18 
19 #include <memory>
20 
21 #include "SurgSim/Math/Shape.h"
23 
24 namespace SurgSim
25 {
26 
27 namespace Collision
28 {
29 class ContactCalculation;
30 }
31 
32 namespace Physics
33 {
34 class PhysicsManagerState;
35 
43 
44 class DcdCollision : public Computation
45 {
46 public:
47 
50  explicit DcdCollision(bool doCopyState = false);
51 
53  virtual ~DcdCollision();
54 
55 protected:
56 
60  virtual std::shared_ptr<PhysicsManagerState> doUpdate(
61  const double& dt,
62  const std::shared_ptr<PhysicsManagerState>& state) override;
63 
64 private:
65 
68 
70  void updatePairs(std::shared_ptr<PhysicsManagerState> state);
71 
73  void setDcdContactInTable(std::shared_ptr<SurgSim::Collision::ContactCalculation> dcdContact);
74 
77  std::shared_ptr<SurgSim::Collision::ContactCalculation> m_contactCalculations[SurgSim::Math::SHAPE_TYPE_COUNT]
79 
80 };
81 
82 }; // Physics
83 }; // SurgSim
84 
85 #endif
Definition: DriveElementFromInputBehavior.cpp:27
Computation to determine the contacts between a list of CollisionPairs.
Definition: DcdCollision.h:44
std::shared_ptr< SurgSim::Collision::ContactCalculation > m_contactCalculations[SurgSim::Math::SHAPE_TYPE_COUNT][SurgSim::Math::SHAPE_TYPE_COUNT]
Table containing contact calculation, the indices indicate the type of the first pair object and the ...
Definition: DcdCollision.h:78
DcdCollision(bool doCopyState=false)
Constructor.
Definition: DcdCollision.cpp:32
void updatePairs(std::shared_ptr< PhysicsManagerState > state)
Updates the collision pairs.
Definition: DcdCollision.cpp:102
void setDcdContactInTable(std::shared_ptr< SurgSim::Collision::ContactCalculation > dcdContact)
Function to populate the m_contactCalculations table for each DcdContact class.
Definition: DcdCollision.cpp:148
Definition: Shape.h:53
Encapsulates a calculation over a selection of objects, needs to be subclassed to be used...
Definition: Computation.h:30
virtual ~DcdCollision()
Destructor.
Definition: DcdCollision.cpp:37
void populateCalculationTable()
Initializes the table of ContactCalculation objects.
Definition: DcdCollision.cpp:70
virtual std::shared_ptr< PhysicsManagerState > doUpdate(const double &dt, const std::shared_ptr< PhysicsManagerState > &state) override
Executes the update operation, overridden from Computation.
Definition: DcdCollision.cpp:41