~ubuntu-branches/ubuntu/maverick/freecad/maverick

« back to all changes in this revision

Viewing changes to src/Mod/Mesh/App/WildMagic4/Wm4RVector3.h

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-07-16 18:37:41 UTC
  • Revision ID: james.westby@ubuntu.com-20090716183741-oww9kcxqrk991i1n
Tags: upstream-0.8.2237
ImportĀ upstreamĀ versionĀ 0.8.2237

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Wild Magic Source Code
 
2
// David Eberly
 
3
// http://www.geometrictools.com
 
4
// Copyright (c) 1998-2007
 
5
//
 
6
// This library is free software; you can redistribute it and/or modify it
 
7
// under the terms of the GNU Lesser General Public License as published by
 
8
// the Free Software Foundation; either version 2.1 of the License, or (at
 
9
// your option) any later version.  The license is available for reading at
 
10
// either of the locations:
 
11
//     http://www.gnu.org/copyleft/lgpl.html
 
12
//     http://www.geometrictools.com/License/WildMagicLicense.pdf
 
13
// The license applies to versions 0 through 4 of Wild Magic.
 
14
//
 
15
// Version: 4.0.0 (2006/06/28)
 
16
 
 
17
#ifndef WM4RVECTOR3_H
 
18
#define WM4RVECTOR3_H
 
19
 
 
20
#include "Wm4FoundationLIB.h"
 
21
#include "Wm4TRVector.h"
 
22
 
 
23
namespace Wm4
 
24
{
 
25
 
 
26
template <int ISIZE>
 
27
class RVector3 : public TRVector<3,ISIZE>
 
28
{
 
29
public:
 
30
    // construction
 
31
    RVector3 ();
 
32
    RVector3 (const RVector3& rkV);
 
33
 
 
34
#ifdef WM4_USING_VC70
 
35
    RVector3 (const TRVector<3,ISIZE>& rkV)
 
36
    {
 
37
        // The inline body is here because of an apparent MSVC++ .NET 2002
 
38
        // compiler bug.  If placed in the *.inl file, the compiler complains:
 
39
        //
 
40
        //   error C2244: 'Wm4::RVector3<>::__ctor' : unable to match function
 
41
        //       definition to an existing declaration
 
42
        //   definition
 
43
        //       'Wm4::RVector3<>::RVector3(const Wm4::TRVector<3,> &)'
 
44
        //   existing declarations
 
45
        //       'Wm4::RVector3<>::RVector3(const Wm4::TRational<> &,
 
46
        //                                  const Wm4::TRational<> &)'
 
47
        //       'Wm4::RVector3<>::RVector3(const Wm4::TRVector<3,> &)'
 
48
        //       'Wm4::RVector3<>::RVector3(const Wm4::RVector3<> &)'
 
49
        //       'Wm4::RVector3<>::RVector3(void)'
 
50
        // The "definition" is in the "existing declarations" list, so I do
 
51
        // not know what the compiler is complaining about.
 
52
 
 
53
        m_akTuple[0] = rkV[0];
 
54
        m_akTuple[1] = rkV[1];
 
55
        m_akTuple[2] = rkV[2];
 
56
    }
 
57
#else
 
58
    RVector3 (const TRVector<3,ISIZE>& rkV);
 
59
#endif
 
60
 
 
61
    RVector3 (const TRational<ISIZE>& rkX, const TRational<ISIZE>& rkY,
 
62
        const TRational<ISIZE>& rkZ);
 
63
 
 
64
    // member access
 
65
    TRational<ISIZE> X () const;
 
66
    TRational<ISIZE>& X ();
 
67
    TRational<ISIZE> Y () const;
 
68
    TRational<ISIZE>& Y ();
 
69
    TRational<ISIZE> Z () const;
 
70
    TRational<ISIZE>& Z ();
 
71
 
 
72
    // assignment
 
73
    RVector3& operator= (const RVector3& rkV);
 
74
 
 
75
#ifdef WM4_USING_VC70
 
76
    RVector3& operator= (const TRVector<3,ISIZE>& rkV)
 
77
    {
 
78
        // The inline body is here because of an apparent MSVC++ .NET 2002
 
79
        // compiler bug.  If placed in the *.inl file, the compiler complains:
 
80
        //
 
81
        //   error C2244: 'Wm4::RVector3<>::operator`='' : unable to match
 
82
        //       function definition to an existing declaration
 
83
        //   definition
 
84
        //       'Wm4::RVector3<> &Wm4::RVector3<>::operator =(
 
85
        //            const Wm4::TRVector<3,> &)'
 
86
        //   existing declarations
 
87
        //       'Wm4::RVector3<> &Wm4::RVector3<>::operator =(
 
88
        //            const Wm4::TRVector<3,> &)'
 
89
        //       'Wm4::RVector3<> &Wm4::RVector3<>::operator =(
 
90
        //            const Wm4::RVector3<> &)'
 
91
 
 
92
        m_akTuple[0] = rkV[0];
 
93
        m_akTuple[1] = rkV[1];
 
94
        m_akTuple[2] = rkV[2];
 
95
        return *this;
 
96
    }
 
97
#else
 
98
    RVector3& operator= (const TRVector<3,ISIZE>& rkV);
 
99
#endif
 
100
 
 
101
    // returns Dot(this,V)
 
102
    TRational<ISIZE> Dot (const RVector3& rkV) const;
 
103
 
 
104
    // returns Cross(this,V)
 
105
    RVector3 Cross (const RVector3& rkV) const;
 
106
 
 
107
    // returns Dot(this,Cross(U,V))
 
108
    TRational<ISIZE> TripleScalar (const RVector3& rkU, const RVector3& rkV)
 
109
        const;
 
110
 
 
111
protected:
 
112
    using TRVector<3,ISIZE>::m_akTuple;
 
113
};
 
114
 
 
115
#include "Wm4RVector3.inl"
 
116
 
 
117
}
 
118
 
 
119
#endif