contrib/brl/bbas/bvgl/bvgl_point_3d_cmp.h
Go to the documentation of this file.
00001 // This is brl/bbas/bvgl/bvgl_point_3d_cmp.h
00002 #ifndef bvgl_point_3d_cmp_h
00003 #define bvgl_point_3d_cmp_h
00004 //:
00005 // \file
00006 // \brief A class that implements the dbrec3d_part concept for composite parts (i.e non-leafs).
00007 // \author Isabel Restrepo mir@lems.brown.edu
00008 // \date  27-Jul-2010.
00009 //
00010 // \verbatim
00011 //  Modifications
00012 //   <none yet>
00013 // \endverbatim
00014 
00015 #include <vgl/vgl_point_3d.h>
00016 #include <vcl_functional.h>
00017 
00018 //: A comparison functor for vgl_point_3d's. Needed to create a vcl_set of vgl_point_3d<int>'s.
00019 template <class T>
00020 class bvgl_point_3d_cmp : public vcl_binary_function<vgl_point_3d<T>, vgl_point_3d<T>, bool>
00021 {
00022  public:
00023   bvgl_point_3d_cmp() {}
00024 
00025   bool operator()(vgl_point_3d<T> const& v0, vgl_point_3d<T> const& v1) const
00026   {
00027     if (v0.z() != v1.z())
00028       return v0.z() < v1.z();
00029     else if (v0.y() != v1.y())
00030       return v0.y() < v1.y();
00031     else
00032       return v0.x() < v1.x();
00033   }
00034 };
00035 
00036 #endif