00001 /*************************************************************************** 00002 * Copyright (c) 2006 Juergen Riegel * 00003 * * 00004 * This file is part of the FreeCAD CAx development system. * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Library General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU Library General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Library General Public * 00017 * License along with this library; see the file COPYING.LIB. If not, * 00018 * write to the Free Software Foundation, Inc., 59 Temple Place, * 00019 * Suite 330, Boston, MA 02111-1307, USA * 00020 * * 00021 ***************************************************************************/ 00022 00023 00024 #ifndef BASE_PLACEMENT_H 00025 #define BASE_PLACEMENT_H 00026 00027 #include "Vector3D.h" 00028 #include "Rotation.h" 00029 #include "Matrix.h" 00030 00031 00032 00033 namespace Base { 00034 00035 00039 class BaseExport Placement 00040 { 00041 public: 00043 Placement(void); 00044 Placement(const Placement&); 00045 Placement(const Base::Matrix4D& matrix); 00046 Placement(const Vector3d& Pos, const Rotation &Rot); 00047 Placement(const Vector3d& Pos, const Rotation &Rot, const Vector3d& Cnt); 00049 ~Placement () {}; 00050 00051 Matrix4D toMatrix(void) const; 00052 void fromMatrix(const Matrix4D& m); 00053 const Vector3d& getPosition(void) const {return _pos;} 00054 const Rotation& getRotation(void) const {return _rot;} 00055 void setPosition(const Vector3d& Pos){_pos=Pos;} 00056 void setRotation(const Rotation& Rot) {_rot = Rot;} 00057 00058 void invert(); 00059 Placement inverse() const; 00060 void move(const Vector3d& MovVec); 00061 00064 Placement & operator*=(const Placement & p); 00065 Placement operator *(const Placement & p) const; 00066 bool operator == (const Placement&) const; 00067 bool operator != (const Placement&) const; 00068 Placement& operator = (const Placement&); 00069 00070 void multVec(const Vector3d & src, Vector3d & dst) const; 00072 00073 static Placement slerp(const Placement & p0, const Placement & p1, double t); 00074 00075 protected: 00076 Vector3<double> _pos; 00077 Base::Rotation _rot; 00078 }; 00079 00080 } // namespace Base 00081 00082 00083 #endif // BASE_PLACEMENT_H 00084 00085