Macros | Functions
vgl_distance.hxx File Reference
#include <cmath>
#include <utility>
#include "vgl_distance.h"
#include <vgl/vgl_point_2d.h>
#include <vgl/vgl_point_3d.h>
#include <vgl/vgl_homg_point_1d.h>
#include <vgl/vgl_homg_point_2d.h>
#include <vgl/vgl_homg_point_3d.h>
#include <vgl/vgl_line_2d.h>
#include <vgl/vgl_line_segment_2d.h>
#include <vgl/vgl_line_segment_3d.h>
#include <vgl/vgl_homg_line_2d.h>
#include <vgl/vgl_homg_line_3d_2_points.h>
#include <vgl/vgl_plane_3d.h>
#include <vgl/vgl_homg_plane_3d.h>
#include <vgl/vgl_sphere_3d.h>
#include <vgl/vgl_polygon.h>
#include <vgl/vgl_box_2d.h>
#include <vgl/vgl_closest_point.h>
#include <cassert>

Go to the source code of this file.

Macros

#define VGL_DISTANCE_INSTANTIATE(T)
 

Functions

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). More...
 
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). More...
 
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). More...
 
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). More...
 
template<class T >
double vgl_distance_to_non_closed_polygon (T const px[], T const py[], unsigned n, T x, T y)
 
template<class T >
double vgl_distance_to_closed_polygon (T const px[], T const py[], unsigned n, T x, T y)
 
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]). More...
 
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]. More...
 
template<class T >
double vgl_distance_origin (vgl_homg_line_2d< T > const &l)
 find the shortest distance of the line to the origin. More...
 
template<class T >
double vgl_distance_origin (vgl_line_2d< T > const &l)
 find the shortest distance of the line to the origin. More...
 
template<class T >
double vgl_distance_origin (vgl_homg_plane_3d< T > const &pl)
 find the shortest distance of the plane to the origin. More...
 
template<class T >
double vgl_distance_origin (vgl_plane_3d< T > const &pl)
 find the shortest distance of the plane to the origin. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
template<class T >
double vgl_distance (vgl_point_3d< T > const &p, vgl_sphere_3d< T > const &s)
 
template<class T >
double vgl_distance (vgl_polygon< T > const &poly, vgl_point_2d< T > const &point, bool closed)
 distance between a point and the closest point on the polygon. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
template<class T >
double vgl_distance (vgl_infinite_line_3d< T > const &l, vgl_point_3d< T > const &p)
 return the closest distance from a point to an infinite line. More...
 
template<class T >
double vgl_distance (vgl_point_2d< T > const &p, vgl_box_2d< T > const &b)
 closest distance from a point to a box (2d). More...
 

Detailed Description

Author
fsm

Definition in file vgl_distance.hxx.

Macro Definition Documentation

◆ VGL_DISTANCE_INSTANTIATE

#define VGL_DISTANCE_INSTANTIATE (   T)

Definition at line 377 of file vgl_distance.hxx.

Function Documentation

◆ vgl_distance() [1/15]

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 218 of file vgl_distance.hxx.

◆ vgl_distance() [2/15]

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 225 of file vgl_distance.hxx.

◆ vgl_distance() [3/15]

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

◆ vgl_distance() [4/15]

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 241 of file vgl_distance.hxx.

◆ vgl_distance() [5/15]

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 249 of file vgl_distance.hxx.

◆ vgl_distance() [6/15]

template<class T >
double vgl_distance ( vgl_point_3d< T > const &  p,
vgl_sphere_3d< T > const &  s 
)

Definition at line 256 of file vgl_distance.hxx.

◆ vgl_distance() [7/15]

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 265 of file vgl_distance.hxx.

◆ vgl_distance() [8/15]

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 294 of file vgl_distance.hxx.

◆ vgl_distance() [9/15]

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 307 of file vgl_distance.hxx.

◆ vgl_distance() [10/15]

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 315 of file vgl_distance.hxx.

◆ vgl_distance() [11/15]

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 323 of file vgl_distance.hxx.

◆ vgl_distance() [12/15]

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 332 of file vgl_distance.hxx.

◆ vgl_distance() [13/15]

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 342 of file vgl_distance.hxx.

◆ vgl_distance() [14/15]

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

return the closest distance from a point to an infinite line.

Definition at line 349 of file vgl_distance.hxx.

◆ vgl_distance() [15/15]

template<class T >
double vgl_distance ( vgl_point_2d< T > const &  p,
vgl_box_2d< T > const &  b 
)

closest distance from a point to a box (2d).

Definition at line 356 of file vgl_distance.hxx.

◆ vgl_distance2_to_linesegment() [1/2]

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 44 of file vgl_distance.hxx.

◆ vgl_distance2_to_linesegment() [2/2]

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 79 of file vgl_distance.hxx.

◆ vgl_distance_origin() [1/6]

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 176 of file vgl_distance.hxx.

◆ vgl_distance_origin() [2/6]

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 183 of file vgl_distance.hxx.

◆ vgl_distance_origin() [3/6]

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 190 of file vgl_distance.hxx.

◆ vgl_distance_origin() [4/6]

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 197 of file vgl_distance.hxx.

◆ vgl_distance_origin() [5/6]

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 204 of file vgl_distance.hxx.

◆ vgl_distance_origin() [6/6]

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 211 of file vgl_distance.hxx.

◆ vgl_distance_to_closed_polygon() [1/2]

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

Definition at line 125 of file vgl_distance.hxx.

◆ vgl_distance_to_closed_polygon() [2/2]

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 158 of file vgl_distance.hxx.

◆ vgl_distance_to_linesegment() [1/2]

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 36 of file vgl_distance.hxx.

◆ vgl_distance_to_linesegment() [2/2]

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 71 of file vgl_distance.hxx.

◆ vgl_distance_to_non_closed_polygon() [1/2]

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

Definition at line 110 of file vgl_distance.hxx.

◆ vgl_distance_to_non_closed_polygon() [2/2]

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 143 of file vgl_distance.hxx.