ParticlesCollisionRepresentation.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_PARTICLES_PARTICLESCOLLISIONREPRESENTATION_H
17 #define SURGSIM_PARTICLES_PARTICLESCOLLISIONREPRESENTATION_H
18 
19 #include <memory>
20 #include <string>
21 
24 
25 
26 namespace SurgSim
27 {
28 
29 namespace Math
30 {
31 class Shape;
32 class ParticlesShape;
33 };
34 
35 namespace Particles
36 {
37 
38 class Representation;
39 
40 SURGSIM_STATIC_REGISTRATION(ParticlesCollisionRepresentation);
41 
44 {
45 public:
46 
49  explicit ParticlesCollisionRepresentation(const std::string& name);
50 
53 
55 
56  const std::shared_ptr<SurgSim::Math::Shape> getShape() const override;
57 
58  int getShapeType() const override;
59 
60  void updateShapeData() override;
61 
64  void setParticleRepresentation(std::shared_ptr<SurgSim::Particles::Representation> representation);
65 
68  const std::shared_ptr<SurgSim::Particles::Representation> getParticleRepresentation() const;
69 
72  void setParticleRadius(double radius);
73 
76  double getParticleRadius() const;
77 
78 private:
79  bool doInitialize() override;
80 
81  bool doWakeUp() override;
82 
84  std::shared_ptr<SurgSim::Math::ParticlesShape> m_shape;
85 
87  std::weak_ptr<SurgSim::Particles::Representation> m_particleRepresentation;
88 };
89 
90 };
91 };
92 
93 #endif // SURGSIM_PARTICLES_PARTICLESCOLLISIONREPRESENTATION_H
94 
Definition: CompoundShapeToGraphics.cpp:29
A Collision Representation that can be attached to a Particle Representation.
Definition: ParticlesCollisionRepresentation.h:43
DataStructures::Vertices< ParticleData > Particles
Definition: Particles.h:53
std::shared_ptr< SurgSim::Math::ParticlesShape > m_shape
Shape used for collision detection.
Definition: ParticlesCollisionRepresentation.h:84
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
std::weak_ptr< SurgSim::Particles::Representation > m_particleRepresentation
Reference to the particle representation driving changes to this collision representation.
Definition: ParticlesCollisionRepresentation.h:87
The type of collision detection.
Definition: Representation.h:60