Defines | Functions
core/vgl/vgl_intersection.h File Reference

Set of intersection functions. More...

#include <vgl/vgl_fwd.h>
#include <vgl/vgl_box_2d.h>
#include <vgl/vgl_box_3d.h>
#include <vgl/vgl_point_2d.h>
#include <vgl/vgl_point_3d.h>
#include <vgl/vgl_line_3d_2_points.h>
#include <vgl/vgl_line_segment_3d.h>
#include <vgl/vgl_infinite_line_3d.h>
#include <vcl_vector.h>

Go to the source code of this file.

Defines

#define VGL_INTERSECTION_INSTANTIATE(T)   extern "please include vgl/vgl_intersection.txx first"
#define VGL_INTERSECTION_BOX_INSTANTIATE(T)   extern "please include vgl/vgl_intersection.txx first"

Functions

template<class T >
bool vgl_intersection (vgl_point_2d< T > const &p0, vgl_point_2d< T > const &p1)
 Return true if the two points intersect, i.e., coincide.
template<class T >
bool vgl_intersection (vgl_point_3d< T > const &p0, vgl_point_3d< T > const &p1)
 Return true if the two points intersect, i.e., coincide.
template<class T >
bool vgl_intersection (vgl_box_2d< T > const &box, vgl_line_2d< T > const &line, vgl_point_2d< T > &p0, vgl_point_2d< T > &p1)
 Return true if line intersects box. If so, compute intersection points.
template<class T >
unsigned vgl_intersection (vgl_box_2d< T > const &box, vgl_line_segment_2d< T > const &line, vgl_point_2d< T > &p0, vgl_point_2d< T > &p1)
 Returns the number of intersections of a line segment with a box, up to two are returned in p0 and p1.
template<class T >
vgl_point_3d< T > vgl_intersection (vgl_line_3d_2_points< T > const &l1, vgl_line_3d_2_points< T > const &l2)
 Return the intersection point of two concurrent lines.
template<class T >
bool vgl_intersection (vgl_line_segment_3d< T > const &l1, vgl_line_segment_3d< T > const &l2, vgl_point_3d< T > &i_pnt)
 Return the intersection point of segments of two concurrent lines. Returns false if the intersection point is not inside both line segments.
template<class T >
bool vgl_intersection (vgl_line_3d_2_points< T > const &l1, vgl_line_segment_3d< T > const &l2, vgl_point_3d< T > &i_pnt)
 Return the intersection point of segments of a concurrent line and line segment pair. Returns false if the intersection point is not inside both line segments.
template<class T >
bool vgl_intersection (vgl_line_segment_3d< T > const &l1, vgl_line_3d_2_points< T > const &l2, vgl_point_3d< T > &i_pnt)
template<class T >
bool vgl_intersection (vgl_infinite_line_3d< T > const &l1, vgl_infinite_line_3d< T > const &l2, vgl_point_3d< T > &i_pnt)
 Return the intersection point of infinite lines, if concurrent.
template<class T >
bool vgl_intersection (vgl_ray_3d< T > const &r1, vgl_ray_3d< T > const &r2, vgl_point_3d< T > &i_pnt)
 Return the intersection point of rays. Returns false if rays are parallel or intersect outside of positive ray domain.
template<class T >
bool vgl_intersection (vgl_line_2d< T > const &line0, vgl_line_2d< T > const &line1, vgl_point_2d< T > &intersection_point)
 Return the intersection point of two lines. Return false if lines are parallel.
template<class T >
vgl_point_3d< T > vgl_intersection (vgl_line_3d_2_points< T > const &line, vgl_plane_3d< T > const &plane)
 Return the intersection point of a line and a plane.
template<class T >
bool vgl_intersection (vgl_line_segment_3d< T > const &line, vgl_plane_3d< T > const &plane, vgl_point_3d< T > &i_pt)
 Return the intersection point of a line and a plane.
