PostGIS  2.1.10dev-r@@SVN_REVISION@@
int lw_dist3d_distribute_bruteforce ( LWGEOM lwg1,
LWGEOM lwg2,
DISTPTS3D dl 
)

This function distributes the brut-force for 3D so far the only type, tasks depending on type.

Definition at line 275 of file measures3d.c.

References LINETYPE, lw_dist3d_line_line(), lw_dist3d_line_poly(), lw_dist3d_point_line(), lw_dist3d_point_point(), lw_dist3d_point_poly(), lw_dist3d_poly_poly(), LW_FALSE, LWDEBUGF, lwerror(), lwtype_name(), POINTTYPE, POLYGONTYPE, DISTPTS3D::twisted, and LWGEOM::type.

Referenced by lw_dist3d_recursive().

276 {
277 
278  int t1 = lwg1->type;
279  int t2 = lwg2->type;
280 
281  LWDEBUGF(2, "lw_dist3d_distribute_bruteforce is called with typ1=%d, type2=%d", lwg1->type, lwg2->type);
282 
283  if ( t1 == POINTTYPE )
284  {
285  if ( t2 == POINTTYPE )
286  {
287  dl->twisted=1;
288  return lw_dist3d_point_point((LWPOINT *)lwg1, (LWPOINT *)lwg2, dl);
289  }
290  else if ( t2 == LINETYPE )
291  {
292  dl->twisted=1;
293  return lw_dist3d_point_line((LWPOINT *)lwg1, (LWLINE *)lwg2, dl);
294  }
295  else if ( t2 == POLYGONTYPE )
296  {
297  dl->twisted=1;
298  return lw_dist3d_point_poly((LWPOINT *)lwg1, (LWPOLY *)lwg2,dl);
299  }
300  else
301  {
302  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
303  return LW_FALSE;
304  }
305  }
306  else if ( t1 == LINETYPE )
307  {
308  if ( t2 == POINTTYPE )
309  {
310  dl->twisted=(-1);
311  return lw_dist3d_point_line((LWPOINT *)lwg2,(LWLINE *)lwg1,dl);
312  }
313  else if ( t2 == LINETYPE )
314  {
315  dl->twisted=1;
316  return lw_dist3d_line_line((LWLINE *)lwg1,(LWLINE *)lwg2,dl);
317  }
318  else if ( t2 == POLYGONTYPE )
319  {
320  dl->twisted=1;
321  return lw_dist3d_line_poly((LWLINE *)lwg1,(LWPOLY *)lwg2,dl);
322  }
323  else
324  {
325  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
326  return LW_FALSE;
327  }
328  }
329  else if ( t1 == POLYGONTYPE )
330  {
331  if ( t2 == POLYGONTYPE )
332  {
333  dl->twisted=1;
334  return lw_dist3d_poly_poly((LWPOLY *)lwg1, (LWPOLY *)lwg2,dl);
335  }
336  else if ( t2 == POINTTYPE )
337  {
338  dl->twisted=-1;
339  return lw_dist3d_point_poly((LWPOINT *)lwg2, (LWPOLY *)lwg1,dl);
340  }
341  else if ( t2 == LINETYPE )
342  {
343  dl->twisted=-1;
344  return lw_dist3d_line_poly((LWLINE *)lwg2,(LWPOLY *)lwg1,dl);
345  }
346  else
347  {
348  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
349  return LW_FALSE;
350  }
351  }
352  else
353  {
354  lwerror("Unsupported geometry type: %s", lwtype_name(t1));
355  return LW_FALSE;
356  }
357  /*You shouldn't being able to get here*/
358  lwerror("unspecified error in function lw_dist3d_distribute_bruteforce");
359  return LW_FALSE;
360 }
#define LINETYPE
Definition: liblwgeom.h:61
int lw_dist3d_line_poly(LWLINE *line, LWPOLY *poly, DISTPTS3D *dl)
line to polygon calculation
Definition: measures3d.c:460
#define POLYGONTYPE
Definition: liblwgeom.h:62
int lw_dist3d_poly_poly(LWPOLY *poly1, LWPOLY *poly2, DISTPTS3D *dl)
polygon to polygon calculation
Definition: measures3d.c:480
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
#define LW_FALSE
Definition: liblwgeom.h:52
int lw_dist3d_point_poly(LWPOINT *point, LWPOLY *poly, DISTPTS3D *dl)
Computes point to polygon distance For mindistance that means: 1)find the plane of the polygon 2)proj...
Definition: measures3d.c:417
int twisted
Definition: measures3d.h:30
int lw_dist3d_point_line(LWPOINT *point, LWLINE *line, DISTPTS3D *dl)
point to line calculation
Definition: measures3d.c:395
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
int lw_dist3d_point_point(LWPOINT *point1, LWPOINT *point2, DISTPTS3D *dl)
point to point calculation
Definition: measures3d.c:379
uint8_t type
Definition: liblwgeom.h:352
int lw_dist3d_line_line(LWLINE *line1, LWLINE *line2, DISTPTS3D *dl)
line to line calculation
Definition: measures3d.c:447
#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: