#include <limits>#include <cmath>#include <vector>#include "vgl_intersection.h"#include <cassert>#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_ray_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_closest_point.h>#include <vgl/vgl_lineseg_test.hxx>Go to the source code of this file.
Macros | |
| #define | VGL_INTERSECTION_BOX_INSTANTIATE(T) |
| #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). More... | |
| 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. 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_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). More... | |
| 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. More... | |
| template<class Type > | |
| unsigned int | 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. More... | |
| template<class T > | |
| bool | vgl_intersection (vgl_box_2d< T > const &box, vgl_line_segment_2d< T > const &line_seg, vgl_line_segment_2d< T > &int_line_seg) |
| Return true if line intersects box.If so,return the line segment inside box. 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. 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 two concurrent lines. More... | |
| 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. 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 > | |
| 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 (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. More... | |
| 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 (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. 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) |
| Return true if any point on [p1,p2] is within tol of [q1,q2]. More... | |
| 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. 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 > | |
| vgl_pointset_3d< T > | vgl_intersection (vgl_plane_3d< T > const &plane, vgl_pointset_3d< T > const &ptset, T tol) |
| find points that intersect the plane within the specified tolerance on normal distance to the plane. More... | |
| 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... | |
Definition in file vgl_intersection.hxx.
| #define VGL_INTERSECTION_BOX_INSTANTIATE | ( | T | ) |
Definition at line 1151 of file vgl_intersection.hxx.
| #define VGL_INTERSECTION_INSTANTIATE | ( | T | ) |
Definition at line 1164 of file vgl_intersection.hxx.
| 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 40 of file vgl_intersection.hxx.
| 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 53 of file vgl_intersection.hxx.
| 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.
| 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_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.
| 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 272 of file vgl_intersection.hxx.
| unsigned int 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 429 of file vgl_intersection.hxx.
| bool vgl_intersection | ( | vgl_box_2d< T > const & | box, |
| vgl_line_segment_2d< T > const & | line_seg, | ||
| vgl_line_segment_2d< T > & | int_line_seg | ||
| ) |
Return true if line intersects box.If so,return the line segment inside box.
Definition at line 453 of file vgl_intersection.hxx.
| 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.
| 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 528 of file vgl_intersection.hxx.
| 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 549 of file vgl_intersection.hxx.
| 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 569 of file vgl_intersection.hxx.
| 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_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.
| 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.
| 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.
| 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.
| 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 755 of file vgl_intersection.hxx.
| 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_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 858 of file vgl_intersection.hxx.
| 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).
Definition at line 871 of file vgl_intersection.hxx.
| 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 964 of file vgl_intersection.hxx.
| 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.
| 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.
| 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.
| 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.
| 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_pointset_3d<T> vgl_intersection | ( | vgl_plane_3d< T > const & | plane, |
| vgl_pointset_3d< T > const & | ptset, | ||
| T | tol | ||
| ) |
find points that intersect the plane within the specified tolerance on normal distance to 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_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.
|
inline |
Definition at line 35 of file vgl_intersection.hxx.
|
inline |
Definition at line 34 of file vgl_intersection.hxx.
1.8.15