PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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 555 of file measures.c.

556{
557 POINTARRAY *pa1, *pa2;
558 int type1 = lwg1->type;
559 int type2 = lwg2->type;
560
561 LWDEBUGF(2, "lw_dist2d_distribute_fast is called with typ1=%d, type2=%d", lwg1->type, lwg2->type);
562
563 switch (type1)
564 {
565 case LINETYPE:
566 pa1 = ((LWLINE *)lwg1)->points;
567 break;
568 case POLYGONTYPE:
569 pa1 = ((LWPOLY *)lwg1)->rings[0];
570 break;
571 case TRIANGLETYPE:
572 pa1 = ((LWTRIANGLE *)lwg1)->points;
573 break;
574 default:
575 lwerror("Unsupported geometry1 type: %s", lwtype_name(type1));
576 return LW_FALSE;
577 }
578 switch (type2)
579 {
580 case LINETYPE:
581 pa2 = ((LWLINE *)lwg2)->points;
582 break;
583 case POLYGONTYPE:
584 pa2 = ((LWPOLY *)lwg2)->rings[0];
585 break;
586 case TRIANGLETYPE:
587 pa2 = ((LWTRIANGLE *)lwg2)->points;
588 break;
589 default:
590 lwerror("Unsupported geometry2 type: %s", lwtype_name(type1));
591 return LW_FALSE;
592 }
593 dl->twisted = 1;
594 return lw_dist2d_fast_ptarray_ptarray(pa1, pa2, dl, lwg1->bbox, lwg2->bbox);
595}
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
#define LW_FALSE
Definition liblwgeom.h:94
#define LINETYPE
Definition liblwgeom.h:103
#define POLYGONTYPE
Definition liblwgeom.h:104
#define TRIANGLETYPE
Definition liblwgeom.h:115
#define LWDEBUGF(level, msg,...)
Definition lwgeom_log.h:106
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
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:1947
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: