PostGIS  3.7.0dev-r@@SVN_REVISION@@
measures3d.c File Reference
#include <string.h>
#include <stdlib.h>
#include "measures3d.h"
#include "lwrandom.h"
#include "lwgeom_log.h"
Include dependency graph for measures3d.c:

Go to the source code of this file.

Functions

static int get_3dvector_from_points (const POINT3DZ *p1, const POINT3DZ *p2, VECTOR3D *v)
 
static int get_3dcross_product (const VECTOR3D *v1, const VECTOR3D *v2, VECTOR3D *v)
 
static double project_point_on_plane (const POINT3DZ *p, PLANE3D *pl, POINT3DZ *p0)
 Finds a point on a plane from where the original point is perpendicular to the plane. More...
 
static LWGEOMcreate_v_line (const LWGEOM *lwgeom, double x, double y, int32_t srid)
 This function is used to create a vertical line used for cases where one if the geometries lacks z-values. More...
 
LWGEOMlwgeom_closest_line_3d (const LWGEOM *lw1, const LWGEOM *lw2)
 
LWGEOMlwgeom_furthest_line_3d (LWGEOM *lw1, LWGEOM *lw2)
 
LWGEOMlwgeom_closest_point_3d (const LWGEOM *lw1, const LWGEOM *lw2)
 
LWGEOMlw_dist3d_distanceline (const LWGEOM *lw1, const LWGEOM *lw2, int32_t srid, int mode)
 Function initializing 3dshortestline and 3dlongestline calculations. More...
 
LWGEOMlw_dist3d_distancepoint (const LWGEOM *lw1, const LWGEOM *lw2, int32_t srid, int mode)
 Function initializing 3dclosestpoint calculations. More...
 
double lwgeom_maxdistance3d (const LWGEOM *lw1, const LWGEOM *lw2)
 Function initializing 3d max distance calculation. More...
 
double lwgeom_maxdistance3d_tolerance (const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
 Function handling 3d max distance calculations and dfullywithin calculations. More...
 
double lwgeom_mindistance3d (const LWGEOM *lw1, const LWGEOM *lw2)
 Function initializing 3d min distance calculation. More...
 
static int gbox_contains_3d (const GBOX *g1, const GBOX *g2)
 
static int lwgeom_solid_contains_lwgeom (const LWGEOM *solid, const LWGEOM *g)
 
double lwgeom_mindistance3d_tolerance (const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
 Function handling 3d min distance calculations and dwithin calculations. More...
 
int lw_dist3d_recursive (const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS3D *dl)
 This is a recursive function delivering every possible combination of subgeometries. More...
 
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. More...
 
int lw_dist3d_point_point (const LWPOINT *point1, const LWPOINT *point2, DISTPTS3D *dl)
 point to point calculation More...
 
int lw_dist3d_point_line (const LWPOINT *point, const LWLINE *line, DISTPTS3D *dl)
 point to line calculation More...
 
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) projecting the point to the plane of the polygon 3) finding if that projected point is inside the polygon, if so the distance is measured to that projected point 4) if not in polygon above, check the distance against the boundary of the polygon for max distance it is always point against boundary. More...
 
int lw_dist3d_point_tri (const LWPOINT *point, const LWTRIANGLE *tri, DISTPTS3D *dl)
 
int lw_dist3d_line_line (const LWLINE *line1, const LWLINE *line2, DISTPTS3D *dl)
 line to line calculation More...
 
int lw_dist3d_line_poly (const LWLINE *line, const LWPOLY *poly, DISTPTS3D *dl)
 line to polygon calculation More...
 
int lw_dist3d_line_tri (const LWLINE *line, const LWTRIANGLE *tri, DISTPTS3D *dl)
 line to triangle calculation More...
 
int lw_dist3d_poly_poly (const LWPOLY *poly1, const LWPOLY *poly2, DISTPTS3D *dl)
 polygon to polygon calculation More...
 
int lw_dist3d_poly_tri (const LWPOLY *poly, const LWTRIANGLE *tri, DISTPTS3D *dl)
 polygon to triangle calculation More...
 
int lw_dist3d_tri_tri (const LWTRIANGLE *tri1, const LWTRIANGLE *tri2, DISTPTS3D *dl)
 triangle to triangle calculation More...
 
int lw_dist3d_pt_ptarray (const POINT3DZ *p, const POINTARRAY *pa, DISTPTS3D *dl)
 search all the segments of pointarray to see which one is closest to p Returns distance between point and pointarray More...
 
int lw_dist3d_pt_seg (const POINT3DZ *p, const POINT3DZ *A, const POINT3DZ *B, DISTPTS3D *dl)
 If searching for min distance, this one finds the closest point on segment A-B from p. More...
 
double distance3d_pt_pt (const POINT3D *p1, const POINT3D *p2)
 
int lw_dist3d_pt_pt (const POINT3DZ *thep1, const POINT3DZ *thep2, DISTPTS3D *dl)
 Compares incoming points and stores the points closest to each other or most far away from each other depending on dl->mode (max or min) More...
 
int lw_dist3d_ptarray_ptarray (const POINTARRAY *l1, const POINTARRAY *l2, DISTPTS3D *dl)
 Finds all combinations of segments between two pointarrays. More...
 
int lw_dist3d_seg_seg (const POINT3DZ *s1p1, const POINT3DZ *s1p2, const POINT3DZ *s2p1, const POINT3DZ *s2p2, DISTPTS3D *dl)
 Finds the two closest points on two linesegments. More...
 
int lw_dist3d_pt_poly (const POINT3DZ *p, const LWPOLY *poly, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl)
 Checking if the point projected on the plane of the polygon actually is inside that polygon. More...
 
int lw_dist3d_pt_tri (const POINT3DZ *p, const LWTRIANGLE *tri, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl)
 
int lw_dist3d_ptarray_poly (const POINTARRAY *pa, const LWPOLY *poly, PLANE3D *plane, DISTPTS3D *dl)
 Computes pointarray to polygon distance. More...
 
int lw_dist3d_ptarray_tri (const POINTARRAY *pa, const LWTRIANGLE *tri, PLANE3D *plane, DISTPTS3D *dl)
 Computes pointarray to triangle distance. More...
 
int define_plane (const POINTARRAY *pa, PLANE3D *pl)
 
int pt_in_ring_3d (const POINT3DZ *p, const POINTARRAY *ring, PLANE3D *plane)
 pt_in_ring_3d(): crossing number test for a point in a polygon input: p = a point, pa = vertex points of a ring V[n+1] with V[n]=V[0] plane=the plane that the vertex points are lying on returns: 0 = outside, 1 = inside More...