Defines | Functions
core/vgl/vgl_intersection.txx File Reference
#include "vgl_intersection.h"
#include <vcl_limits.h>
#include <vcl_cassert.h>
#include <vcl_cmath.h>
#include <vgl/vgl_point_2d.h>
#include <vgl/vgl_line_2d.h>
#include <vgl/vgl_line_3d_2_points.h>
#include <vgl/vgl_line_segment_2d.h>
#include <vgl/vgl_line_segment_3d.h>
#include <vgl/vgl_vector_3d.h>
#include <vgl/vgl_box_2d.h>
#include <vgl/vgl_box_3d.h>
#include <vgl/vgl_polygon.h>
#include <vgl/vgl_plane_3d.h>
#include <vgl/vgl_distance.h>
#include <vgl/vgl_tolerance.h>
#include <vgl/vgl_lineseg_test.h>
#include <vcl_vector.h>

Go to the source code of this file.

Defines

#define vgl_intersection_txx_
#define VGL_INTERSECTION_BOX_INSTANTIATE(T)
 Instantiate those functions which are suitable for integer instantiation.
#define VGL_INTERSECTION_INSTANTIATE(T)

Functions

bool vgl_near_zero (double x)
bool vgl_near_eq (double x, double y)
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 is a box, possibly the empty box).
template<class T >
bool vgl_intersection (vgl_box_3d< T > const &box, vgl_infinite_line_3d< T > const &line_3d, 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 &b, vgl_plane_3d< T > const &plane)
 Return true if a box and plane intersect in 3D.
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).
template<class Type >
bool vgl_intersection (const vgl_box_2d< Type > &box, const vgl_line_2d< Type > &line, vgl_point_2d< Type > &p0, vgl_point_2d< Type > &p1)
 compute the intersection of an infinite line with *this box.
