• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Comparitors.h

Go to the documentation of this file.
00001 // GMTL is (C) Copyright 2001-2010 by Allen Bierbaum
00002 // Distributed under the GNU Lesser General Public License 2.1 with an
00003 // addendum covering inlined code. (See accompanying files LICENSE and
00004 // LICENSE.addendum or http://www.gnu.org/copyleft/lesser.txt)
00005 
00006 #ifndef _GMTL_COMPARITORS_H_
00007 #define _GMTL_COMPARITORS_H_
00008 
00009 // This file contains helper comparitors
00010 //
00011 // They can be used as comparison functors for STL container
00012 // operations (or for anything else you may want to use them for...)
00013 //
00014 
00015 #include <gmtl/Vec3.h>
00016 #include <gmtl/Point3.h>
00017 
00018 namespace gmtl
00019 {
00020    // Allows for the comparison of projected point distances
00021    // onto a given vector
00022    struct CompareIndexPointProjections
00023    {
00024    public:
00025       CompareIndexPointProjections() : points(NULL)
00026       {;}
00027 
00028       bool operator()(const unsigned x, const unsigned y)
00029       {
00030          float xVal = sortDir.dot((*points)[x]);
00031          float yVal = sortDir.dot((*points)[y]);
00032 
00033          return (xVal < yVal);
00034       }
00035 
00036       const std::vector<Point3>* points;
00037       gmtl::Vec3                 sortDir;       // Direction to sort by
00038    };
00039 };
00040 
00041 #endif
00042 

Generated on Sun Sep 19 2010 14:35:14 for GenericMathTemplateLibrary by  doxygen 1.7.1