/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */ /* $Id: vctMatrixRotation2.h,v 1.16 2007/04/26 19:33:58 anton Exp $ Author(s): Anton Deguet Created on: 2005-02-23 (C) Copyright 2005-2007 Johns Hopkins University (JHU), All Rights Reserved. --- begin cisst license - do not edit --- This software is provided "as is" under an open source license, with no warranty. The complete license can be found in license.txt and http://www.cisst.org/cisst/license.txt. --- end cisst license --- */ /*! \file \brief Declaration of vctMatrixRotation2 */ #ifndef _vctMatrixRotation2_h #define _vctMatrixRotation2_h #include #include #include /*! \brief Define a rotation matrix for a space of dimension 2 \ingroup cisstVector This class is templated by the element type. It is derived from vctMatrixRotation2Base and uses a vctFixedSizeMatrix as underlying container. It provides a more humain interface for programmers only interested in templating by _elementType. \param _elementType The type of elements of the matrix. \sa vctMatrixRotation2Base vctFixedSizeMatrix */ template class vctMatrixRotation2: public vctMatrixRotation2Base > { public: /* no need to document, inherit doxygen documentation from base class */ VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType); enum {ROWS = 2, COLS = 2}; enum {DIMENSION = 2}; typedef vctFixedSizeMatrix ContainerType; typedef vctMatrixRotation2Base BaseType; typedef vctMatrixRotation2 ThisType; /*! Traits used for all useful types and values related to the element type. */ typedef cmnTypeTraits TypeTraits; /*! Default constructor. Sets the rotation matrix to identity. */ inline vctMatrixRotation2(): BaseType() {} inline vctMatrixRotation2(const ThisType & other): BaseType(other) {} inline vctMatrixRotation2(const BaseType & other): BaseType(other) {} /*! The assignment from BaseType (i.e. a 2 by 2 fixed size matrix) has to be redefined for this class (C++ restriction). This operator uses the Assign() method inherited from the BaseType. This operator (as well as the Assign method) allows to set a rotation matrix to whatever value without any further validity checking. It is recommended to use it with caution. */ inline ThisType & operator = (const ContainerType & other) { return reinterpret_cast(this->Assign(other)); } inline ThisType & operator = (const ThisType & other) { return reinterpret_cast(this->Assign(other)); } inline ThisType & operator = (const BaseType & other) { return reinterpret_cast(this->Assign(other)); } /* documented in base class */ inline vctMatrixRotation2(const value_type & element00, const value_type & element01, const value_type & element10, const value_type & element11) throw(std::runtime_error): BaseType(element00, element01, element10, element11) {} template inline vctMatrixRotation2(const vctFixedSizeConstVectorBase& v1, const vctFixedSizeConstVectorBase& v2, bool vectorsAreColumns = true) throw(std::runtime_error): BaseType(v1, v2, vectorsAreColumns) {} template inline vctMatrixRotation2(const vctDynamicConstVectorBase<__vectorOwnerType1, value_type>& v1, const vctDynamicConstVectorBase<__vectorOwnerType2, value_type>& v2, bool vectorsAreColumns = true) throw(std::runtime_error): BaseType(v1, v2, vectorsAreColumns) {} inline vctMatrixRotation2(const vctAngleRotation2 & angleRotation) throw(std::runtime_error): BaseType(angleRotation) {} inline vctMatrixRotation2(const value_type & element00, const value_type & element01, const value_type & element10, const value_type & element11, bool normalizeInput): BaseType(element00, element01, element10, element11, normalizeInput) {} template inline vctMatrixRotation2(const vctFixedSizeConstVectorBase& v1, const vctFixedSizeConstVectorBase& v2, bool vectorsAreColumns, bool normalizeInput): BaseType(v1, v2, vectorsAreColumns, normalizeInput) {} template inline vctMatrixRotation2(const vctDynamicConstVectorBase<__vectorOwnerType1, value_type>& v1, const vctDynamicConstVectorBase<__vectorOwnerType2, value_type>& v2, bool vectorsAreColumns, bool normalizeInput): BaseType(v1, v2, vectorsAreColumns, normalizeInput) {} inline vctMatrixRotation2(const vctAngleRotation2 & angleRotation, bool normalizeInput): BaseType(angleRotation, normalizeInput) {} /*! Initialize this rotation matrix with a 2x2 matrix. This constructor only takes a matrix of the same element type. \note This constructor does not verify normalization. It is introduced to allow using results of matrix operations and assign them to a rotation matrix. \note The constructor is declared explicit, to force the user to be aware of the conversion being made. */ template explicit inline vctMatrixRotation2(const vctFixedSizeMatrixBase & matrix): BaseType(matrix) {} }; #endif // _vctMatrixRotation2_h // **************************************************************************** // Change History // **************************************************************************** // // $Log: vctMatrixRotation2.h,v $ // Revision 1.16 2007/04/26 19:33:58 anton // All files in libraries: Applied new license text, separate copyright and // updated dates, added standard header where missing. // // Revision 1.15 2007/02/05 20:04:42 anton // cisstVector: Re-added and cleaned up rotations classes as requested in #266 // // Revision 1.14 2007/01/24 03:10:22 anton // vctMatrixRotation2: Simplified class structure by removing derived class // and re-implementation of constructors. End user types are defined with a // simpler typedef. See ticket #263. // // Revision 1.13 2006/11/20 20:33:20 anton // Licensing: Applied new license to cisstCommon, cisstVector, cisstNumerical, // cisstInteractive, cisstImage and cisstOSAbstraction. // // Revision 1.12 2006/01/03 03:38:58 anton // cisstVector Doxygen: Used \code \endcode instead of
 
, added // some missing
, added links to VCT_NORMALIZE. // // Revision 1.11 2005/12/02 02:40:23 anton // vctRotationMatrix2: Update for gcc 4.0. // // Revision 1.10 2005/12/01 22:11:57 anton // cisstVector: 2D transformations, added a base class for rotation matrix 2. // // Revision 1.9 2005/10/06 16:56:37 anton // Doxygen: Corrected errors and some warnings detected by Doxygen 1.4.3. // // Revision 1.8 2005/09/26 15:41:47 anton // cisst: Added modelines for emacs and vi. // // Revision 1.7 2005/07/22 19:06:46 ofri // vct[Quaternion|Matrix]Rotation[2|3]: Fixing compilation error related to // check-in [1253]. // // Revision 1.6 2005/07/22 15:08:21 ofri // Answer for ticket #155: added operator * that returns ThisType to // vctMatrixRotation2, vctMatrixRotation3, vctQuaternionRotation3 // // Revision 1.5 2005/07/19 18:24:28 anton // vctMatrixRotation{2,3}: Added constructor and From methods to set a rotation // matrix from 2 (respectively 3) vectors. See ticket #151. // // Revision 1.4 2005/05/19 19:29:01 anton // cisst libs: Added the license to cisstCommon and cisstVector // // Revision 1.3 2005/05/13 18:23:51 anton // cisstVector: Both vctMatrixRotation{2,3}::Normalized() where normalizing // identity. Result is now initialized from *this. // // Revision 1.2 2005/04/28 03:58:35 anton // cisstVector: Added methods ApplyTo(input) returning by copy as specified // in ticket #108. Added Doxygen documentation and moved from EqualRotation() // to AlmostEqual(). // // Revision 1.1 2005/02/24 01:51:50 anton // cisstVector: Added classes vctAngleRotation2 and vctMatrixRotation2. This // code has not been tested. The normalization and conversion methods have // to be reviewed. // // // ****************************************************************************