Find the face-id of a face containing a given point.
4920{
4923 uint64_t num, i;
4929
4931 if ( id == -1 ) {
4933 return -1;
4934 }
4935
4936 if ( id > 0 )
4937 {
4938 return id;
4939 }
4940
4941 if ( tol == 0 )
4942 {
4943 return id;
4944 }
4945
4946 LWDEBUG(1,
"No face properly contains query point,"
4947 " looking for edges");
4948
4949
4950
4951
4952
4954 if (num == UINT64_MAX)
4955 {
4957 return -1;
4958 }
4959 for (i=0; i<num; ++i)
4960 {
4964 double dist;
4965
4967 {
4970 " has null geometry", e->
edge_id);
4971 continue;
4972 }
4973
4974
4976 {
4978 " is dangling, won't consider it", e->
edge_id);
4979 continue;
4980 }
4981
4984
4986 " is %g (tol=%g)", e->
edge_id, dist, tol);
4987
4988
4989 if ( dist > tol ) continue;
4992 }
4995 }
4996 else {
4998 lwerror(
"Two or more faces found");
4999 return -1;
5000 }
5001
5002 if ( id && id != eface )
5003 {
5005 lwerror(
"Two or more faces found"
5006#if 0
5009#endif
5010 );
5011 return -1;
5012 }
5013 else id = eface;
5014 }
5016
5017 return id;
5018}
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
double lwgeom_mindistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling min distance calculations and dwithin calculations.
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
#define LWT_COL_EDGE_FACE_RIGHT
LWT_INT64 LWT_ELEMID
Identifier of topology element.
#define LWT_COL_EDGE_FACE_LEFT
#define LWT_COL_EDGE_EDGE_ID
Edge fields.
#define LWT_COL_EDGE_GEOM
#define PGTOPO_BE_ERROR()
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void lwnotice(const char *fmt,...) __attribute__((format(printf
Write a notice out to the notice handler.
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
LWT_ISO_EDGE * lwt_be_getEdgeWithinDistance2D(LWT_TOPOLOGY *topo, const LWPOINT *pt, double dist, uint64_t *numelems, int fields, int64_t limit)
LWT_ELEMID lwt_GetFaceContainingPoint(LWT_TOPOLOGY *topo, const LWPOINT *pt)
Find the face-id of the face properly containing a given point.
void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)