PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lw_dist2d_distribute_fast()

int lw_dist2d_distribute_fast ( LWGEOM lwg1,
LWGEOM lwg2,
DISTPTS dl 
)

Geometries are distributed for the new faster distance-calculations.

Definition at line 539 of file measures.c.

540 {
541  POINTARRAY *pa1, *pa2;
542  int type1 = lwg1->type;
543  int type2 = lwg2->type;
544 
545  LWDEBUGF(2, "lw_dist2d_distribute_fast is called with typ1=%d, type2=%d", lwg1->type, lwg2->type);
546 
547  switch (type1)
548  {
549  case LINETYPE:
550  pa1 = ((LWLINE *)lwg1)->points;
551  break;
552  case POLYGONTYPE:
553  pa1 = ((LWPOLY *)lwg1)->rings[0];
554  break;
555  case TRIANGLETYPE:
556  pa1 = ((LWTRIANGLE *)lwg1)->points;
557  break;
558  default:
559  lwerror("Unsupported geometry1 type: %s", lwtype_name(type1));
560  return LW_FALSE;
561  }
562  switch (type2)
563  {
564  case LINETYPE:
565  pa2 = ((LWLINE *)lwg2)->points;
566  break;
567  case POLYGONTYPE:
568  pa2 = ((LWPOLY *)lwg2)->rings[0];
569  break;
570  case TRIANGLETYPE:
571  pa2 = ((LWTRIANGLE *)lwg2)->points;
572  break;
573  default:
574  lwerror("Unsupported geometry2 type: %s", lwtype_name(type1));
575  return LW_FALSE;
576  }
577  dl->twisted = 1;
578  return lw_dist2d_fast_ptarray_ptarray(pa1, pa2, dl, lwg1->bbox, lwg2->bbox);
579 }
#define LW_FALSE
Definition: liblwgeom.h:94
#define LINETYPE
Definition: liblwgeom.h:103
#define POLYGONTYPE
Definition: liblwgeom.h:104
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
#define TRIANGLETYPE
Definition: liblwgeom.h:115
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
int lw_dist2d_fast_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2, DISTPTS *dl, GBOX *box1, GBOX *box2)
The new faster calculation comparing pointarray to another pointarray the arrays can come from both p...
Definition: measures.c:2036
int twisted
Definition: measures.h:55
uint8_t type
Definition: liblwgeom.h:462
GBOX * bbox
Definition: liblwgeom.h:458

References LWGEOM::bbox, LINETYPE, lw_dist2d_fast_ptarray_ptarray(), LW_FALSE, LWDEBUGF, lwerror(), lwtype_name(), POLYGONTYPE, TRIANGLETYPE, DISTPTS::twisted, and LWGEOM::type.

Referenced by lw_dist2d_recursive().

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