17 #ifndef IGNITION_RENDERING_BASE_BASENODE_HH_ 18 #define IGNITION_RENDERING_BASE_BASENODE_HH_ 36 public:
virtual VisualPtr Parent()
const = 0;
38 public:
virtual void RemoveParent();
40 public:
virtual math::Pose3d LocalPose()
const;
42 public:
virtual void SetLocalPose(
const math::Pose3d &_pose);
44 public:
virtual math::Vector3d LocalPosition()
const;
46 public:
virtual void SetLocalPosition(
double _x,
double _y,
double _z);
48 public:
virtual void SetLocalPosition(
const math::Vector3d &_position);
50 public:
virtual math::Quaterniond LocalRotation()
const;
52 public:
virtual void SetLocalRotation(
double _r,
double _p,
double _y);
54 public:
virtual void SetLocalRotation(
double _w,
double _x,
double _y,
57 public:
virtual void SetLocalRotation(
const math::Quaterniond &_rotation);
59 public:
virtual math::Pose3d WorldPose()
const;
61 public:
virtual void SetWorldPose(
const math::Pose3d &_pose);
63 public:
virtual math::Vector3d WorldPosition()
const;
65 public:
virtual void SetWorldPosition(
double _x,
double _y,
double _z);
67 public:
virtual void SetWorldPosition(
const math::Vector3d &_position);
69 public:
virtual math::Quaterniond WorldRotation()
const;
71 public:
virtual void SetWorldRotation(
double _r,
double _p,
double _y);
73 public:
virtual void SetWorldRotation(
double _w,
double _x,
double _y,
76 public:
virtual void SetWorldRotation(
const math::Quaterniond &_rotation);
78 public:
virtual math::Pose3d WorldToLocal(
const math::Pose3d &_pose)
81 public:
virtual math::Vector3d Origin()
const;
83 public:
virtual void SetOrigin(
double _x,
double _y,
double _z);
85 public:
virtual void SetOrigin(
const math::Vector3d &_origin);
87 public:
virtual void Destroy();
89 protected:
virtual math::Pose3d RawLocalPose()
const = 0;
91 protected:
virtual void SetRawLocalPose(
const math::Pose3d &_pose) = 0;
116 auto baseShared = this->shared_from_this();
118 parent->RemoveChild(thisShared);
126 math::Pose3d pose = this->RawLocalPose();
127 pose.Pos() += pose.Rot() * this->origin;
135 math::Pose3d pose = _pose;
136 pose.Pos() = pose.Pos() - pose.Rot() * this->origin;
137 this->SetRawLocalPose(pose);
144 return this->LocalPose().Pos();
151 this->SetLocalPosition(math::Vector3d(_x, _y, _z));
158 math::Pose3d pose = this->LocalPose();
159 pose.Pos() = _position;
160 this->SetLocalPose(pose);
167 return this->LocalPose().Rot();
174 this->SetLocalRotation(math::Quaterniond(_r, _p, _y));
182 this->SetLocalRotation(math::Quaterniond(_w, _x, _y, _z));
189 math::Pose3d pose = this->LocalPose();
190 pose.Rot() = _rotation;
191 this->SetLocalPose(pose);
199 math::Pose3d pose = this->LocalPose();
206 return pose + parent->WorldPose();
213 math::Pose3d pose = this->WorldToLocal(_pose);
214 this->SetLocalPose(pose);
221 this->SetWorldPosition(math::Vector3d(_x, _y, _z));
228 return this->WorldPose().Pos();
235 math::Pose3d pose = this->WorldPose();
236 pose.Pos() =_position;
237 this->SetWorldPose(pose);
244 return this->WorldPose().Rot();
251 this->SetWorldRotation(math::Quaterniond(_r, _p, _y));
259 this->SetWorldRotation(math::Quaterniond(_w, _x, _y, _z));
266 math::Pose3d pose = this->WorldPose();
267 pose.Rot() = _rotation;
268 this->SetWorldPose(pose);
282 return _pose - parent->WorldPose();
296 this->SetOrigin(math::Vector3d(_x, _y, _z));
303 this->origin = _origin;
311 this->RemoveParent();
virtual void SetLocalPose(const math::Pose3d &_pose)
Set the local pose.
Definition: BaseNode.hh:133
virtual math::Quaterniond LocalRotation() const
Get the local rotation.
Definition: BaseNode.hh:165
virtual void SetWorldPosition(double _x, double _y, double _z)
Set the world position.
Definition: BaseNode.hh:219
virtual math::Vector3d WorldPosition() const
Get the world position.
Definition: BaseNode.hh:226
virtual void RemoveParent()
Detach this Geometry from its parent Visual. If this Geometry does not have a parent, no work will be done.
Definition: BaseNode.hh:110
virtual void SetWorldRotation(double _r, double _p, double _y)
Set the world rotation.
Definition: BaseNode.hh:249
virtual void SetLocalPosition(double _x, double _y, double _z)
Set the local position.
Definition: BaseNode.hh:149
virtual math::Pose3d LocalPose() const
Get the local pose.
Definition: BaseNode.hh:124
virtual math::Quaterniond WorldRotation() const
Get the world rotation.
Definition: BaseNode.hh:242
Represents a single posable node in the scene graph.
Definition: Node.hh:34
virtual ~BaseNode()
Definition: BaseNode.hh:104
virtual void SetOrigin(double _x, double _y, double _z)
Set position of origin. The position should be relative to the original origin of the geometry...
Definition: BaseNode.hh:294
virtual math::Vector3d Origin() const
Get position of origin.
Definition: BaseNode.hh:287
T dynamic_pointer_cast(T... args)
virtual math::Pose3d WorldPose() const
Get the world pose.
Definition: BaseNode.hh:196
virtual void SetLocalRotation(double _r, double _p, double _y)
Set the local rotation.
Definition: BaseNode.hh:172
virtual void Destroy()
Destroy any resources associated with this object. Invoking any other functions after destroying an o...
Definition: BaseNode.hh:308
BaseNode()
Definition: BaseNode.hh:98
virtual void SetWorldPose(const math::Pose3d &_pose)
Set the world pose.
Definition: BaseNode.hh:211
virtual math::Pose3d WorldToLocal(const math::Pose3d &_pose) const
Convert given world pose to local pose.
Definition: BaseNode.hh:273
Definition: ArrowVisual.hh:22
Definition: BaseNode.hh:28
virtual math::Vector3d LocalPosition() const
Get the local position.
Definition: BaseNode.hh:142
math::Vector3d origin
Definition: BaseNode.hh:93