All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TransferPhysicsToPointCloudBehavior.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_BLOCKS_TRANSFERPHYSICSTOPOINTCLOUDBEHAVIOR_H
17 #define SURGSIM_BLOCKS_TRANSFERPHYSICSTOPOINTCLOUDBEHAVIOR_H
18 
21 
22 namespace SurgSim
23 {
24 
25 namespace Framework
26 {
27 class Component;
28 }
29 
30 namespace Graphics
31 {
32 class PointCloudRepresentation;
33 }
34 
35 namespace Physics
36 {
37 class DeformableRepresentation;
38 }
39 
40 namespace Blocks
41 {
42 SURGSIM_STATIC_REGISTRATION(TransferPhysicsToPointCloudBehavior);
43 
46 {
47 public:
50  explicit TransferPhysicsToPointCloudBehavior(const std::string& name);
51 
53 
56  void setSource(const std::shared_ptr<SurgSim::Framework::Component>& source);
57 
60  void setTarget(const std::shared_ptr<SurgSim::Framework::Component>& target);
61 
64  std::shared_ptr<SurgSim::Physics::DeformableRepresentation> getSource() const;
65 
68  std::shared_ptr<SurgSim::Graphics::PointCloudRepresentation> getTarget() const;
69 
70  virtual void update(double dt) override;
71 
72 private:
73  virtual bool doInitialize() override;
74  virtual bool doWakeUp() override;
75 
77  std::shared_ptr<SurgSim::Physics::DeformableRepresentation> m_source;
78 
80  std::shared_ptr<SurgSim::Graphics::PointCloudRepresentation> m_target;
81 };
82 
83 }; // namespace Blocks
84 }; // namespace SurgSim
85 
86 #endif // SURGSIM_BLOCKS_TRANSFERPHYSICSTOPOINTCLOUDBEHAVIOR_H
void setSource(const std::shared_ptr< SurgSim::Framework::Component > &source)
Set the representation from which the positions are from.
Definition: TransferPhysicsToPointCloudBehavior.cpp:45
std::shared_ptr< SurgSim::Physics::DeformableRepresentation > getSource() const
Get the Physics representation which sends the positions.
Definition: TransferPhysicsToPointCloudBehavior.cpp:65
std::shared_ptr< SurgSim::Graphics::PointCloudRepresentation > m_target
The Graphics PointCloud Representation to which the vertices' positions are set.
Definition: TransferPhysicsToPointCloudBehavior.h:80
TransferPhysicsToPointCloudBehavior(const std::string &name)
Constructor.
Definition: TransferPhysicsToPointCloudBehavior.cpp:36
virtual bool doWakeUp() override
Interface to be implemented by derived classes.
Definition: TransferPhysicsToPointCloudBehavior.cpp:91
void setTarget(const std::shared_ptr< SurgSim::Framework::Component > &target)
Set the point cloud representation which will receive the positions.
Definition: TransferPhysicsToPointCloudBehavior.cpp:55
std::shared_ptr< SurgSim::Graphics::PointCloudRepresentation > getTarget() const
Get the point cloud representation which receives the positions.
Definition: TransferPhysicsToPointCloudBehavior.cpp:70
Behavior to copy positions of a PhysicsRepresentation to a PointCloud.
Definition: TransferPhysicsToPointCloudBehavior.h:45
Behaviors perform actions.
Definition: Behavior.h:40
virtual void update(double dt) override
Update the behavior.
Definition: TransferPhysicsToPointCloudBehavior.cpp:75
SURGSIM_CLASSNAME(SurgSim::Blocks::TransferPhysicsToPointCloudBehavior)
std::shared_ptr< SurgSim::Physics::DeformableRepresentation > m_source
The DeformableRepresentation from which the Ode state comes.
Definition: TransferPhysicsToPointCloudBehavior.h:77
virtual bool doInitialize() override
Interface to be implemented by derived classes.
Definition: TransferPhysicsToPointCloudBehavior.cpp:86
SURGSIM_STATIC_REGISTRATION(DriveElementFromInputBehavior)