template<class Type >
unsigned vgl_intersection (const vgl_box_2d< Type > &box, const vgl_line_segment_2d< Type > &line_seg, vgl_point_2d< Type > &p0, vgl_point_2d< Type > &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.
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 two concurrent lines.
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 two lines, if concurrent.
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 (const vgl_line_2d< T > &line0, const vgl_line_2d< T > &line1, vgl_point_2d< T > &intersection_point)
 Return the intersection point of two lines. Return false if lines are parallel.
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 (const vgl_plane_3d< T > &p1, const vgl_plane_3d< T > &p2, const vgl_plane_3d< T > &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)
 Return true if any point on [p1,p2] is within tol of [q1,q2].
template<class T >
bool vgl_intersection (const vgl_box_2d< T > &b, const vgl_polygon< T > &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.

Detailed Description

Author:
Gamze Tunali

Definition in file vgl_intersection.txx.


Define Documentation

#define VGL_INTERSECTION_BOX_INSTANTIATE (   T)
Value:
template vgl_box_2d<T > vgl_intersection(vgl_box_2d<T > const&,vgl_box_2d<T > const&); \
template vgl_box_3d<T > vgl_intersection(vgl_box_3d<T > const&,vgl_box_3d<T > const&); \
template vcl_vector<vgl_point_2d<T > > vgl_intersection(vgl_box_2d<T > const&,vcl_vector<vgl_point_2d<T > > const&); \
template vcl_vector<vgl_point_2d<T > > vgl_intersection(vcl_vector<vgl_point_2d<T > > const&,vgl_box_2d<T > const&); \
template vcl_vector<vgl_point_3d<T > > vgl_intersection(vgl_box_3d<T > const&,vcl_vector<vgl_point_3d<T > > const&); \
template vcl_vector<vgl_point_3d<T > > vgl_intersection(vcl_vector<vgl_point_3d<T > > const&,vgl_box_3d<T > const&); \
template bool vgl_intersection(vgl_box_2d<T > const&,vgl_line_2d<T > const&,vgl_point_2d<T >&,vgl_point_2d<T >&); \
template bool vgl_intersection(vgl_box_3d<T > const&,vgl_plane_3d<T > const&); \
template bool vgl_intersection(vgl_box_3d<T > const&,vgl_infinite_line_3d<T > const&,vgl_point_3d<T >&,vgl_point_3d<T >&)

Instantiate those functions which are suitable for integer instantiation.

Definition at line 927 of file vgl_intersection.txx.

#define VGL_INTERSECTION_INSTANTIATE (   T)
Value:
template vgl_point_3d<T > vgl_intersection(vgl_line_3d_2_points<T > const&,vgl_line_3d_2_points<T > const&); \
template bool vgl_intersection(vgl_line_segment_3d<T > const&,vgl_line_segment_3d<T > const&,vgl_point_3d<T >&); \
template bool vgl_intersection(vgl_line_3d_2_points<T > const&,vgl_line_segment_3d<T > const&,vgl_point_3d<T >&); \
template vgl_point_3d<T > vgl_intersection(vgl_line_3d_2_points<T > const&,vgl_plane_3d<T > const&); \
template bool vgl_intersection(vgl_line_segment_3d<T > const&,vgl_plane_3d<T > const&,vgl_point_3d<T >&); \
template bool vgl_intersection(vgl_infinite_line_3d<T > const&,vgl_plane_3d<T > const&,vgl_point_3d<T >&); \
template bool vgl_intersection(vgl_infinite_line_3d<T > const&,vgl_infinite_line_3d<T > const&,vgl_point_3d<T >&); \
template vgl_point_3d<T > vgl_intersection(vgl_plane_3d<T > const&,vgl_plane_3d<T > const&,vgl_plane_3d<T > const&); \
template unsigned vgl_intersection(vgl_box_2d<T > const&,vgl_line_segment_2d<T > const&,vgl_point_2d<T >&,vgl_point_2d<T >&); \
template bool vgl_intersection(vgl_line_2d<T > const&,vgl_line_2d<T > const&,vgl_point_2d<T >&); \
template bool vgl_intersection(vgl_point_2d<T > const&,vgl_point_2d<T > const&,vgl_point_2d<T > const&,vgl_point_2d<T > const&,double); \
template bool vgl_intersection(vgl_box_2d<T > const&,vgl_polygon<T > const&); \
template bool vgl_intersection(vgl_plane_3d<T > const&,vgl_plane_3d<T > const&,vgl_line_segment_3d<T > &); \
template bool vgl_intersection(vgl_plane_3d<T > const&,vgl_plane_3d<T > const&,vgl_infinite_line_3d<T >&); \
VGL_INTERSECTION_BOX_INSTANTIATE(T)

Definition at line 939 of file vgl_intersection.txx.

#define vgl_intersection_txx_

Definition at line 3 of file vgl_intersection.txx.


Function Documentation

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 is a box, possibly the empty box).

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

Definition at line 35 of file vgl_intersection.txx.

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

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

Definition at line 48 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 165 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 197 of file vgl_intersection.txx.

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

compute the intersection of an infinite line with *this box.

p0 and p1 are the intersection points In the normal case (no degeneracies) there are six possible intersection combinations:

  
                  C01 /    CY     \ C11
                     /     |       \           .
         ymax  -----/------|--------\-----
              |    /       |         \    |
              |   /        |          \   |
              |  /         |           \  | \  .
              | /          |            \ |  \_ Bounding Box
              |/           |             \|
              /            |              \    .
             /|            |              |\   .
             ---------------------------------- CX
            \ |            |              /
             \|            |             /|
              \            |            / |
              |\           |           /  |
              | \          |          /   |
              |  \         |         /    |
         xmin  ---\--------|--------/-----   xmax
         ymin      \       |       /
                C00 \             / C10
   

Definition at line 236 of file vgl_intersection.txx.

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

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

Definition at line 393 of file vgl_intersection.txx.

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

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 441 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 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 462 of file vgl_intersection.txx.

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 two lines, if concurrent.

Return the intersection point of infinite lines, if concurrent.

Definition at line 482 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 498 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 538 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 578 of file vgl_intersection.txx.

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

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

Definition at line 616 of file vgl_intersection.txx.

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 641 of file vgl_intersection.txx.

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

Return the intersection point of three planes.

Definition at line 720 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 733 of file vgl_intersection.txx.

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

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

Definition at line 826 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 873 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 887 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 901 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 915 of file vgl_intersection.txx.

bool vgl_near_eq ( double  x,
double  y 
) [inline]

Definition at line 30 of file vgl_intersection.txx.

bool vgl_near_zero ( double  x) [inline]

Definition at line 29 of file vgl_intersection.txx.