core/vgl/vgl_homg.h
Go to the documentation of this file.
00001 // This is core/vgl/vgl_homg.h
00002 #ifndef vgl_homg_h_
00003 #define vgl_homg_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief General purpose support class for vgl_homg_ classes
00010 //
00011 // This is the private base class for homogeneous vectors.  It provides the
00012 // get/set interface, and also a static variable vgl_homg::infinity which is used
00013 // throughout when returning infinite nonhomogeneous values.
00014 //
00015 // \author
00016 //             Paul Beardsley, 29.03.96
00017 //             Oxford University, UK
00018 //
00019 // \verbatim
00020 //  Modifications
00021 //   210297 AWF Switched to fixed-length vectors for speed.
00022 //   23 Oct 2001 - Peter Vanroose - made templated and ported to vgl
00023 // \endverbatim
00024 //
00025 //-------------------------------------------------------------------------------
00026 
00027 #include <vcl_compiler.h>
00028 
00029 //: General purpose support class for vgl_homg_ classes
00030 template <class T>
00031 class vgl_homg
00032 {
00033  public:
00034 
00035 //: Standard placeholder for methods that wish to return infinity.
00036   static T infinity;
00037 
00038 //: Standard way to test whether a number is indeed infinite.
00039   static bool is_infinity(T v) { return v == infinity; }
00040 
00041 //: The tolerance used in "near zero" tests in the vgl_homg subclasses.
00042   static T infinitesimal_tol;
00043 
00044 //: Static method to set the default tolerance used for infinitesimal checks.
00045 // The default is 1e-12.
00046   static void set_infinitesimal_tol(T tol);
00047 };
00048 
00049 #endif // vgl_homg_h_