Macros | Functions
vgl_intersection.h File Reference

Set of intersection functions. More...

#include <vector>
#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 <vgl/vgl_pointset_3d.h>

Go to the source code of this file.

Macros

#define VGL_INTERSECTION_INSTANTIATE(T)   extern "please include vgl/vgl_intersection.hxx first"
 
#define VGL_INTERSECTION_BOX_INSTANTIATE(T)   extern "please include vgl/vgl_intersection.hxx 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. More...
 
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. More...
 
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. More...
 
template<class T >
bool vgl_intersection (vgl_box_2d< T > const &box, vgl_line_segment_2d< T > const &line, vgl_line_segment_2d< T > &int_line)
 Return true if line intersects box.If so,return the line segment inside box. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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]. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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). More...
 
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). More...
 
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. More...
 
template<class T >
std::vector< vgl_point_2d< T > > vgl_intersection (vgl_box_2d< T > const &b, std::vector< vgl_point_2d< T > > const &p)
 Return the points from the list that lie inside the box. More...
 
template<class T >
std::vector< vgl_point_2d< T > > vgl_intersection (std::vector< vgl_point_2d< T > > const &p, vgl_box_2d< T > const &b)
 Return the points from the list that lie inside the box. More...
 
template<class T >
std::vector< vgl_point_3d< T > > vgl_intersection (vgl_box_3d< T > const &b, std::vector< vgl_point_3d< T > > const &p)
 Return the points from the list that lie inside the box. More...
 
template<class T >
std::vector< vgl_point_3d< T > > vgl_intersection (std::vector< vgl_point_3d< T > > const &p, vgl_box_3d< T > const &b)
 Return the points from the list that lie inside the box. More...
 
template<class T >
std::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). More...
 
template<class T >
std::vector< vgl_point_2d< T > > vgl_intersection (vgl_line_2d< T > const &line, vgl_polygon< T > const &poly)
 
template<class T >
vgl_pointset_3d< T > vgl_intersection (vgl_plane_3d< T > const &plane, vgl_pointset_3d< T > const &ptset, T tol)
 return the intersection of a pointset with a plane, given a tolerance tol. More...
 
template<class T >
vgl_pointset_3d< T > vgl_intersection (vgl_pointset_3d< T > const &ptset, vgl_plane_3d< T > const &plane, T tol)
 
template<class T >
vgl_pointset_3d< T > vgl_intersection (vgl_box_3d< T > const &box, vgl_pointset_3d< T > const &ptset)
 intersection of a box with the pointset. More...
 
template<class T >
vgl_pointset_3d< T > vgl_intersection (vgl_pointset_3d< T > const &ptset, vgl_box_3d< T > const &box)
 

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.

Macro Definition Documentation

◆ VGL_INTERSECTION_BOX_INSTANTIATE

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

Definition at line 332 of file vgl_intersection.h.

◆ VGL_INTERSECTION_INSTANTIATE

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

Definition at line 331 of file vgl_intersection.h.

Function Documentation

◆ vgl_intersection() [1/41]

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 36 of file vgl_intersection.h.

◆ vgl_intersection() [2/41]

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 43 of file vgl_intersection.h.

◆ vgl_intersection() [3/41]

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.

◆ vgl_intersection() [4/41]

template<class T >
bool vgl_intersection ( vgl_box_2d< T > const &  box,
vgl_line_segment_2d< T > const &  line,
vgl_line_segment_2d< T > &  int_line 
)

Return true if line intersects box.If so,return the line segment inside box.

Definition at line 453 of file vgl_intersection.hxx.

◆ vgl_intersection() [5/41]

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.

(warning! one intersection could be either p0 or p1).

◆ vgl_intersection() [6/41]

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 505 of file vgl_intersection.hxx.

◆ vgl_intersection() [7/41]

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.

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

Definition at line 528 of file vgl_intersection.hxx.

◆ vgl_intersection() [8/41]

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.

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.

Definition at line 549 of file vgl_intersection.hxx.

◆ vgl_intersection() [9/41]

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 95 of file vgl_intersection.h.

◆ vgl_intersection() [10/41]

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.

Return the intersection point of infinite lines, if concurrent.

Definition at line 569 of file vgl_intersection.hxx.

◆ vgl_intersection() [11/41]

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 582 of file vgl_intersection.hxx.

