constraint.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
4 
5  This file is part of the QGLViewer library version 2.6.3.
6 
7  http://www.libqglviewer.com - contact@libqglviewer.com
8 
9  This file may be used under the terms of the GNU General Public License
10  versions 2.0 or 3.0 as published by the Free Software Foundation and
11  appearing in the LICENSE file included in the packaging of this file.
12  In addition, as a special exception, Gilles Debunne gives you certain
13  additional rights, described in the file GPL_EXCEPTION in this package.
14 
15  libQGLViewer uses dual licensing. Commercial/proprietary software must
16  purchase a libQGLViewer Commercial License.
17 
18  This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
19  WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 
21 *****************************************************************************/
22 
23 #ifndef QGLVIEWER_CONSTRAINT_H
24 #define QGLVIEWER_CONSTRAINT_H
25 
26 #include "vec.h"
27 #include "quaternion.h"
28 
29 namespace qglviewer {
30 class Frame;
31 class Camera;
32 
118 {
119 public:
121  virtual ~Constraint() {}
122 
133  virtual void constrainTranslation(Vec& translation, Frame* const frame) { Q_UNUSED(translation); Q_UNUSED(frame); }
142  virtual void constrainRotation(Quaternion& rotation, Frame* const frame) { Q_UNUSED(rotation); Q_UNUSED(frame); }
143 };
144 
169 {
170 public:
173  virtual ~AxisPlaneConstraint() {}
174 
207  enum Type { FREE, AXIS, PLANE, FORBIDDEN };
208 
212  virtual void constrainTranslation(Vec& translation, Frame* const frame) { Q_UNUSED(translation); Q_UNUSED(frame); };
213 
214  void setTranslationConstraint(Type type, const Vec& direction);
216  void setTranslationConstraintType(Type type) { translationConstraintType_ = type; };
217  void setTranslationConstraintDirection(const Vec& direction);
218 
228  Type translationConstraintType() const { return translationConstraintType_; };
238  Vec translationConstraintDirection() const { return translationConstraintDir_; };
240 
244  virtual void constrainRotation(Quaternion& rotation, Frame* const frame) { Q_UNUSED(rotation); Q_UNUSED(frame); };
245 
246  void setRotationConstraint(Type type, const Vec& direction);
247  void setRotationConstraintType(Type type);
248  void setRotationConstraintDirection(const Vec& direction);
249 
251  Type rotationConstraintType() const { return rotationConstraintType_; };
259  Vec rotationConstraintDirection() const { return rotationConstraintDir_; };
261 
262 private:
263  // int and not Type to allow for overloading and new types definition.
266 
269 };
270 
271 
280 {
281 public:
283  virtual ~LocalConstraint() {};
284 
285  virtual void constrainTranslation(Vec& translation, Frame* const frame);
286  virtual void constrainRotation (Quaternion& rotation, Frame* const frame);
287 };
288 
289 
290 
300 {
301 public:
303  virtual ~WorldConstraint() {};
304 
305  virtual void constrainTranslation(Vec& translation, Frame* const frame);
306  virtual void constrainRotation (Quaternion& rotation, Frame* const frame);
307 };
308 
309 
310 
320 {
321 public:
322  explicit CameraConstraint(const Camera* const camera);
324  virtual ~CameraConstraint() {};
325 
326  virtual void constrainTranslation(Vec& translation, Frame* const frame);
327  virtual void constrainRotation (Quaternion& rotation, Frame* const frame);
328 
330  const Camera* camera() const { return camera_; };
331 
332 private:
333  const Camera* const camera_;
334 };
335 
336 } // namespace qglviewer
337 
338 #endif // QGLVIEWER_CONSTRAINT_H
#define FREE(p)
Definition: gpc.cpp:155
Vec translationConstraintDirection() const
Definition: constraint.h:238
const Camera *const camera_
Definition: constraint.h:330
An abstract class for Frame Constraints defined by an axis or a plane.
Definition: constraint.h:168
An AxisPlaneConstraint defined in the Frame local coordinate system.
Definition: constraint.h:279
virtual void constrainTranslation(Vec &translation, Frame *const frame)
Definition: constraint.h:133
Type translationConstraintType() const
Definition: constraint.h:228
Type rotationConstraintType() const
Definition: constraint.h:251
#define QGLVIEWER_EXPORT
The Vec class represents 3D positions and 3D vectors.
Definition: vec.h:65
A perspective or orthographic camera.
Definition: camera.h:84
virtual void constrainRotation(Quaternion &rotation, Frame *const frame)
Definition: constraint.h:244
The Quaternion class represents 3D rotations and orientations.
Definition: quaternion.h:66
void setTranslationConstraintType(Type type)
Definition: constraint.h:216
The Frame class represents a coordinate system, defined by a position and an orientation.
Definition: frame.h:121
virtual void constrainTranslation(Vec &translation, Frame *const frame)
Definition: constraint.h:212
virtual void constrainRotation(Quaternion &rotation, Frame *const frame)
Definition: constraint.h:142
An AxisPlaneConstraint defined in the world coordinate system.
Definition: constraint.h:299
An interface class for Frame constraints.
Definition: constraint.h:117
An AxisPlaneConstraint defined in the camera coordinate system.
Definition: constraint.h:319


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Wed Jun 5 2019 19:26:39