OpenLexocad  27.1
Placement.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (c) 2006 Jürgen Riegel <juergen.riegel@web.de> *
3  * *
4  * This file is part of the FreeCAD CAx development system. *
5  * *
6  * This library is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Library General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU Library General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Library General Public *
17  * License along with this library; see the file COPYING.LIB. If not, *
18  * write to the Free Software Foundation, Inc., 59 Temple Place, *
19  * Suite 330, Boston, MA 02111-1307, USA *
20  * *
21  ***************************************************************************/
22 
23 #ifndef BASE_PLACEMENT_H
24 #define BASE_PLACEMENT_H
25 
26 #include "Vector3D.h"
27 #include "Rotation.h"
28 #include "Matrix.h"
29 
30 
31 namespace Base {
32 
33 class DualQuat;
34 
38 class LX_BASE_EXPORT Placement
39 {
40 public:
42  Placement(void);
43  Placement(const Placement&);
44  Placement(const Base::Matrix4D& matrix);
45  Placement(const Vector3d& Pos, const Rotation &Rot);
46  Placement(const Vector3d& Pos, const Rotation &Rot, const Vector3d& Cnt);
47 
50  static Placement fromDualQuaternion(DualQuat qq);
52 
54  ~Placement () {}
55 
56  Matrix4D toMatrix(void) const;
57  void fromMatrix(const Matrix4D& m);
58  DualQuat toDualQuaternion() const;
59  const Vector3d& getPosition(void) const {return _pos;}
60  const Rotation& getRotation(void) const {return _rot;}
61  void setPosition(const Vector3d& Pos){_pos=Pos;}
62  void setRotation(const Rotation& Rot) {_rot = Rot;}
63 
64  bool isIdentity() const;
65  void invert();
66  Placement inverse() const;
67  void move(const Vector3d& MovVec);
68 
71  Placement & operator*=(const Placement & p);
72  Placement operator *(const Placement & p) const;
73  bool operator == (const Placement&) const;
74  bool operator != (const Placement&) const;
75  Placement& operator = (const Placement&);
76  Placement pow(double t, bool shorten = true) const;
77 
78  void multVec(const Vector3d & src, Vector3d & dst) const;
80 
81  static Placement slerp(const Placement & p0, const Placement & p1, double t);
82  static Placement sclerp(const Placement & p0, const Placement & p1, double t, bool shorten = true);
83 
84 protected:
87 };
88 
89 } // namespace Base
90 
91 
92 #endif // BASE_PLACEMENT_H
93 
94 
Vector3f & operator *=(Vector3f &rclVect, const Matrix4D &rclMtrx)
Definition: Matrix.h:351
const Vector3d & getPosition(void) const
Definition: Placement.h:59
void setPosition(const Vector3d &Pos)
Definition: Placement.h:61
Base::Rotation _rot
Definition: Placement.h:86
The DualQuat class represents a dual quaternion, as a quaternion of dual number components....
Definition: DualQuaternion.h:42
Vector3< double > _pos
Definition: Placement.h:85
const Rotation & getRotation(void) const
Definition: Placement.h:60
~Placement()
Destruction.
Definition: Placement.h:54
Definition: Matrix.h:38
Definition: AbstractXMLReader.h:5
void setRotation(const Rotation &Rot)
Definition: Placement.h:62
Definition: Placement.h:38
Definition: Rotation.h:34
DualNumber operator *(DualNumber a, DualNumber b)
Definition: DualNumber.h:71
DualNumber pow(DualNumber a, double pw)
Definition: DualNumber.h:88