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 
SurgSim::Particles::ParticlesCollisionRepresentation::m_shape
std::shared_ptr< SurgSim::Math::ParticlesShape > m_shape
Shape used for collision detection.
Definition: ParticlesCollisionRepresentation.h:84
SurgSim::Particles::ParticlesCollisionRepresentation::getShapeType
int getShapeType() const override
Get the shape type id.
Definition: ParticlesCollisionRepresentation.cpp:64
SurgSim::Particles::ParticlesCollisionRepresentation::setParticleRepresentation
void setParticleRepresentation(std::shared_ptr< SurgSim::Particles::Representation > representation)
Sets the particle representation this collision representation is connected.
Definition: ParticlesCollisionRepresentation.cpp:74
SurgSim::Particles::ParticlesCollisionRepresentation::ParticlesCollisionRepresentation
ParticlesCollisionRepresentation(const std::string &name)
Constructor.
Definition: ParticlesCollisionRepresentation.cpp:32
SurgSim::Particles::ParticlesCollisionRepresentation::setParticleRadius
void setParticleRadius(double radius)
Set the particles' radius.
Definition: ParticlesCollisionRepresentation.cpp:91
SurgSim::Particles::ParticlesCollisionRepresentation
A Collision Representation that can be attached to a Particle Representation.
Definition: ParticlesCollisionRepresentation.h:44
SurgSim::Particles::ParticlesCollisionRepresentation::doInitialize
bool doInitialize() override
Interface to be implemented by derived classes.
Definition: ParticlesCollisionRepresentation.cpp:43
SurgSim::Particles::ParticlesCollisionRepresentation::getParticleRepresentation
const std::shared_ptr< SurgSim::Particles::Representation > getParticleRepresentation() const
Gets the particle representation this collision representation is connected.
Definition: ParticlesCollisionRepresentation.cpp:80
ObjectFactory.h
SurgSim
Definition: CompoundShapeToGraphics.cpp:30
SurgSim::Particles::ParticlesCollisionRepresentation::getParticleRadius
double getParticleRadius() const
Get the radius of the particles.
Definition: ParticlesCollisionRepresentation.cpp:96
SurgSim::Particles::ParticlesCollisionRepresentation::m_particleRepresentation
std::weak_ptr< SurgSim::Particles::Representation > m_particleRepresentation
Reference to the particle representation driving changes to this collision representation.
Definition: ParticlesCollisionRepresentation.h:87
SurgSim::Collision::Representation
The type of collision detection.
Definition: Representation.h:61
SurgSim::Particles::ParticlesCollisionRepresentation::getShape
const std::shared_ptr< SurgSim::Math::Shape > getShape() const override
Get the shape.
Definition: ParticlesCollisionRepresentation.cpp:69
SurgSim::Particles::ParticlesCollisionRepresentation::updateShapeData
void updateShapeData() override
Update the basic Shape's state from the physics state, so that the bounding box can correctly be dete...
Definition: ParticlesCollisionRepresentation.cpp:101
SurgSim::Particles::ParticlesCollisionRepresentation::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Particles::ParticlesCollisionRepresentation)
Representation.h
SurgSim::Particles::ParticlesCollisionRepresentation::doWakeUp
bool doWakeUp() override
Interface to be implemented by derived classes.
Definition: ParticlesCollisionRepresentation.cpp:48
string
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
SurgSim::Particles::Particles
DataStructures::Vertices< ParticleData > Particles
Definition: Particles.h:53
SurgSim::Particles::ParticlesCollisionRepresentation::~ParticlesCollisionRepresentation
virtual ~ParticlesCollisionRepresentation()
Destructor.
Definition: ParticlesCollisionRepresentation.cpp:39