Functions
core/vgl/vgl_distance.h File Reference

Set of distance functions. More...

#include <vgl/vgl_fwd.h>

Go to the source code of this file.

Functions

template<class T >
double vgl_distance2_to_linesegment (T x1, T y1, T x2, T y2, T x, T y)
 Squared distance between point (x,y) and closest point on line segment (x1,y1)-(x2,y2).
template<class T >
double vgl_distance_to_linesegment (T x1, T y1, T x2, T y2, T x, T y)
 Distance between point (x,y) and closest point on line segment (x1,y1)-(x2,y2).
template<class T >
double vgl_distance2_to_linesegment (T x1, T y1, T z1, T x2, T y2, T z2, T x, T y, T z)
 Squared distance between point (x,y,z) and closest point on line segment (x1,y1,z1)-(x2,y2,z2).
template<class T >
double vgl_distance_to_linesegment (T x1, T y1, T z1, T x2, T y2, T z2, T x, T y, T z)
 Distance between point (x,y,z) and closest point on line segment (x1,y1,z1)-(x2,y2,z2).
template<class T >
double vgl_distance_to_non_closed_polygon (T const px[], T const py[], unsigned int n, T x, T y)
 Distance between point (x,y) and closest point on open polygon (px[i],py[i]).
template<class T >
double vgl_distance_to_non_closed_polygon (T const px[], T const py[], T const pz[], unsigned int n, T x, T y, T z)
 Distance between point (x,y,z) and closest point on open polygon (px[i],py[i],pz[i]).
template<class T >
double vgl_distance_to_closed_polygon (T const px[], T const py[], unsigned int n, T x, T y)
 Distance between point (x,y) and closest point on closed polygon (px[i],py[i]).
template<class T >
double vgl_distance_to_closed_polygon (T const px[], T const py[], T const pz[], unsigned int n, T x, T y, T z)
 Distance between point (x,y,z) and closest point on closed polygon (px[i],py[i]),pz[i].
template<class T >
double vgl_distance_origin (vgl_line_2d< T > const &l)
 find the shortest distance of the line to the origin.
template<class T >
double vgl_distance_origin (vgl_plane_3d< T > const &pl)
 find the shortest distance of the plane to the origin.
template<class T >
double vgl_distance_origin (vgl_line_3d_2_points< T > const &l)
 find the shortest distance of the line to the origin.
template<class T >
double vgl_distance_origin (vgl_homg_line_2d< T > const &l)
 find the shortest distance of the line to the origin.
template<class T >
double vgl_distance_origin (vgl_homg_plane_3d< T > const &pl)
 find the shortest distance of the plane to the origin.
template<class T >
double vgl_distance_origin (vgl_homg_line_3d_2_points< T > const &l)
 find the shortest distance of the line to the origin.
template<class T >
double vgl_distance (vgl_point_2d< T >const &p1, vgl_point_2d< T >const &p2)
 return the distance between two points.
template<class T >
double vgl_distance (vgl_point_3d< T >const &p1, vgl_point_3d< T >const &p2)
 return the distance between two points.
template<class T >
double vgl_distance (vgl_homg_point_1d< T >const &p1, vgl_homg_point_1d< T >const &p2)
 return the distance between two points.
template<class T >
double vgl_distance (vgl_homg_point_2d< T >const &p1, vgl_homg_point_2d< T >const &p2)
 return the distance between two points.
template<class T >
double vgl_distance (vgl_homg_point_3d< T >const &p1, vgl_homg_point_3d< T >const &p2)
 return the distance between two points.
template<class T >
double vgl_distance (vgl_line_2d< T > const &l, vgl_point_2d< T > const &p)
 return the perpendicular distance from a point to a line in 2D.
template<class T >
double vgl_distance (vgl_point_2d< T > const &p, vgl_line_2d< T > const &l)
template<class T >
double vgl_distance (vgl_homg_line_2d< T > const &l, vgl_homg_point_2d< T > const &p)
 return the perpendicular distance from a point to a line in 2D.