template<class T >
bool vgl_intersection (vgl_infinite_line_3d< T > const &line, vgl_plane_3d< T > const &plane, vgl_point_3d< T > &i_pt)
 Return the intersection point of a line and a plane.
template<class T >
bool vgl_intersection (vgl_ray_3d< T > const &ray, vgl_plane_3d< T > const &plane, vgl_point_3d< T > &i_pt)
 Return the intersection point of a ray and a plane.
template<class T >
bool vgl_intersection (vgl_plane_3d< T > const &plane0, vgl_plane_3d< T > const &plane1, vgl_line_segment_3d< T > &line)
 Return the intersection line of two planes.
template<class T >
bool vgl_intersection (vgl_plane_3d< T > const &plane0, vgl_plane_3d< T > const &plane1, vgl_line_3d_2_points< T > &line)
template<class T >
bool vgl_intersection (vgl_plane_3d< T > const &plane0, vgl_plane_3d< T > const &plane1, vgl_infinite_line_3d< T > &line)
 Return the intersection line of two planes. Returns false if planes.
template<class T >
vgl_point_3d< T > vgl_intersection (vgl_plane_3d< T > const &p1, vgl_plane_3d< T > const &p2, vgl_plane_3d< T > const &p3)
 Return the intersection point of three planes.
template<class T >
bool vgl_intersection (vgl_point_2d< T > const &p1, vgl_point_2d< T > const &p2, vgl_point_2d< T > const &q1, vgl_point_2d< T > const &q2, double tol=1e-6)
 Return true if any point on [p1,p2] is within tol of [q1,q2].
template<class T >
bool vgl_intersection (vgl_box_2d< T > const &b, vgl_point_2d< T > const &p)
 Return true if the point lies inside the box.
template<class T >
bool vgl_intersection (vgl_point_2d< T > const &p, vgl_box_2d< T > const &b)
 Return true if the point lies inside the box.
template<class T >
bool vgl_intersection (vgl_box_3d< T > const &b, vgl_point_3d< T > const &p)
 Return true if the point lies inside the box.
template<class T >
bool vgl_intersection (vgl_point_3d< T > const &p, vgl_box_3d< T > const &b)
 Return true if the point lies inside the box.
template<class T >
bool vgl_intersection (vgl_box_3d< T > const &box, vgl_infinite_line_3d< T > const &line, vgl_point_3d< T > &p0, vgl_point_3d< T > &p1)
 Return true if line intersects box. If so, compute intersection points.
template<class T >
bool vgl_intersection (vgl_box_3d< T > const &box, vgl_ray_3d< T > const &ray, vgl_point_3d< T > &p0, vgl_point_3d< T > &p1)
 Return true if ray intersects box. If so, compute intersection points.
template<class T >
bool vgl_intersection (vgl_box_3d< T > const &b, vgl_plane_3d< T > const &plane)
 Return true if a box and plane intersect in 3D.
template<class T >
vgl_box_2d< T > vgl_intersection (vgl_box_2d< T > const &, vgl_box_2d< T > const &)
 Return the intersection of two boxes (which is itself either a box, or empty).
template<class T >
vgl_box_3d< T > vgl_intersection (vgl_box_3d< T > const &, vgl_box_3d< T > const &)
 Return the intersection of two boxes (which is itself either a box, or empty).
template<class T >
bool vgl_intersection (vgl_box_2d< T > const &b, vgl_polygon< T > const &poly)
 Return true if the box and polygon regions intersect, regions include boundaries.
template<class T >
vcl_vector< vgl_point_2d< T > > vgl_intersection (vgl_box_2d< T > const &b, vcl_vector< vgl_point_2d< T > > const &p)
 Return the points from the list that lie inside the box.
template<class T >
vcl_vector< vgl_point_2d< T > > vgl_intersection (vcl_vector< vgl_point_2d< T > > const &p, vgl_box_2d< T > const &b)
 Return the points from the list that lie inside the box.
