Wm4RVector3.h

Go to the documentation of this file.
00001 // Wild Magic Source Code
00002 // David Eberly
00003 // http://www.geometrictools.com
00004 // Copyright (c) 1998-2007
00005 //
00006 // This library is free software; you can redistribute it and/or modify it
00007 // under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation; either version 2.1 of the License, or (at
00009 // your option) any later version.  The license is available for reading at
00010 // either of the locations:
00011 //     http://www.gnu.org/copyleft/lgpl.html
00012 //     http://www.geometrictools.com/License/WildMagicLicense.pdf
00013 // The license applies to versions 0 through 4 of Wild Magic.
00014 //
00015 // Version: 4.0.0 (2006/06/28)
00016 
00017 #ifndef WM4RVECTOR3_H
00018 #define WM4RVECTOR3_H
00019 
00020 #include "Wm4FoundationLIB.h"
00021 #include "Wm4TRVector.h"
00022 
00023 namespace Wm4
00024 {
00025 
00026 template <int ISIZE>
00027 class RVector3 : public TRVector<3,ISIZE>
00028 {
00029 public:
00030     // construction
00031     RVector3 ();
00032     RVector3 (const RVector3& rkV);
00033 
00034 #ifdef WM4_USING_VC70
00035     RVector3 (const TRVector<3,ISIZE>& rkV)
00036     {
00037         // The inline body is here because of an apparent MSVC++ .NET 2002
00038         // compiler bug.  If placed in the *.inl file, the compiler complains:
00039         //
00040         //   error C2244: 'Wm4::RVector3<>::__ctor' : unable to match function
00041         //       definition to an existing declaration
00042         //   definition
00043         //       'Wm4::RVector3<>::RVector3(const Wm4::TRVector<3,> &)'
00044         //   existing declarations
00045         //       'Wm4::RVector3<>::RVector3(const Wm4::TRational<> &,
00046         //                                  const Wm4::TRational<> &)'
00047         //       'Wm4::RVector3<>::RVector3(const Wm4::TRVector<3,> &)'
00048         //       'Wm4::RVector3<>::RVector3(const Wm4::RVector3<> &)'
00049         //       'Wm4::RVector3<>::RVector3(void)'
00050         // The "definition" is in the "existing declarations" list, so I do
00051         // not know what the compiler is complaining about.
00052 
00053         m_akTuple[0] = rkV[0];
00054         m_akTuple[1] = rkV[1];
00055         m_akTuple[2] = rkV[2];
00056     }
00057 #else
00058     RVector3 (const TRVector<3,ISIZE>& rkV);
00059 #endif
00060 
00061     RVector3 (const TRational<ISIZE>& rkX, const TRational<ISIZE>& rkY,
00062         const TRational<ISIZE>& rkZ);
00063 
00064     // member access
00065     TRational<ISIZE> X () const;
00066     TRational<ISIZE>& X ();
00067     TRational<ISIZE> Y () const;
00068     TRational<ISIZE>& Y ();
00069     TRational<ISIZE> Z () const;
00070     TRational<ISIZE>& Z ();
00071 
00072     // assignment
00073     RVector3& operator= (const RVector3& rkV);
00074 
00075 #ifdef WM4_USING_VC70
00076     RVector3& operator= (const TRVector<3,ISIZE>& rkV)
00077     {
00078         // The inline body is here because of an apparent MSVC++ .NET 2002
00079         // compiler bug.  If placed in the *.inl file, the compiler complains:
00080         //
00081         //   error C2244: 'Wm4::RVector3<>::operator`='' : unable to match
00082         //       function definition to an existing declaration
00083         //   definition
00084         //       'Wm4::RVector3<> &Wm4::RVector3<>::operator =(
00085         //            const Wm4::TRVector<3,> &)'
00086         //   existing declarations
00087         //       'Wm4::RVector3<> &Wm4::RVector3<>::operator =(
00088         //            const Wm4::TRVector<3,> &)'
00089         //       'Wm4::RVector3<> &Wm4::RVector3<>::operator =(
00090         //            const Wm4::RVector3<> &)'
00091 
00092         m_akTuple[0] = rkV[0];
00093         m_akTuple[1] = rkV[1];
00094         m_akTuple[2] = rkV[2];
00095         return *this;
00096     }
00097 #else
00098     RVector3& operator= (const TRVector<3,ISIZE>& rkV);
00099 #endif
00100 
00101     // returns Dot(this,V)
00102     TRational<ISIZE> Dot (const RVector3& rkV) const;
00103 
00104     // returns Cross(this,V)
00105     RVector3 Cross (const RVector3& rkV) const;
00106 
00107     // returns Dot(this,Cross(U,V))
00108     TRational<ISIZE> TripleScalar (const RVector3& rkU, const RVector3& rkV)
00109         const;
00110 
00111 protected:
00112     using TRVector<3,ISIZE>::m_akTuple;
00113 };
00114 
00115 }
00116 
00117 #include "Wm4RVector3.inl"
00118 
00119 
00120 #endif

Generated on Wed Nov 23 19:01:08 2011 for FreeCAD by  doxygen 1.6.1