PostGIS  3.4.0dev-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 2265 of file measures.c.

2266 {
2267  /*A and B are the same point */
2268  if ((A->x == B->x) && (A->y == B->y))
2269  {
2270  return lw_dist2d_pt_seg(A, C, D, dl);
2271  }
2272  /*U and V are the same point */
2273 
2274  if ((C->x == D->x) && (C->y == D->y))
2275  {
2276  dl->twisted *= -1;
2277  return lw_dist2d_pt_seg(D, A, B, dl);
2278  }
2279 
2280  if ((lw_dist2d_pt_seg(A, C, D, dl)) && (lw_dist2d_pt_seg(B, C, D, dl)))
2281  {
2282  /* change the order of inputted geometries and that we notice by changing sign on dl->twisted */
2283  dl->twisted *= -1;
2284  return ((lw_dist2d_pt_seg(C, A, B, dl)) && (lw_dist2d_pt_seg(D, A, B, dl)));
2285  }
2286  else
2287  return LW_FALSE; /* if any of the calls to lw_dist2d_pt_seg goes wrong we return false*/
2288 }
#define LW_FALSE
Definition: liblwgeom.h:94
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 occasion to lw_dist2d_pt_pt Before i...
Definition: measures.c:2306
int twisted
Definition: measures.h:55
double y
Definition: liblwgeom.h:390
double x
Definition: liblwgeom.h:390

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

Referenced by lw_dist2d_pre_seg_seg().

Here is the call graph for this function:
Here is the caller graph for this function: