1 // This is core/vgl/algo/vgl_intersection.h 2 #ifndef vgl_algo_intersection_h_ 3 #define vgl_algo_intersection_h_ 4 //: 5 // \file 6 // \brief Set of intersection functions 7 // \author Jan 25, 2007 Gamze Tunali 8 // 9 // This file aims to gather all the intersection methods on vgl classes 10 // at one place. Some of the functions moved from their own class 11 // files to here or interface methods created for non-homogeneous versions 12 // of the ones that are already defined in vgl/algo/vgl_homg_operators_3d 13 // 14 // \verbatim 15 // Modifications 16 // 23 Jul 2009 - Gamze Tunali - added a 3D box-polygon intersection method 17 // 18 // 01 Mar 2007 - Gamze Tunali - split up into vgl/algo and vgl parts 19 // \endverbatim 20 21 #include <vector> 22 #include <list> 23 #include <vgl/vgl_fwd.h> // forward declare various vgl classes 24 #include <vnl/vnl_matrix.h> 25 #ifdef _MSC_VER 26 # include <vcl_msvc_warnings.h> 27 #endif 28 29 //: Return the intersection point of vector of planes. 30 // \relatesalso vgl_plane_3d 31 template <class T> 32 vgl_point_3d<T> vgl_intersection(const std::vector<vgl_plane_3d<T> >& p); 33 34 //: Return the intersection line of a set of planes, use list to distinguish from point return 35 // \relatesalso vgl_plane_3d 36 // \relatesalso vgl_infinite_line_3d 37 template <class T> 38 vgl_infinite_line_3d<T> 39 vgl_intersection(const std::list<vgl_plane_3d<T> >& planes); 40 41 //: Return the intersection line of a set of weighted planes, use list to distinguish from point return 42 // \relatesalso vgl_plane_3d 43 // \relatesalso vgl_infinite_line_3d 44 45 template <class T> 46 bool 47 vgl_intersection(const std::list<vgl_plane_3d<T> >& planes, std::vector<T> ws, vgl_infinite_line_3d<T>& line, T & residual); 48 49 //: Return true if the box and polygon intersect in 3-d, regions include boundaries 50 // Polygon is represented as an ordered vector of 3-d points 51 // \relatesalso vgl_point_3d 52 // \relatesalso vgl_box_3d 53 template <class T> 54 bool vgl_intersection(vgl_box_3d<T> const& b, std::list<vgl_point_3d<T> >& p); 55 56 //: Return true if a set of rays produce a well-conditioned solution for their intersection 57 // The intersection algorithm finds the 3D point that produces the smallest sum of squared 58 // orthogonal distances to each ray. 59 template <class T> 60 bool vgl_intersection(std::vector<vgl_ray_3d<T> > const& rays, vgl_point_3d<T>& inter_pt); 61 62 //: Return true if a set of rays produce a well-conditioned solution for their intersection 63 // Weight each ray according to a covariance matrix the 2-d orthogonal ray displacement vector, 64 // since a displacement along a ray does not affect the intersection point. It follows that for n rays, 65 // the covariance matrix is a 2n x 2n matrix. The coordinate system for the 2-d displacement vector 66 // is defined by the vgl_plane_3d<T>::plane_coord_vectors(vgl_vector_3d<T>& uvec, vgl_vector_3d<T>& vvec) 67 // method. 68 // 69 template <class T> 70 bool vgl_intersection(std::vector<vgl_ray_3d<T> > const& rays, vnl_matrix<T> const& covar, vgl_point_3d<T>& inter_pt); 71 72 #define VGL_ALGO_INTERSECTION_INSTANTIATE(T) extern "please include vgl/algo/vgl_intersection.hxx first" 73 74 #endif // vgl_algo_intersection_h_ 75