template<class T >
vcl_vector< vgl_point_3d< T > > vgl_intersection (vgl_box_3d< T > const &b, vcl_vector< vgl_point_3d< T > > const &p)
 Return the points from the list that lie inside the box.
template<class T >
vcl_vector< vgl_point_3d< T > > vgl_intersection (vcl_vector< vgl_point_3d< T > > const &p, vgl_box_3d< T > const &b)
 Return the points from the list that lie inside the box.
template<class T >
vcl_vector< vgl_point_2d< T > > vgl_intersection (vgl_polygon< T > const &poly, vgl_line_2d< T > const &line)
 Find the intersections of a line with a polygon( can have multiple sheets).
template<class T >
vcl_vector< vgl_point_2d< T > > vgl_intersection (vgl_line_2d< T > const &line, vgl_polygon< T > const &poly)

Detailed Description

Set of intersection functions.

Author:
Jan 25, 2007 Gamze Tunali

For intersections of "homogeneous coordinates" objects like vgl_homg_line_2d<T>, see the static methods of vgl/algo/vgl_homg_operators_2d<T> and _3d.

    Modifications
     01 Mar 2007 - Gamze Tunali - split up into vgl/algo and vgl parts
     21 Jul 2009 - Peter Vanroose - added box intersection (2d and 3d)
     21 Jul 2009 - Peter Vanroose - added inlined point intersection functions
   

Definition in file vgl_intersection.h.


Define Documentation

#define VGL_INTERSECTION_BOX_INSTANTIATE (   T)    extern "please include vgl/vgl_intersection.txx first"

Definition at line 297 of file vgl_intersection.h.

#define VGL_INTERSECTION_INSTANTIATE (   T)    extern "please include vgl/vgl_intersection.txx first"

Definition at line 296 of file vgl_intersection.h.


Function Documentation

template<class T >
bool vgl_intersection ( vgl_point_2d< T > const &  p0,
vgl_point_2d< T > const &  p1 
) [inline]

Return true if the two points intersect, i.e., coincide.

Definition at line 32 of file vgl_intersection.h.

template<class T >
bool vgl_intersection ( vgl_point_3d< T > const &  p0,
vgl_point_3d< T > const &  p1 
) [inline]

Return true if the two points intersect, i.e., coincide.

Definition at line 39 of file vgl_intersection.h.

template<class T >
bool vgl_intersection ( vgl_box_2d< T > const &  box,
vgl_line_2d< T > const &  line,
vgl_point_2d< T > &  p0,
vgl_point_2d< T > &  p1 
)

Return true if line intersects box. If so, compute intersection points.

template<class T >
unsigned vgl_intersection ( vgl_box_2d< T > const &  box,
vgl_line_segment_2d< T > const &  line,
vgl_point_2d< T > &  p0,
vgl_point_2d< T > &  p1 
)

Returns the number of intersections of a line segment with a box, up to two are returned in p0 and p1.

template<class T >
vgl_point_3d< T > vgl_intersection ( vgl_line_3d_2_points< T > const &  l1,
vgl_line_3d_2_points< T > const &  l2 
)

Return the intersection point of two concurrent lines.

Allows intersection points outside the line segments Throws an assertion if lines not concurrent

Definition at line 451 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_line_segment_3d< T > const &  l1,
vgl_line_segment_3d< T > const &  l2,
vgl_point_3d< T > &  i_pnt 
)

Return the intersection point of segments of two concurrent lines. Returns false if the intersection point is not inside both line segments.

Return the intersection point of segments of two concurrent lines.

Definition at line 474 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_line_3d_2_points< T > const &  l1,
vgl_line_segment_3d< T > const &  l2,
vgl_point_3d< T > &  i_pnt 
)

Return the intersection point of segments of a concurrent line and line segment pair. Returns false if the intersection point is not inside both line segments.

