DART  6.10.1
ShapeNode.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2021, The DART development contributors
3  * All rights reserved.
4  *
5  * The list of contributors can be found at:
6  * https://github.com/dartsim/dart/blob/master/LICENSE
7  *
8  * This file is provided under the following "BSD-style" License:
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef DART_DYNAMICS_SHAPENODE_HPP_
34 #define DART_DYNAMICS_SHAPENODE_HPP_
35 
36 #include <Eigen/Dense>
37 
38 #include "dart/common/Signal.hpp"
40 
41 namespace dart {
42 namespace dynamics {
43 
44 class VisualAspect;
45 class CollisionAspect;
46 class DynamicsAspect;
47 
49 {
50 public:
51  friend class BodyNode;
52 
54  const ShapeNode* thisShapeNode,
55  const ShapePtr& oldShape,
56  const ShapePtr& newShape)>;
57 
59  const ShapeNode* thisShapeNode,
60  const Eigen::Isometry3d& oldTransform,
61  const Eigen::Isometry3d& newTransform)>;
62 
65 
67 
69  virtual ~ShapeNode() = default;
70 
72  void setProperties(const Properties& properties);
73 
75  const Properties getShapeNodeProperties() const;
76 
78  void copy(const ShapeNode& other);
79 
81  void copy(const ShapeNode* other);
82 
84  ShapeNode& operator=(const ShapeNode& other);
85 
87  void setRelativeTransform(const Eigen::Isometry3d& transform) override;
88 
90  void setRelativeRotation(const Eigen::Matrix3d& rotation);
91 
93  Eigen::Matrix3d getRelativeRotation() const;
94 
96  void setRelativeTranslation(const Eigen::Vector3d& translation);
97 
99  void setOffset(const Eigen::Vector3d& offset);
100 
102  Eigen::Vector3d getRelativeTranslation() const;
103 
105  Eigen::Vector3d getOffset() const;
106 
107  // Documentation inherited
108  ShapeNode* asShapeNode() override;
109 
110  // Documentation inherited
111  const ShapeNode* asShapeNode() const override;
112 
113  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
114 
115 protected:
117  ShapeNode(BodyNode* bodyNode, const BasicProperties& properties);
118 
120  ShapeNode(
121  BodyNode* bodyNode,
122  const ShapePtr& shape,
123  const std::string& name = "ShapeNode");
124 
127  Node* cloneNode(BodyNode* parent) const override;
128 };
129 
130 } // namespace dynamics
131 } // namespace dart
132 
133 #endif // DART_DYNAMICS_SHAPENODE_HPP_
BodyPropPtr properties
Definition: SdfParser.cpp:80
std::string * name
Definition: SkelParser.cpp:1697
detail::CompositeProperties Properties
Definition: Composite.hpp:56
Definition: Signal.hpp:109
Definition: CompositeData.hpp:186
Definition: CompositeData.hpp:107
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:79
Definition: CompositeNode.hpp:96
The Node class is a base class for BodyNode and any object that attaches to a BodyNode.
Definition: Node.hpp:81
Definition: ShapeNode.hpp:49
Eigen::Vector3d getRelativeTranslation() const
Get translation of this shape node relative to the parent frame.
Definition: ShapeNode.cpp:123
Eigen::Matrix3d getRelativeRotation() const
Get rotation of this shape node relative to the parent frame.
Definition: ShapeNode.cpp:102
void setRelativeTranslation(const Eigen::Vector3d &translation)
Set translation of this shape node relative to the parent frame.
Definition: ShapeNode.cpp:108
const Properties getShapeNodeProperties() const
Get the Properties of this ShapeNode.
Definition: ShapeNode.cpp:46
Node * cloneNode(BodyNode *parent) const override
Create a clone of this ShapeNode.
Definition: ShapeNode.cpp:174
Eigen::Vector3d getOffset() const
Same as getRelativeTranslation()
Definition: ShapeNode.cpp:129
void setRelativeTransform(const Eigen::Isometry3d &transform) override
Set transformation of this shape node relative to the parent frame.
Definition: ShapeNode.cpp:77
void setProperties(const Properties &properties)
Set the Properties of this ShapeNode.
Definition: ShapeNode.cpp:40
void setOffset(const Eigen::Vector3d &offset)
Same as setRelativeTranslation(offset)
Definition: ShapeNode.cpp:117
ShapeNode * asShapeNode() override
Definition: ShapeNode.cpp:135
void setRelativeRotation(const Eigen::Matrix3d &rotation)
Set rotation of this shape node relative to the parent frame.
Definition: ShapeNode.cpp:93
void copy(const ShapeNode &other)
Copy the properties of another ShapeNode.
Definition: ShapeNode.cpp:52
ShapeNode & operator=(const ShapeNode &other)
Same as copy(const ShapeNode&)
Definition: ShapeNode.cpp:70
ShapeNode(BodyNode *bodyNode, const BasicProperties &properties)
Constructor used by the Skeleton class.
Definition: ShapeNode.cpp:147
virtual ~ShapeNode()=default
Destructor.
dart::collision::fcl::Vector3 transform(const dart::collision::fcl::Transform3 &t, const dart::collision::fcl::Vector3 &v)
Transforms a 3-dim vector by a transform and returns the result.
Definition: BackwardCompatibility.cpp:133
std::shared_ptr< Shape > ShapePtr
Definition: SmartPointer.hpp:81
Definition: BulletCollisionDetector.cpp:65