Finds the shortest distance between two segments.
This function is changed so it is not doing any comparasion of distance but just sending every possible combination further to lw_dist2d_pt_seg
Definition at line 1817 of file measures.c.
References DIST_MAX, DIST_MIN, DISTPTS::distance, lw_dist2d_pt_seg(), LW_FALSE, LW_TRUE, LWDEBUGF, lwerror(), DISTPTS::mode, DISTPTS::p1, DISTPTS::p2, r, s, DISTPTS::twisted, POINT2D::x, and POINT2D::y.
Referenced by lw_dist2d_arc_arc(), lw_dist2d_ptarray_ptarray(), and lw_dist2d_seg_arc().
1819 double s_top, s_bot,
s;
1820 double r_top, r_bot,
r;
1822 LWDEBUGF(2,
"lw_dist2d_seg_seg [%g,%g]->[%g,%g] by [%g,%g]->[%g,%g]",
1823 A->
x,A->
y,B->
x,B->
y, C->
x,C->
y, D->
x, D->
y);
1826 if ( ( A->
x == B->
x) && (A->
y == B->
y) )
1832 if ( ( C->
x == D->
x) && (C->
y == D->
y) )
1859 r_top = (A->
y-C->
y)*(D->
x-C->
x) - (A->
x-C->
x)*(D->
y-C->
y);
1860 r_bot = (B->
x-A->
x)*(D->
y-C->
y) - (B->
y-A->
y)*(D->
x-C->
x);
1862 s_top = (A->
y-C->
y)*(B->
x-A->
x) - (A->
x-C->
x)*(B->
y-A->
y);
1863 s_bot = (B->
x-A->
x)*(D->
y-C->
y) - (B->
y-A->
y)*(D->
x-C->
x);
1865 if ( (r_bot==0) || (s_bot == 0) )
1881 if (((r<0) || (r>1) || (s<0) || (s>1)) || (dl->
mode ==
DIST_MAX))
1899 if (((A->
x==C->
x)&&(A->
y==C->
y))||((A->
x==D->
x)&&(A->
y==D->
y)))
1904 else if (((B->
x==C->
x)&&(B->
y==C->
y))||((B->
x==D->
x)&&(B->
y==D->
y)))
1911 theP.
x = A->
x+r*(B->
x-A->
x);
1912 theP.
y = A->
y+r*(B->
y-A->
y);
1921 lwerror(
"unspecified error in function lw_dist2d_seg_seg");
#define LW_TRUE
Return types for functions with status returns.
int lw_dist2d_pt_seg(const POINT2D *p, const POINT2D *A, const POINT2D *B, DISTPTS *dl)
lw_dist2d_comp from p to line A->B This one is now sending every occation to lw_dist2d_pt_pt Before i...
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.