#ifndef _utl_TransformationMatrix_h_ #define _utl_TransformationMatrix_h_ /** \file Transformation matrices \author Lukas Nellen \version $Id: TransformationMatrix.h 19124 2011-05-03 09:56:49Z javierg $ \date 23 May 2003 */ static const char CVSId_utl_TransformationMatrix[] = "$Id: TransformationMatrix.h 19124 2011-05-03 09:56:49Z javierg $"; #include #include #include #include #include #include #include namespace utl { /** \class TransformationMatrix TransformationMatrix.h utl/TransformationMatrix.h \brief Transformations matrices for afine transformations This class provides the transformations between coordinate systems and the objects contained in them. We restrict ourselves to the commonly used transformations: - Rotations - Translations - Reflections The current implementation does not provide scaling transformations. Transformations to non-orthogonal bases will never be provided by this package. Special, named constructors create special transformations like rotations or translations. All transformation are relative, so they do not require a coordinate system to be valid. \author Lukas Nellen \date 23 May 2003 \ingroup geometry */ class TransformationMatrix : public boost::multipliable { public: typedef boost::tuple Triple; /// Dimension of transformation matrix static const int kDimension = 4; TransformationMatrix() { } /// Chaining of transformations TransformationMatrix& operator*=(const TransformationMatrix& second); /// Inverse transformation TransformationMatrix Inverse() const; /// Distance between transformations (useful for testing) double Distance(const TransformationMatrix& second) const; /** \brief Decomposition into Translation and Rotation The original transformation is recovered as \code T = trans * rot \endcode */ boost::tuple Decompose() const; // Extra factory functions - all static /// Translation static TransformationMatrix Translation(const double x, const double y, const double z); /// Rotation by angle about axis given by three components static TransformationMatrix Rotation(const double angle, const double x, const double y, const double z); static TransformationMatrix Rotation(const double angle, const Triple& v); /// Rotation by angle about X axis static TransformationMatrix RotationX(const double angle); /// Rotation by angle about Y axis static TransformationMatrix RotationY(const double angle); /// Rotation by angle about Z axis static TransformationMatrix RotationZ(const double angle); /// From dreibein (basis vectors) static TransformationMatrix TransformToBasis(const double x1, const double y1, const double z1, const double x2, const double y2, const double z2, const double x3, const double y3, const double z3); private: typedef HepGeom::Transform3D InternalTransform; /// Private constructor to build transformation from HepGeom::Transform3D TransformationMatrix(const InternalTransform& transform) : fTransform(transform) { } /// The concrete transformation object. /** The concrete transformation object is owned by the TransformationMatrix class. This means that each constructor has to allocate one, and the destructor has to delete it. */ InternalTransform fTransform; template friend class BasicVector; friend class TransformationPolicy; friend std::ostream& operator<<(std::ostream& s, const TransformationMatrix& m); }; std::ostream& operator<<(std::ostream&s, const TransformationMatrix& m); } // utl #endif // _utl_TransformationMatrix_h_ // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // compile-command: "make -C .. -k" // End: