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

« back to all changes in this revision

Viewing changes to src/Mod/Mesh/App/WildMagic4/Wm4TriangleKey.inl

  • 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
//----------------------------------------------------------------------------
 
18
inline TriangleKey::TriangleKey (int iV0, int iV1, int iV2)
 
19
{
 
20
    if (iV0 < iV1)
 
21
    {
 
22
        if (iV0 < iV2)
 
23
        {
 
24
            // v0 is minimum
 
25
            V[0] = iV0;
 
26
            V[1] = iV1;
 
27
            V[2] = iV2;
 
28
        }
 
29
        else
 
30
        {
 
31
            // v2 is minimum
 
32
            V[0] = iV2;
 
33
            V[1] = iV0;
 
34
            V[2] = iV1;
 
35
        }
 
36
    }
 
37
    else
 
38
    {
 
39
        if (iV1 < iV2)
 
40
        {
 
41
            // v1 is minimum
 
42
            V[0] = iV1;
 
43
            V[1] = iV2;
 
44
            V[2] = iV0;
 
45
        }
 
46
        else
 
47
        {
 
48
            // v2 is minimum
 
49
            V[0] = iV2;
 
50
            V[1] = iV0;
 
51
            V[2] = iV1;
 
52
        }
 
53
    }
 
54
}
 
55
//----------------------------------------------------------------------------
 
56
inline bool TriangleKey::operator< (const TriangleKey& rkKey) const
 
57
{
 
58
    if (V[2] < rkKey.V[2])
 
59
    {
 
60
        return true;
 
61
    }
 
62
 
 
63
    if (V[2] > rkKey.V[2])
 
64
    {
 
65
        return false;
 
66
    }
 
67
 
 
68
    if (V[1] < rkKey.V[1])
 
69
    {
 
70
        return true;
 
71
    }
 
72
 
 
73
    if (V[1] > rkKey.V[1])
 
74
    {
 
75
        return false;
 
76
    }
 
77
 
 
78
    return V[0] < rkKey.V[0];
 
79
}
 
80
//----------------------------------------------------------------------------
 
81
inline TriangleKey::operator size_t () const
 
82
{
 
83
    return V[0] | (V[1] << 10) | (V[2] << 20);
 
84
}
 
85
//----------------------------------------------------------------------------