Return the intersection point of segments of two concurrent lines.

Definition at line 495 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_line_segment_3d< T > const &  l1,
vgl_line_3d_2_points< T > const &  l2,
vgl_point_3d< T > &  i_pnt 
) [inline]

Definition at line 84 of file vgl_intersection.h.

template<class T >
bool vgl_intersection ( vgl_infinite_line_3d< T > const &  l1,
vgl_infinite_line_3d< T > const &  l2,
vgl_point_3d< T > &  i_pnt 
)

Return the intersection point of infinite lines, if concurrent.

Return the intersection point of two lines, if concurrent.

Definition at line 515 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_ray_3d< T > const &  r1,
vgl_ray_3d< T > const &  r2,
vgl_point_3d< T > &  i_pnt 
)

Return the intersection point of rays. Returns false if rays are parallel or intersect outside of positive ray domain.

Definition at line 528 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_line_2d< T > const &  line0,
vgl_line_2d< T > const &  line1,
vgl_point_2d< T > &  intersection_point 
)

Return the intersection point of two lines. Return false if lines are parallel.

Definition at line 701 of file vgl_intersection.txx.

template<class T >
vgl_point_3d< T > vgl_intersection ( vgl_line_3d_2_points< T > const &  line,
vgl_plane_3d< T > const &  plane 
)

Return the intersection point of a line and a plane.

Definition at line 544 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_line_segment_3d< T > const &  line,
vgl_plane_3d< T > const &  plane,
vgl_point_3d< T > &  i_pt 
)

Return the intersection point of a line and a plane.

Definition at line 584 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_infinite_line_3d< T > const &  line,
vgl_plane_3d< T > const &  plane,
vgl_point_3d< T > &  i_pt 
)

Return the intersection point of a line and a plane.

Definition at line 624 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_ray_3d< T > const &  ray,
vgl_plane_3d< T > const &  plane,
vgl_point_3d< T > &  i_pt 
)

Return the intersection point of a ray and a plane.

Definition at line 662 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_plane_3d< T > const &  plane0,
vgl_plane_3d< T > const &  plane1,
vgl_line_segment_3d< T > &  line 
)

Return the intersection line of two planes.

Returns false if planes are effectively parallel

Definition at line 150 of file vgl_intersection.h.

template<class T >
bool vgl_intersection ( vgl_plane_3d< T > const &  plane0,
vgl_plane_3d< T > const &  plane1,
vgl_line_3d_2_points< T > &  line 
)

Definition at line 161 of file vgl_intersection.h.

template<class T >
bool vgl_intersection ( vgl_plane_3d< T > const &  plane0,
vgl_plane_3d< T > const &  plane1,
vgl_infinite_line_3d< T > &  line 
)

Return the intersection line of two planes. Returns false if planes.

are effectively parallel

Definition at line 726 of file vgl_intersection.txx.

template<class T >
vgl_point_3d< T > vgl_intersection ( vgl_plane_3d< T > const &  p1,
vgl_plane_3d< T > const &  p2,
vgl_plane_3d< T > const &  p3 
)

Return the intersection point of three planes.

Definition at line 804 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_point_2d< T > const &  p1,
vgl_point_2d< T > const &  p2,
vgl_point_2d< T > const &  q1,
vgl_point_2d< T > const &  q2,
double  tol 
)

Return true if any point on [p1,p2] is within tol of [q1,q2].

Tests two line segments for intersection or near intersection (within given tolerance).

Author:
Dan jackson

Definition at line 817 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_box_2d< T > const &  b,
vgl_point_2d< T > const &  p 
) [inline]

Return true if the point lies inside the box.

Definition at line 199 of file vgl_intersection.h.

template<class T >
bool vgl_intersection ( vgl_point_2d< T > const &  p,
vgl_box_2d< T > const &  b 
) [inline]

Return true if the point lies inside the box.