template<class T >
double vgl_distance (vgl_homg_point_2d< T > const &p, vgl_homg_line_2d< T > const &l)
template<class T >
double vgl_distance (vgl_plane_3d< T > const &l, vgl_point_3d< T > const &p)
 return the perpendicular distance from a point to a plane in 3D.
template<class T >
double vgl_distance (vgl_point_3d< T > const &p, vgl_plane_3d< T > const &l)
template<class T >
double vgl_distance (vgl_homg_plane_3d< T > const &l, vgl_homg_point_3d< T > const &p)
 return the perpendicular distance from a point to a plane in 3D.
template<class T >
double vgl_distance (vgl_homg_point_3d< T > const &p, vgl_homg_plane_3d< T > const &l)
template<class T >
double vgl_distance (vgl_polygon< T > const &poly, vgl_point_2d< T > const &point, bool closed=true)
 distance between a point and the closest point on the polygon.
template<class T >
double vgl_distance (vgl_point_2d< T > const &point, vgl_polygon< T > const &poly, bool closed=true)
template<class T >
double vgl_distance (vgl_homg_line_3d_2_points< T > const &line1, vgl_homg_line_3d_2_points< T > const &line2)
 Return the perpendicular distance between two lines in 3D.
template<class T >
double vgl_distance (vgl_homg_line_3d_2_points< T > const &l, vgl_homg_point_3d< T > const &p)
 Return the perpendicular distance from a point to a line in 3D.
template<class T >
double vgl_distance (vgl_homg_point_3d< T > const &p, vgl_homg_line_3d_2_points< T > const &l)
template<class T >
double vgl_distance (vgl_line_3d_2_points< T > const &l, vgl_point_3d< T > const &p)
 Return the perpendicular distance from a point to a line in 3D.
template<class T >
double vgl_distance (vgl_point_3d< T > const &p, vgl_line_3d_2_points< T > const &l)
template<class T >
double vgl_distance (vgl_ray_3d< T > const &r, vgl_point_3d< T > const &p)
 return the closest distance from a point to a ray.
template<class T >
double vgl_distance (vgl_point_3d< T > const &p, vgl_ray_3d< T > const &r)
template<class T >
double vgl_distance (vgl_line_segment_2d< T > const &l, vgl_point_2d< T > const &p)
 Closest distance from a point p to a line segment l in 2D.
template<class T >
double vgl_distance (vgl_point_2d< T > const &p, vgl_line_segment_2d< T > const &l)
template<class T >
double vgl_distance (vgl_line_segment_3d< T > const &l, vgl_point_3d< T > const &p)
 Closest distance from a point p to a line segment l in 3D.
template<class T >
double vgl_distance (vgl_point_3d< T > const &p, vgl_line_segment_3d< T > const &l)

Detailed Description

Set of distance functions.

Author:
fsm

Note that these functions return double, not the template parameter Type, since e.g. the distance between two vgl_point_2d<int> is not always an int, but even the squared distance between such a point and a line is not integer.

    Modifications
      2 July 2001 Peter Vanroose added vgl_distance(point,line) and (point,plane)
      2 July 2001 Peter Vanroose inlined 4 functions and made return types double
      2 Jan. 2003 Peter Vanroose corrected functions returning negative distance
      5 June 2003 Peter Vanroose added vgl_distance(line_3d,line_3d)
     11 June 2003 Peter Vanroose added vgl_distance(line_3d,point_3d)
     14 Nov. 2003 Peter Vanroose made all functions templated
     25 Sept 2004 Peter Vanroose added 3D vgl_distance_to_linesegment()
     25 Sept 2004 Peter Vanroose added 3D vgl_distance_to_*_polygon()
   

Definition in file vgl_distance.h.


Function Documentation

template<class T >
double vgl_distance ( vgl_point_2d< T >const &  p1,
vgl_point_2d< T >const &  p2 
) [inline]

return the distance between two points.

Definition at line 104 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_point_3d< T >const &  p1,
vgl_point_3d< T >const &  p2 
) [inline]

return the distance between two points.

Definition at line 110 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_homg_point_1d< T >const &  p1,
vgl_homg_point_1d< T >const &  p2 
)

return the distance between two points.