◆ vgl_intersection() [12/41]

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 755 of file vgl_intersection.hxx.

◆ vgl_intersection() [13/41]

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 598 of file vgl_intersection.hxx.

◆ vgl_intersection() [14/41]

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 638 of file vgl_intersection.hxx.

◆ vgl_intersection() [15/41]

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 678 of file vgl_intersection.hxx.

◆ vgl_intersection() [16/41]

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 716 of file vgl_intersection.hxx.

◆ vgl_intersection() [17/41]

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 161 of file vgl_intersection.h.

◆ vgl_intersection() [18/41]

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 172 of file vgl_intersection.h.

◆ vgl_intersection() [19/41]

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 780 of file vgl_intersection.hxx.

◆ vgl_intersection() [20/41]

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 858 of file vgl_intersection.hxx.

◆ vgl_intersection() [21/41]

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 871 of file vgl_intersection.hxx.

◆ vgl_intersection() [22/41]

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 210 of file vgl_intersection.h.

◆ vgl_intersection() [23/41]

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 217 of file vgl_intersection.h.

◆ vgl_intersection() [24/41]

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 224 of file vgl_intersection.h.

◆ vgl_intersection() [25/41]

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 231 of file vgl_intersection.h.

◆ vgl_intersection() [26/41]

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 53 of file vgl_intersection.hxx.

◆ vgl_intersection() [27/41]

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 171 of file vgl_intersection.hxx.

◆ vgl_intersection() [28/41]

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 201 of file vgl_intersection.hxx.

◆ vgl_intersection() [29/41]

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).

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

Definition at line 40 of file vgl_intersection.hxx.

◆ vgl_intersection() [30/41]

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 233 of file vgl_intersection.hxx.

◆ vgl_intersection() [31/41]

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 964 of file vgl_intersection.hxx.

◆ vgl_intersection() [32/41]

template<class T >
std::vector< vgl_point_2d< T > > vgl_intersection ( vgl_box_2d< T > const &  b,
std::vector< vgl_point_2d< T > > const &  p 
)

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

Definition at line 1011 of file vgl_intersection.hxx.

◆ vgl_intersection() [33/41]

template<class T >
std::vector< vgl_point_2d< T > > vgl_intersection ( std::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 1025 of file vgl_intersection.hxx.

◆ vgl_intersection() [34/41]

template<class T >
std::vector< vgl_point_3d< T > > vgl_intersection ( vgl_box_3d< T > const &  b,
std::vector< vgl_point_3d< T > > const &  p 
)

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

Definition at line 1039 of file vgl_intersection.hxx.

◆ vgl_intersection() [35/41]

template<class T >
std::vector< vgl_point_3d< T > > vgl_intersection ( std::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 1053 of file vgl_intersection.hxx.

◆ vgl_intersection() [36/41]

template<class T >
std::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 1064 of file vgl_intersection.hxx.

◆ vgl_intersection() [37/41]

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

Definition at line 303 of file vgl_intersection.h.

◆ vgl_intersection() [38/41]

template<class T >
vgl_pointset_3d< T > vgl_intersection ( vgl_plane_3d< T > const &  plane,
vgl_pointset_3d< T > const &  ptset,
tol 
)

return the intersection of a pointset with a plane, given a tolerance tol.

the normal distance from the plane to the point is compared to the tolerance the points within tolerance are projected along the normal direction onto the plane

return the intersection of a pointset with a plane, given a tolerance tol.

Definition at line 1111 of file vgl_intersection.hxx.

◆ vgl_intersection() [39/41]

template<class T >
vgl_pointset_3d<T> vgl_intersection ( vgl_pointset_3d< T > const &  ptset,
vgl_plane_3d< T > const &  plane,
tol 
)

Definition at line 316 of file vgl_intersection.h.

◆ vgl_intersection() [40/41]

template<class T >
vgl_pointset_3d<T> vgl_intersection ( vgl_box_3d< T > const &  box,
vgl_pointset_3d< T > const &  ptset 
)

intersection of a box with the pointset.

Definition at line 1131 of file vgl_intersection.hxx.

◆ vgl_intersection() [41/41]

template<class T >
vgl_pointset_3d<T> vgl_intersection ( vgl_pointset_3d< T > const &  ptset,
vgl_box_3d< T > const &  box 
)

Definition at line 324 of file vgl_intersection.h.