Wm4TriangleKey.inl

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 namespace Wm4
00018 {
00019 //----------------------------------------------------------------------------
00020 inline TriangleKey::TriangleKey (int iV0, int iV1, int iV2)
00021 {
00022     if (iV0 < iV1)
00023     {
00024         if (iV0 < iV2)
00025         {
00026             // v0 is minimum
00027             V[0] = iV0;
00028             V[1] = iV1;
00029             V[2] = iV2;
00030         }
00031         else
00032         {
00033             // v2 is minimum
00034             V[0] = iV2;
00035             V[1] = iV0;
00036             V[2] = iV1;
00037         }
00038     }
00039     else
00040     {
00041         if (iV1 < iV2)
00042         {
00043             // v1 is minimum
00044             V[0] = iV1;
00045             V[1] = iV2;
00046             V[2] = iV0;
00047         }
00048         else
00049         {
00050             // v2 is minimum
00051             V[0] = iV2;
00052             V[1] = iV0;
00053             V[2] = iV1;
00054         }
00055     }
00056 }
00057 //----------------------------------------------------------------------------
00058 inline bool TriangleKey::operator< (const TriangleKey& rkKey) const
00059 {
00060     if (V[2] < rkKey.V[2])
00061     {
00062         return true;
00063     }
00064 
00065     if (V[2] > rkKey.V[2])
00066     {
00067         return false;
00068     }
00069 
00070     if (V[1] < rkKey.V[1])
00071     {
00072         return true;
00073     }
00074 
00075     if (V[1] > rkKey.V[1])
00076     {
00077         return false;
00078     }
00079 
00080     return V[0] < rkKey.V[0];
00081 }
00082 //----------------------------------------------------------------------------
00083 inline TriangleKey::operator size_t () const
00084 {
00085     return V[0] | (V[1] << 10) | (V[2] << 20);
00086 }
00087 //----------------------------------------------------------------------------
00088 } //namespace Wm4

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