PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lw_dist2d_selected_seg_seg()

int lw_dist2d_selected_seg_seg ( const POINT2D A,
const POINT2D B,
const POINT2D C,
const POINT2D D,
DISTPTS dl 
)

This is the same function as lw_dist2d_seg_seg but without any calculations to determine intersection since we already know they do not intersect.

Definition at line 2144 of file measures.c.

References lw_dist2d_pt_seg(), LW_FALSE, LWDEBUGF, DISTPTS::twisted, POINT2D::x, and POINT2D::y.

Referenced by lw_dist2d_pre_seg_seg().

2145 {
2146  LWDEBUGF(2, "lw_dist2d_selected_seg_seg [%g,%g]->[%g,%g] by [%g,%g]->[%g,%g]",
2147  A->x,A->y,B->x,B->y, C->x,C->y, D->x, D->y);
2148 
2149  /*A and B are the same point */
2150  if ( ( A->x == B->x) && (A->y == B->y) )
2151  {
2152  return lw_dist2d_pt_seg(A,C,D,dl);
2153  }
2154  /*U and V are the same point */
2155 
2156  if ( ( C->x == D->x) && (C->y == D->y) )
2157  {
2158  dl->twisted= ((dl->twisted) * (-1));
2159  return lw_dist2d_pt_seg(D,A,B,dl);
2160  }
2161 
2162  if ((lw_dist2d_pt_seg(A,C,D,dl)) && (lw_dist2d_pt_seg(B,C,D,dl)))
2163  {
2164  dl->twisted= ((dl->twisted) * (-1)); /*here we change the order of inputted geometrys and that we notice by changing sign on dl->twisted*/
2165  return ((lw_dist2d_pt_seg(C,A,B,dl)) && (lw_dist2d_pt_seg(D,A,B,dl))); /*if all is successful we return true*/
2166  }
2167  else
2168  {
2169  return LW_FALSE; /* if any of the calls to lw_dist2d_pt_seg goes wrong we return false*/
2170  }
2171 }
double x
Definition: liblwgeom.h:312
#define LW_FALSE
Definition: liblwgeom.h:62
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...
Definition: measures.c:2190
double y
Definition: liblwgeom.h:312
int twisted
Definition: measures.h:28
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
Here is the call graph for this function:
Here is the caller graph for this function: