00001
00002 #ifndef vgl_intersection_h_
00003 #define vgl_intersection_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <vgl/vgl_fwd.h>
00020 #include <vgl/vgl_box_2d.h>
00021 #include <vgl/vgl_box_3d.h>
00022 #include <vgl/vgl_point_2d.h>
00023 #include <vgl/vgl_point_3d.h>
00024 #include <vgl/vgl_line_3d_2_points.h>
00025 #include <vgl/vgl_line_segment_3d.h>
00026 #include <vgl/vgl_infinite_line_3d.h>
00027 #include <vcl_vector.h>
00028
00029
00030
00031 template <class T>
00032 inline bool vgl_intersection(vgl_point_2d<T> const& p0,
00033 vgl_point_2d<T> const& p1)
00034 { return p0 == p1; }
00035
00036
00037
00038 template <class T>
00039 inline bool vgl_intersection(vgl_point_3d<T> const& p0,
00040 vgl_point_3d<T> const& p1)
00041 { return p0 == p1; }
00042
00043
00044
00045 template <class T>
00046 bool vgl_intersection(vgl_box_2d<T> const& box,
00047 vgl_line_2d<T> const& line,
00048 vgl_point_2d<T>& p0,
00049 vgl_point_2d<T>& p1);
00050
00051
00052
00053 template <class T>
00054 unsigned vgl_intersection(vgl_box_2d<T> const& box,
00055 vgl_line_segment_2d<T> const& line,
00056 vgl_point_2d<T>& p0,
00057 vgl_point_2d<T>& p1);
00058
00059
00060
00061
00062
00063 template <class T>
00064 vgl_point_3d<T> vgl_intersection(vgl_line_3d_2_points<T> const& l1,
00065 vgl_line_3d_2_points<T> const& l2);
00066
00067
00068
00069
00070 template <class T>
00071 bool vgl_intersection(vgl_line_segment_3d<T> const& l1,
00072 vgl_line_segment_3d<T> const& l2,
00073 vgl_point_3d<T>& i_pnt);
00074
00075
00076
00077
00078 template <class T>
00079 bool vgl_intersection(vgl_line_3d_2_points<T> const& l1,
00080 vgl_line_segment_3d<T> const& l2,
00081 vgl_point_3d<T>& i_pnt);
00082
00083 template <class T> inline
00084 bool vgl_intersection(vgl_line_segment_3d<T> const& l1,
00085 vgl_line_3d_2_points<T> const& l2,
00086 vgl_point_3d<T>& i_pnt)
00087 {
00088 return vgl_intersection(l2, l1, i_pnt);
00089 }
00090
00091
00092
00093 template <class T>
00094 bool vgl_intersection(vgl_infinite_line_3d<T> const& l1,
00095 vgl_infinite_line_3d<T> const& l2,
00096 vgl_point_3d<T>& i_pnt);
00097
00098
00099
00100
00101 template <class T>
00102 bool vgl_intersection(vgl_line_2d<T> const& line0,
00103 vgl_line_2d<T> const& line1,
00104 vgl_point_2d<T> &intersection_point );
00105
00106
00107
00108
00109
00110 template <class T>
00111 vgl_point_3d<T> vgl_intersection(vgl_line_3d_2_points<T> const& line,
00112 vgl_plane_3d<T> const& plane);
00113
00114
00115
00116
00117 template <class T>
00118 bool vgl_intersection(vgl_line_segment_3d<T> const& line,
00119 vgl_plane_3d<T> const& plane,
00120 vgl_point_3d<T> & i_pt);
00121
00122
00123
00124
00125
00126 template <class T>
00127 bool vgl_intersection(vgl_infinite_line_3d<T> const& line,
00128 vgl_plane_3d<T> const& plane,
00129 vgl_point_3d<T> & i_pt);
00130
00131
00132
00133
00134
00135 template <class T>
00136 bool vgl_intersection(vgl_plane_3d<T> const& plane0,
00137 vgl_plane_3d<T> const& plane1,
00138 vgl_line_segment_3d<T> & line){
00139 vgl_infinite_line_3d<T> inf_l;
00140 bool status = vgl_intersection(plane0, plane1, inf_l);
00141 if (status)
00142 line.set(inf_l.point_t(T(0)), inf_l.point_t(T(1)));
00143 return status;
00144 }
00145
00146 template <class T>
00147 bool vgl_intersection(vgl_plane_3d<T> const& plane0,
00148 vgl_plane_3d<T> const& plane1,
00149 vgl_line_3d_2_points<T> & line){
00150 vgl_infinite_line_3d<T> inf_l;
00151 bool status = vgl_intersection(plane0, plane1, inf_l);
00152 if (status)
00153 line.set(inf_l.point_t(T(0)), inf_l.point_t(T(1)));
00154 return status;
00155 }
00156
00157 template <class T>
00158 bool vgl_intersection(vgl_plane_3d<T> const& plane0,
00159 vgl_plane_3d<T> const& plane1,
00160 vgl_infinite_line_3d<T> & line);
00161
00162
00163
00164 template <class T>
00165 vgl_point_3d<T> vgl_intersection(vgl_plane_3d<T> const& p1,
00166 vgl_plane_3d<T> const& p2,
00167 vgl_plane_3d<T> const& p3);
00168
00169
00170
00171
00172
00173
00174 template <class T>
00175 bool vgl_intersection(vgl_point_2d<T> const& p1,
00176 vgl_point_2d<T> const& p2,
00177 vgl_point_2d<T> const& q1,
00178 vgl_point_2d<T> const& q2,
00179 double tol = 1e-6);
00180
00181
00182
00183
00184 template <class T>
00185 inline bool vgl_intersection(vgl_box_2d<T> const& b, vgl_point_2d<T> const& p)
00186 { return b.contains(p); }
00187
00188
00189
00190
00191 template <class T>
00192 inline bool vgl_intersection(vgl_point_2d<T> const& p, vgl_box_2d<T> const& b)
00193 { return b.contains(p); }
00194
00195
00196
00197
00198 template <class T>
00199 inline bool vgl_intersection(vgl_box_3d<T> const& b, vgl_point_3d<T> const& p)
00200 { return b.contains(p); }
00201
00202
00203
00204
00205 template <class T>
00206 inline bool vgl_intersection(vgl_point_3d<T> const& p, vgl_box_3d<T> const& b)
00207 { return b.contains(p); }
00208
00209
00210
00211 template <class T>
00212 bool vgl_intersection(vgl_box_3d<T> const& box,
00213 vgl_infinite_line_3d<T> const& line,
00214 vgl_point_3d<T>& p0,
00215 vgl_point_3d<T>& p1);
00216
00217
00218
00219
00220 template <class T>
00221 bool vgl_intersection(vgl_box_3d<T> const& b, vgl_plane_3d<T> const& plane);
00222
00223
00224
00225
00226 template <class T>
00227 vgl_box_2d<T> vgl_intersection(vgl_box_2d<T> const&,vgl_box_2d<T> const&);
00228
00229
00230
00231 template <class T>
00232 vgl_box_3d<T> vgl_intersection(vgl_box_3d<T> const&,vgl_box_3d<T> const&);
00233
00234
00235
00236
00237 template <class T>
00238 bool vgl_intersection(vgl_box_2d<T> const& b, vgl_polygon<T> const& poly);
00239
00240
00241
00242
00243 template <class T>
00244 vcl_vector<vgl_point_2d<T> > vgl_intersection(vgl_box_2d<T> const& b, vcl_vector<vgl_point_2d<T> > const& p);
00245
00246
00247
00248
00249 template <class T>
00250 vcl_vector<vgl_point_2d<T> > vgl_intersection(vcl_vector<vgl_point_2d<T> > const& p, vgl_box_2d<T> const& b);
00251
00252
00253
00254
00255 template <class T>
00256 vcl_vector<vgl_point_3d<T> > vgl_intersection(vgl_box_3d<T> const& b, vcl_vector<vgl_point_3d<T> > const& p);
00257
00258
00259
00260
00261 template <class T>
00262 vcl_vector<vgl_point_3d<T> > vgl_intersection(vcl_vector<vgl_point_3d<T> > const& p, vgl_box_3d<T> const& b);
00263
00264
00265 #define VGL_INTERSECTION_INSTANTIATE(T) extern "please include vgl/vgl_intersection.txx first"
00266 #define VGL_INTERSECTION_BOX_INSTANTIATE(T) extern "please include vgl/vgl_intersection.txx first"
00267
00268 #endif // vgl_intersection_h_