/* -*- 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: vctQuaternion.h,v 1.27 2007/04/26 19:33:58 anton Exp $ Author(s): Anton Deguet Created on: 2003-10-07 (C) Copyright 2003-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 vctQuaternion */ #ifndef _vctQuaternion_h #define _vctQuaternion_h #include #include /*! \brief Define a quaternion container. \ingroup cisstVector This class is templated by the element type. It is derived from vctQuaternionBase and uses a vctFixedSizeVector as underlying container. It provides a more humain interface for programmers only interested in templating by _elementType. It is important to note that the class vctQuaternion is for any quaternion, i.e. it does not necessary represent a unit quaternion. \param _elementType The type of elements of the vector. \sa vctQuaternionBase vctFixedSizeVector */ template class vctQuaternion : public vctQuaternionBase > { public: /* no need to document, inherit doxygen documentation from base class */ enum {SIZE = 4}; VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType); typedef vctQuaternion ThisType; typedef vctFixedSizeVector ContainerType; typedef vctQuaternionBase BaseType; typedef cmnTypeTraits TypeTraits; /*! Default constructor. Does nothing. */ inline vctQuaternion(): BaseType() {} /*! Constructor from 4 elements. \param x The first imaginary component \param y The second imaginary component \param z The third imaginary component \param r The real component */ inline vctQuaternion(const value_type & x, const value_type & y, const value_type & z, const value_type & r): BaseType(x, y, z, r) {} }; #endif // _vctQuaternion_h // **************************************************************************** // Change History // **************************************************************************** // // $Log: vctQuaternion.h,v $ // Revision 1.27 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.26 2007/02/05 20:04:42 anton // cisstVector: Re-added and cleaned up rotations classes as requested in #266 // // Revision 1.25 2007/01/29 03:29:37 anton // cisstVector: Update quaternion and quaternion based rotation to reflect new // class structure (see ticket #263). // // Revision 1.24 2006/11/20 20:33:20 anton // Licensing: Applied new license to cisstCommon, cisstVector, cisstNumerical, // cisstInteractive, cisstImage and cisstOSAbstraction. // // Revision 1.23 2005/10/06 16:56:37 anton // Doxygen: Corrected errors and some warnings detected by Doxygen 1.4.3. // // Revision 1.22 2005/09/26 15:41:47 anton // cisst: Added modelines for emacs and vi. // // Revision 1.21 2005/09/01 06:18:08 anton // cisstVector transformations: Added a level of abstraction for all classes // derived from fixed size containers (vctQuaternion, vctQuaternionRotation3, // vctMatrixRotation3, vctRodriguezRotation3). These classes are now derived // from vctXyzBase<_containerType>. This will ease the SWIG wrapping. // // Revision 1.20 2005/06/16 03:38:29 anton // Port to gcc 3.4 (common, vector and numerical) tested with gcc 3.3 and MS // VC 7.1 (.Net 2003). // // Revision 1.19 2005/05/19 19:29:01 anton // cisst libs: Added the license to cisstCommon and cisstVector // // Revision 1.18 2005/01/11 22:42:18 anton // cisstVector: Added normalization methods to the vectors. Removed useless // code from vctQuaternion and added some tests. See ticket #110. // // Revision 1.17 2004/12/20 20:47:53 ofri // vctQuaternion: I changed the name of the method Multiply to PostMultiply, and // I added the method PreMultiply, because quaternion product is non-commutative. // I added the methods QuotientOf, Divide(quaterion), and Divide(scalar). Also // Added the / operator for dividing quaternions. // // Revision 1.16 2004/10/25 13:52:05 anton // Doxygen documentation: Cleanup all the useless \ingroup. // // Revision 1.15 2004/10/21 18:39:49 anton // vctQuaternion: Redefines R() and use only X(), Y() and Z() to access the // data members of the quaternions (see ticket #74). // // Revision 1.14 2004/08/13 19:27:55 anton // cisstVector: For all the code related to rotations, added some assert to // check that the input is valid (normalized quaternion, normalized axis, // normalized matrix) for all the From method. Added a // vctQuaternionRotation.FromRaw(matrix) since this method is used to normalize // the rotation matrices. It's input doesn't have to be normalized. As a side // effect these additions, found a couple of IsNormalized methods which were // not const. // // Revision 1.13 2004/08/13 17:47:40 anton // cisstVector: Massive renaming to replace the word "sequence" by "vector" // (see ticket #50) as well as another more systematic naming for the engines. // The changes for the API are as follow: // *: vctFixedLengthSequenceBase -> vctFixedSizeVectorBase (and Const) // *: vctFixedLengthSequenceRef -> vctFixedSizeVectorRef (and Const) // *: vctDynamicSequenceBase -> vctDynamicVectorBase (and Const) // *: vctDynamicSequenceRef -> vctDynamicVectorRef (and Const) // *: vctDynamicSequenceRefOwner -> vctDynamicVectorRefOwner // *: vctFixedStrideSequenceIterator -> vctFixedStrideVectorIterator (and Const) // *: vctVarStrideSequenceIterator -> vctVarStrideVectorIterator (and Const) // *: vctSequenceRecursiveEngines -> vctFixedSizeVectorRecursiveEngines // *: vctSequenceLoopEngines -> vctDynamicVectorLoopEngines // *: vctMatrixLoopEngines -> vctFixedSizeMatrixLoopEngines // *: vctDynamicMatrixEngines -> vctDynamicMatrixLoopEngines // Also updated and corrected the documentation (latex, doxygen, figures) as // well as the tests and examples. // // Revision 1.12 2004/07/02 16:16:45 anton // Massive renaming in cisstVector for the addition of dynamic size vectors // and matrices. The dynamic vectors are far from ready. // // Revision 1.11 2004/04/02 15:29:50 anton // Removed CISST_EXPORT, the class vctQuaternion is purely templated. // // Revision 1.10 2004/03/19 15:31:03 ofri // Eliminated direct access of the Data container. Use at() instead. // // Revision 1.9 2004/03/16 21:18:44 ofri // Applying changes deriving from updating the interface of cmnTypeTraits // // Revision 1.8 2004/02/18 15:52:44 anton // In method Multiply(ThisType), code used this instead of *this // // Revision 1.7 2004/02/16 19:41:41 anton // For conjugate, negate the 3 imaginary components instead of the imaginary one // // Revision 1.6 2004/02/11 18:39:48 anton // From(vecIm, scalReal) replaced by ConcatenationOf from vctFixedLengthSequenceBase // // Revision 1.5 2004/02/11 15:27:24 anton // Methods Conjugated() and Normalized() are const // // Revision 1.4 2004/02/06 15:31:07 anton // Used ThisType whenever possible, not vctquaternion<_elementType> // Renamed methods MakeXxxx to XxxxSelf (Conjugate) // Added NormalizedSelf, NormalizedOf, IsNormalized methods // // Revision 1.3 2004/01/16 22:53:45 anton // Added constructor from a vector and a value // // Revision 1.2 2004/01/15 15:22:21 anton // Minor documentation updates // // Revision 1.1 2004/01/12 18:54:21 anton // Creation // // // ****************************************************************************