Definition at line 213 of file vgl_distance.txx.

template<class T >
double vgl_distance ( vgl_homg_point_2d< T >const &  p1,
vgl_homg_point_2d< T >const &  p2 
) [inline]

return the distance between two points.

Definition at line 122 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_homg_point_3d< T >const &  p1,
vgl_homg_point_3d< T >const &  p2 
) [inline]

return the distance between two points.

Definition at line 128 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_line_2d< T > const &  l,
vgl_point_2d< T > const &  p 
)

return the perpendicular distance from a point to a line in 2D.

Definition at line 220 of file vgl_distance.txx.

template<class T >
double vgl_distance ( vgl_point_2d< T > const &  p,
vgl_line_2d< T > const &  l 
) [inline]

Definition at line 138 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_homg_line_2d< T > const &  l,
vgl_homg_point_2d< T > const &  p 
)

return the perpendicular distance from a point to a line in 2D.

Definition at line 228 of file vgl_distance.txx.

template<class T >
double vgl_distance ( vgl_homg_point_2d< T > const &  p,
vgl_homg_line_2d< T > const &  l 
) [inline]

Definition at line 148 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_plane_3d< T > const &  l,
vgl_point_3d< T > const &  p 
)

return the perpendicular distance from a point to a plane in 3D.

Definition at line 236 of file vgl_distance.txx.

template<class T >
double vgl_distance ( vgl_point_3d< T > const &  p,
vgl_plane_3d< T > const &  l 
) [inline]

Definition at line 158 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_homg_plane_3d< T > const &  l,
vgl_homg_point_3d< T > const &  p 
)

return the perpendicular distance from a point to a plane in 3D.

Definition at line 244 of file vgl_distance.txx.

template<class T >
double vgl_distance ( vgl_homg_point_3d< T > const &  p,
vgl_homg_plane_3d< T > const &  l 
) [inline]

Definition at line 168 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_polygon< T > const &  poly,
vgl_point_2d< T > const &  point,
bool  closed = true 
)

distance between a point and the closest point on the polygon.

If the third argument is "false", the edge from last to first point of each polygon sheet is not considered part of the polygon.

Definition at line 252 of file vgl_distance.txx.

template<class T >
double vgl_distance ( vgl_point_2d< T > const &  point,
vgl_polygon< T > const &  poly,
bool  closed = true 
) [inline]

Definition at line 182 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_homg_line_3d_2_points< T > const &  line1,
vgl_homg_line_3d_2_points< T > const &  line2 
)

Return the perpendicular distance between two lines in 3D.

See vgl_closest_point.h for more information.

Definition at line 281 of file vgl_distance.txx.

template<class T >
double vgl_distance ( vgl_homg_line_3d_2_points< T > const &  l,
vgl_homg_point_3d< T > const &  p 
)

Return the perpendicular distance from a point to a line in 3D.

See vgl_closest_point.h for more information.

Definition at line 294 of file vgl_distance.txx.

template<class T >
double vgl_distance ( vgl_homg_point_3d< T > const &  p,
vgl_homg_line_3d_2_points< T > const &  l 
) [inline]

Definition at line 202 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_line_3d_2_points< T > const &  l,
vgl_point_3d< T > const &  p 
)

Return the perpendicular distance from a point to a line in 3D.

See vgl_closest_point.h for more information.

Definition at line 302 of file vgl_distance.txx.

template<class T >
double vgl_distance ( vgl_point_3d< T > const &  p,
vgl_line_3d_2_points< T > const &  l 
) [inline]

Definition at line 213 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_ray_3d< T > const &  r,
vgl_point_3d< T > const &  p 
)

return the closest distance from a point to a ray.

Definition at line 329 of file vgl_distance.txx.

template<class T >
double vgl_distance ( vgl_point_3d< T > const &  p,
vgl_ray_3d< T > const &  r 
) [inline]

Definition at line 222 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_line_segment_2d< T > const &  l,
vgl_point_2d< T > const &  p 
)

Closest distance from a point p to a line segment l in 2D.

See also:
vgl_distance_to_linesegment()
vgl_distance2_to_linesegment()

