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

◆ lw_dist3d_distribute_bruteforce()

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 598 of file measures3d.c.

599{
600 int t1 = lwg1->type;
601 int t2 = lwg2->type;
602
603 LWDEBUGF(2, "lw_dist3d_distribute_bruteforce is called with typ1=%d, type2=%d", lwg1->type, lwg2->type);
604
605 if (t1 == POINTTYPE)
606 {
607 if (t2 == POINTTYPE)
608 {
609 dl->twisted = 1;
610 return lw_dist3d_point_point((LWPOINT *)lwg1, (LWPOINT *)lwg2, dl);
611 }
612 else if (t2 == LINETYPE)
613 {
614 dl->twisted = 1;
615 return lw_dist3d_point_line((LWPOINT *)lwg1, (LWLINE *)lwg2, dl);
616 }
617 else if (t2 == POLYGONTYPE)
618 {
619 dl->twisted = 1;
620 return lw_dist3d_point_poly((LWPOINT *)lwg1, (LWPOLY *)lwg2, dl);
621 }
622 else if (t2 == TRIANGLETYPE)
623 {
624 dl->twisted = 1;
625 return lw_dist3d_point_tri((LWPOINT *)lwg1, (LWTRIANGLE *)lwg2, dl);
626 }
627 else
628 {
629 lwerror("%s: Unsupported geometry type: %s", __func__, lwtype_name(t2));
630 return LW_FALSE;
631 }
632 }
633 else if (t1 == LINETYPE)
634 {
635 if (t2 == POINTTYPE)
636 {
637 dl->twisted = -1;
638 return lw_dist3d_point_line((LWPOINT *)lwg2, (LWLINE *)lwg1, dl);
639 }
640 else if (t2 == LINETYPE)
641 {
642 dl->twisted = 1;
643 return lw_dist3d_line_line((LWLINE *)lwg1, (LWLINE *)lwg2, dl);
644 }
645 else if (t2 == POLYGONTYPE)
646 {
647 dl->twisted = 1;
648 return lw_dist3d_line_poly((LWLINE *)lwg1, (LWPOLY *)lwg2, dl);
649 }
650 else if (t2 == TRIANGLETYPE)
651 {
652 dl->twisted = 1;
653 return lw_dist3d_line_tri((LWLINE *)lwg1, (LWTRIANGLE *)lwg2, dl);
654 }
655 else
656 {
657 lwerror("%s: Unsupported geometry type: %s", __func__, lwtype_name(t2));
658 return LW_FALSE;
659 }
660 }
661 else if (t1 == POLYGONTYPE)
662 {
663 if (t2 == POLYGONTYPE)
664 {
665 dl->twisted = 1;
666 return lw_dist3d_poly_poly((LWPOLY *)lwg1, (LWPOLY *)lwg2, dl);
667 }
668 else if (t2 == POINTTYPE)
669 {
670 dl->twisted = -1;
671 return lw_dist3d_point_poly((LWPOINT *)lwg2, (LWPOLY *)lwg1, dl);
672 }
673 else if (t2 == LINETYPE)
674 {
675 dl->twisted = -1;
676 return lw_dist3d_line_poly((LWLINE *)lwg2, (LWPOLY *)lwg1, dl);
677 }
678 else if (t2 == TRIANGLETYPE)
679 {
680 dl->twisted = 1;
681 return lw_dist3d_poly_tri((LWPOLY *)lwg1, (LWTRIANGLE *)lwg2, dl);
682 }
683 else
684 {
685 lwerror("%s: Unsupported geometry type: %s", __func__, lwtype_name(t2));
686 return LW_FALSE;
687 }
688 }
689 else if (t1 == TRIANGLETYPE)
690 {
691 if (t2 == POLYGONTYPE)
692 {
693 dl->twisted = -1;
694 return lw_dist3d_poly_tri((LWPOLY *)lwg2, (LWTRIANGLE *)lwg1, dl);
695 }
696 else if (t2 == POINTTYPE)
697 {
698 dl->twisted = -1;
699 return lw_dist3d_point_tri((LWPOINT *)lwg2, (LWTRIANGLE *)lwg1, dl);
700 }
701 else if (t2 == LINETYPE)
702 {
703 dl->twisted = -1;
704 return lw_dist3d_line_tri((LWLINE *)lwg2, (LWTRIANGLE *)lwg1, dl);
705 }
706 else if (t2 == TRIANGLETYPE)
707 {
708 dl->twisted = 1;
709 return lw_dist3d_tri_tri((LWTRIANGLE *)lwg1, (LWTRIANGLE *)lwg2, dl);
710 }
711 else
712 {
713 lwerror("%s: Unsupported geometry type: %s", __func__, lwtype_name(t2));
714 return LW_FALSE;
715 }
716 }
717
718 else
719 {
720 lwerror("%s: Unsupported geometry type: %s", __func__, lwtype_name(t1));
721 return LW_FALSE;
722 }
723}
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 POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:102
#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_dist3d_line_line(const LWLINE *line1, const LWLINE *line2, DISTPTS3D *dl)
line to line calculation
Definition measures3d.c:826
int lw_dist3d_tri_tri(const LWTRIANGLE *tri1, const LWTRIANGLE *tri2, DISTPTS3D *dl)
triangle to triangle calculation
Definition measures3d.c:952
int lw_dist3d_line_tri(const LWLINE *line, const LWTRIANGLE *tri, DISTPTS3D *dl)
line to triangle calculation
Definition measures3d.c:854
int lw_dist3d_point_poly(const LWPOINT *point, const LWPOLY *poly, DISTPTS3D *dl)
Computes point to polygon distance For mindistance that means: 1) find the plane of the polygon 2) pr...
Definition measures3d.c:778
int lw_dist3d_line_poly(const LWLINE *line, const LWPOLY *poly, DISTPTS3D *dl)
line to polygon calculation
Definition measures3d.c:837
int lw_dist3d_point_tri(const LWPOINT *point, const LWTRIANGLE *tri, DISTPTS3D *dl)
Definition measures3d.c:804
int lw_dist3d_point_point(const LWPOINT *point1, const LWPOINT *point2, DISTPTS3D *dl)
point to point calculation
Definition measures3d.c:739
int lw_dist3d_point_line(const LWPOINT *point, const LWLINE *line, DISTPTS3D *dl)
point to line calculation
Definition measures3d.c:755
int lw_dist3d_poly_tri(const LWPOLY *poly, const LWTRIANGLE *tri, DISTPTS3D *dl)
polygon to triangle calculation
Definition measures3d.c:911
int lw_dist3d_poly_poly(const LWPOLY *poly1, const LWPOLY *poly2, DISTPTS3D *dl)
polygon to polygon calculation
Definition measures3d.c:870
int twisted
Definition measures3d.h:45
uint8_t type
Definition liblwgeom.h:462

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

Referenced by lw_dist3d_recursive().

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