Definition at line 206 of file vgl_intersection.h.

template<class T >
bool vgl_intersection ( vgl_box_3d< T > const &  b,
vgl_point_3d< T > const &  p 
) [inline]

Return true if the point lies inside the box.

Definition at line 213 of file vgl_intersection.h.

template<class T >
bool vgl_intersection ( vgl_point_3d< T > const &  p,
vgl_box_3d< T > const &  b 
) [inline]

Return true if the point lies inside the box.

Definition at line 220 of file vgl_intersection.h.

template<class T >
bool vgl_intersection ( vgl_box_3d< T > const &  box,
vgl_infinite_line_3d< T > const &  line,
vgl_point_3d< T > &  p0,
vgl_point_3d< T > &  p1 
)

Return true if line intersects box. If so, compute intersection points.

Definition at line 49 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_box_3d< T > const &  box,
vgl_ray_3d< T > const &  ray,
vgl_point_3d< T > &  p0,
vgl_point_3d< T > &  p1 
)

Return true if ray intersects box. If so, compute intersection points.

If ray origin is inside box then p0==p1

Definition at line 167 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_box_3d< T > const &  b,
vgl_plane_3d< T > const &  plane 
)

Return true if a box and plane intersect in 3D.

Definition at line 198 of file vgl_intersection.txx.

template<class T >
vgl_box_2d< T > vgl_intersection ( vgl_box_2d< T > const &  b1,
vgl_box_2d< T > const &  b2 
)

Return the intersection of two boxes (which is itself either a box, or empty).

Return the intersection of two boxes (which is itself is a box, possibly the empty box).

Definition at line 36 of file vgl_intersection.txx.

template<class T >
vgl_box_3d< T > vgl_intersection ( vgl_box_3d< T > const &  b1,
vgl_box_3d< T > const &  b2 
)

Return the intersection of two boxes (which is itself either a box, or empty).

Definition at line 230 of file vgl_intersection.txx.

template<class T >
bool vgl_intersection ( vgl_box_2d< T > const &  b,
vgl_polygon< T > const &  poly 
)

Return true if the box and polygon regions intersect, regions include boundaries.

Definition at line 910 of file vgl_intersection.txx.

template<class T >
vcl_vector< vgl_point_2d< T > > vgl_intersection ( vgl_box_2d< T > const &  b,
vcl_vector< vgl_point_2d< T > > const &  p 
)

Return the points from the list that lie inside the box.

Definition at line 957 of file vgl_intersection.txx.

template<class T >
vcl_vector< vgl_point_2d< T > > vgl_intersection ( vcl_vector< vgl_point_2d< T > > const &  p,
vgl_box_2d< T > const &  b 
)

Return the points from the list that lie inside the box.

Definition at line 971 of file vgl_intersection.txx.

template<class T >
vcl_vector< vgl_point_3d< T > > vgl_intersection ( vgl_box_3d< T > const &  b,
vcl_vector< vgl_point_3d< T > > const &  p 
)

Return the points from the list that lie inside the box.

Definition at line 985 of file vgl_intersection.txx.

template<class T >
vcl_vector< vgl_point_3d< T > > vgl_intersection ( vcl_vector< vgl_point_3d< T > > const &  p,
vgl_box_3d< T > const &  b 
)

Return the points from the list that lie inside the box.

Definition at line 999 of file vgl_intersection.txx.

template<class T >
vcl_vector< vgl_point_2d< T > > vgl_intersection ( vgl_polygon< T > const &  poly,
vgl_line_2d< T > const &  line 
)

Find the intersections of a line with a polygon( can have multiple sheets).

Definition at line 1010 of file vgl_intersection.txx.

template<class T >
vcl_vector<vgl_point_2d<T> > vgl_intersection ( vgl_line_2d< T > const &  line,
vgl_polygon< T > const &  poly 
)

Definition at line 292 of file vgl_intersection.h.