Ignition Rendering

API Reference

4.1.0
TransformController.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Open Source Robotics Foundation
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  */
17 #ifndef IGNITION_RENDERING_TRANSFORMCONTROLLER_HH_
18 #define IGNITION_RENDERING_TRANSFORMCONTROLLER_HH_
19 
20 #include <memory>
21 
23 #include <ignition/math/Plane.hh>
24 #include <ignition/math/Vector3.hh>
25 
26 #include "ignition/rendering/config.hh"
30 
31 namespace ignition
32 {
33  namespace rendering
34  {
35  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
36  //
37  // forward declarations
38  class TransformControllerPrivate;
39 
40  /* \class TransformController TransformController.hh \
41  * ignition/rendering/TransformController.hh
42  */
44  class IGNITION_RENDERING_VISIBLE TransformController
45  {
47  public: TransformController();
48 
50  public: virtual ~TransformController();
51 
54  public: virtual void Update();
55 
58  public: virtual void SetCamera(const CameraPtr &_camera);
59 
62  public: virtual CameraPtr Camera() const;
63 
66  public: virtual NodePtr Node() const;
67 
70  public: virtual void Attach(NodePtr _node);
71 
74  public: virtual void Detach();
75 
78  public: virtual void SetTransformMode(TransformMode _mode);
79 
82  public: virtual TransformMode Mode() const;
83 
86  public: virtual void SetTransformSpace(TransformSpace _space);
87 
90  public: virtual TransformSpace Space() const;
91 
94  public: virtual void SetActiveAxis(const math::Vector3d &_axis);
95 
98  public: virtual math::Vector3d ActiveAxis() const;
99 
103  public: virtual math::Vector3d AxisById(unsigned int _id) const;
104 
109  public: virtual void Translate(const math::Vector3d &_translation,
110  bool _snap = false);
111 
116  public: virtual void Rotate(const math::Quaterniond &_rotation,
117  bool _snap = false);
118 
123  public: virtual void Scale(const math::Vector3d &_scale,
124  bool _snap = false);
125 
134  public: static ignition::math::Vector3d SnapPoint(
135  const ignition::math::Vector3d &_point, const double _interval = 1.0,
136  const double _sensitivity = 0.4);
137 
141  public: virtual void Start();
142 
146  public: virtual void Stop();
147 
150  public: virtual bool Active() const;
151 
161  public: math::Vector3d TranslationFrom2d(const math::Vector3d &_axis,
162  const math::Vector2d &_start, const math::Vector2d &_end);
163 
173  public: math::Quaterniond RotationFrom2d(const math::Vector3d &_axis,
174  const math::Vector2d &_start, const math::Vector2d &_end);
175 
185  public: math::Vector3d ScaleFrom2d(const math::Vector3d &_axis,
186  const math::Vector2d &_start, const math::Vector2d &_end);
187 
191  public: static math::Vector3d ToAxis(TransformAxis _axis);
192 
200  protected: math::Planed CreatePlaneForTransform(
201  const math::Vector3d &_axis, const math::Vector2d &_pt2d);
202 
209  protected: bool RayPlaneIntersection(RayQueryPtr _ray,
210  const math::Planed &_plane, math::Vector3d &_result);
211 
214  };
215  }
216  }
217 }
218 #endif
std::unique_ptr< TransformControllerPrivate > dataPtr
Private data pointer.
Definition: TransformController.hh:213
TransformAxis
Definition: TransformType.hh:34
An transform tool for translating, rotating, and scaling objects.
Definition: TransformController.hh:44
Represents a single posable node in the scene graph.
Definition: Node.hh:37
Posable camera used for rendering the scene graph.
Definition: Camera.hh:40
TransformMode
Definition: TransformType.hh:60
TransformSpace
Definition: TransformType.hh:74