Wm4TriangleKey.inl
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
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             
00027             V[0] = iV0;
00028             V[1] = iV1;
00029             V[2] = iV2;
00030         }
00031         else
00032         {
00033             
00034             V[0] = iV2;
00035             V[1] = iV0;
00036             V[2] = iV1;
00037         }
00038     }
00039     else
00040     {
00041         if (iV1 < iV2)
00042         {
00043             
00044             V[0] = iV1;
00045             V[1] = iV2;
00046             V[2] = iV0;
00047         }
00048         else
00049         {
00050             
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 }