OpenLexocad  28.0
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 #pragma once
24 
25 #include <Base/Rotation.h>
26 
27 
28 namespace Base
29 {
30 class DualQuat;
31 class Matrix4D;
35 class LX_BASE_EXPORT Placement
36 {
37 public:
39  Placement() = default;
40  Placement(const Placement&);
41  Placement(const Base::Matrix4D& matrix);
42  Placement(const Vector3d& Pos, const Rotation& Rot);
43  Placement(const Vector3d& Pos, const Rotation& Rot, const Vector3d& Cnt);
44 
47  static Placement fromDualQuaternion(DualQuat qq);
49 
50  Matrix4D toMatrix(void) const;
51  void fromMatrix(const Matrix4D& m);
52  DualQuat toDualQuaternion() const;
53  const Vector3d& getPosition(void) const { return _pos; }
54  const Rotation& getRotation(void) const { return _rot; }
55  void setPosition(const Vector3d& Pos) { _pos = Pos; }
56  void setRotation(const Rotation& Rot) { _rot = Rot; }
57 
58  bool isIdentity() const;
59  void invert();
60  Placement inverse() const;
61  void move(const Vector3d& MovVec);
62 
65  Placement& operator*=(const Placement& p);
66  Placement operator*(const Placement& p) const;
67  bool operator==(const Placement&) const;
68  bool operator!=(const Placement&) const;
69  Placement& operator=(const Placement&);
70  Placement pow(double t, bool shorten = true) const;
71 
72  void multVec(const Vector3d& src, Vector3d& dst) const;
74 
75  static Placement slerp(const Placement& p0, const Placement& p1, double t);
76  static Placement sclerp(const Placement& p0, const Placement& p1, double t, bool shorten = true);
77 
78 protected:
81 };
82 
83 } // namespace Base
Base::Placement
Definition: Placement.h:56
Base::operator*=
Vector3f & operator*=(Vector3f &rclVect, const Matrix4D &rclMtrx)
Definition: Matrix.h:367
Rotation.h
Base::pow
DualNumber pow(DualNumber a, double pw)
Definition: DualNumber.h:108
Base::Vector3< double >
Base::Vector3d
Vector3< double > Vector3d
Definition: Vector3D.h:246
Base::operator*
DualNumber operator*(DualNumber a, DualNumber b)
Definition: DualNumber.h:91
entt::operator!=
constexpr bool operator!=(const basic_hashed_string< Char > &lhs, const basic_hashed_string< Char > &rhs) ENTT_NOEXCEPT
Compares two hashed strings.
Definition: entt.hpp:570
Base::Rotation
Definition: Rotation.h:53
Base::Matrix4D
Definition: Matrix.h:55
Base
Definition: AbstractXMLReader.h:5