Definition at line 310 of file vgl_distance.txx.

template<class T >
double vgl_distance ( vgl_point_2d< T > const &  p,
vgl_line_segment_2d< T > const &  l 
) [inline]

Definition at line 234 of file vgl_distance.h.

template<class T >
double vgl_distance ( vgl_line_segment_3d< T > const &  l,
vgl_point_3d< T > const &  p 
)

Closest distance from a point p to a line segment l in 3D.

See also:
vgl_distance_to_linesegment()
vgl_distance2_to_linesegment()

Definition at line 319 of file vgl_distance.txx.

template<class T >
double vgl_distance ( vgl_point_3d< T > const &  p,
vgl_line_segment_3d< T > const &  l 
) [inline]

Definition at line 247 of file vgl_distance.h.

template<class T >
double vgl_distance2_to_linesegment ( x1,
y1,
x2,
y2,
x,
y 
)

Squared distance between point (x,y) and closest point on line segment (x1,y1)-(x2,y2).

Definition at line 39 of file vgl_distance.txx.

template<class T >
double vgl_distance2_to_linesegment ( x1,
y1,
z1,
x2,
y2,
z2,
x,
y,
z 
)

Squared distance between point (x,y,z) and closest point on line segment (x1,y1,z1)-(x2,y2,z2).

Definition at line 74 of file vgl_distance.txx.

template<class T >
double vgl_distance_origin ( vgl_line_2d< T > const &  l)

find the shortest distance of the line to the origin.

Definition at line 178 of file vgl_distance.txx.

template<class T >
double vgl_distance_origin ( vgl_plane_3d< T > const &  pl)

find the shortest distance of the plane to the origin.

Definition at line 192 of file vgl_distance.txx.

template<class T >
double vgl_distance_origin ( vgl_line_3d_2_points< T > const &  l)

find the shortest distance of the line to the origin.

Definition at line 206 of file vgl_distance.txx.

template<class T >
double vgl_distance_origin ( vgl_homg_line_2d< T > const &  l)

find the shortest distance of the line to the origin.

Definition at line 171 of file vgl_distance.txx.

template<class T >
double vgl_distance_origin ( vgl_homg_plane_3d< T > const &  pl)

find the shortest distance of the plane to the origin.

Definition at line 185 of file vgl_distance.txx.

template<class T >
double vgl_distance_origin ( vgl_homg_line_3d_2_points< T > const &  l)

find the shortest distance of the line to the origin.

Definition at line 199 of file vgl_distance.txx.

template<class T >
double vgl_distance_to_closed_polygon ( T const  px[],
T const  py[],
unsigned int  n,
x,
y 
)

Distance between point (x,y) and closest point on closed polygon (px[i],py[i]).

template<class T >
double vgl_distance_to_closed_polygon ( T const  px[],
T const  py[],
T const  pz[],
unsigned int  n,
x,
y,
z 
)

Distance between point (x,y,z) and closest point on closed polygon (px[i],py[i]),pz[i].

Definition at line 153 of file vgl_distance.txx.

template<class T >
double vgl_distance_to_linesegment ( x1,
y1,
x2,
y2,
x,
y 
)

Distance between point (x,y) and closest point on line segment (x1,y1)-(x2,y2).

Definition at line 31 of file vgl_distance.txx.

template<class T >
double vgl_distance_to_linesegment ( x1,
y1,
z1,
x2,
y2,
z2,
x,
y,
z 
)

Distance between point (x,y,z) and closest point on line segment (x1,y1,z1)-(x2,y2,z2).

Definition at line 66 of file vgl_distance.txx.

template<class T >
double vgl_distance_to_non_closed_polygon ( T const  px[],
T const  py[],
unsigned int  n,
x,
y 
)

Distance between point (x,y) and closest point on open polygon (px[i],py[i]).

template<class T >
double vgl_distance_to_non_closed_polygon ( T const  px[],
T const  py[],
T const  pz[],
unsigned int  n,
x,
y,
z 
)

Distance between point (x,y,z) and closest point on open polygon (px[i],py[i],pz[i]).

Definition at line 138 of file vgl_distance.txx.