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

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

Definition at line 456 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().

457 {
458 
459  int t1 = lwg1->type;
460  int t2 = lwg2->type;
461 
462  LWDEBUGF(2, "lw_dist3d_distribute_bruteforce is called with typ1=%d, type2=%d", lwg1->type, lwg2->type);
463 
464  if ( t1 == POINTTYPE )
465  {
466  if ( t2 == POINTTYPE )
467  {
468  dl->twisted=1;
469  return lw_dist3d_point_point((LWPOINT *)lwg1, (LWPOINT *)lwg2, dl);
470  }
471  else if ( t2 == LINETYPE )
472  {
473  dl->twisted=1;
474  return lw_dist3d_point_line((LWPOINT *)lwg1, (LWLINE *)lwg2, dl);
475  }
476  else if ( t2 == POLYGONTYPE )
477  {
478  dl->twisted=1;
479  return lw_dist3d_point_poly((LWPOINT *)lwg1, (LWPOLY *)lwg2,dl);
480  }
481  else
482  {
483  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
484  return LW_FALSE;
485  }
486  }
487  else if ( t1 == LINETYPE )
488  {
489  if ( t2 == POINTTYPE )
490  {
491  dl->twisted=(-1);
492  return lw_dist3d_point_line((LWPOINT *)lwg2,(LWLINE *)lwg1,dl);
493  }
494  else if ( t2 == LINETYPE )
495  {
496  dl->twisted=1;
497  return lw_dist3d_line_line((LWLINE *)lwg1,(LWLINE *)lwg2,dl);
498  }
499  else if ( t2 == POLYGONTYPE )
500  {
501  dl->twisted=1;
502  return lw_dist3d_line_poly((LWLINE *)lwg1,(LWPOLY *)lwg2,dl);
503  }
504  else
505  {
506  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
507  return LW_FALSE;
508  }
509  }
510  else if ( t1 == POLYGONTYPE )
511  {
512  if ( t2 == POLYGONTYPE )
513  {
514  dl->twisted=1;
515  return lw_dist3d_poly_poly((LWPOLY *)lwg1, (LWPOLY *)lwg2,dl);
516  }
517  else if ( t2 == POINTTYPE )
518  {
519  dl->twisted=-1;
520  return lw_dist3d_point_poly((LWPOINT *)lwg2, (LWPOLY *)lwg1,dl);
521  }
522  else if ( t2 == LINETYPE )
523  {
524  dl->twisted=-1;
525  return lw_dist3d_line_poly((LWLINE *)lwg2,(LWPOLY *)lwg1,dl);
526  }
527  else
528  {
529  lwerror("Unsupported geometry type: %s", lwtype_name(t2));
530  return LW_FALSE;
531  }
532  }
533  else
534  {
535  lwerror("Unsupported geometry type: %s", lwtype_name(t1));
536  return LW_FALSE;
537  }
538  /*You shouldn't being able to get here*/
539  lwerror("unspecified error in function lw_dist3d_distribute_bruteforce");
540  return LW_FALSE;
541 }
#define LINETYPE
Definition: liblwgeom.h:71
int lw_dist3d_line_poly(LWLINE *line, LWPOLY *poly, DISTPTS3D *dl)
line to polygon calculation
Definition: measures3d.c:641
#define POLYGONTYPE
Definition: liblwgeom.h:72
int lw_dist3d_poly_poly(LWPOLY *poly1, LWPOLY *poly2, DISTPTS3D *dl)
polygon to polygon calculation
Definition: measures3d.c:661
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
#define LW_FALSE
Definition: liblwgeom.h:62
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:598
int twisted
Definition: measures3d.h:31
int lw_dist3d_point_line(LWPOINT *point, LWLINE *line, DISTPTS3D *dl)
point to line calculation
Definition: measures3d.c:576
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
int lw_dist3d_point_point(LWPOINT *point1, LWPOINT *point2, DISTPTS3D *dl)
point to point calculation
Definition: measures3d.c:560
uint8_t type
Definition: liblwgeom.h:380
int lw_dist3d_line_line(LWLINE *line1, LWLINE *line2, DISTPTS3D *dl)
line to line calculation
Definition: measures3d.c:628
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74

Here is the call graph for this function:

Here is the caller graph for this function: