Computes pointarray to polygon distance.
1294{
1295 uint32_t i, j, k;
1296 double f, s1, s2;
1298 POINT3DZ p1, p2, projp1, projp2, intersectionp;
1299
1301
1302
1307
1308 for (i = 1; i < pa->
npoints; i++)
1309 {
1310 int intersects;
1316
1317
1318
1319 if ((s1 * s2) < 0)
1320 {
1321
1322 f = fabs(s1) / (fabs(s1) + fabs(s2));
1324
1325
1326 intersectionp.
x = projp1.
x + f * projp1_projp2.
x;
1327 intersectionp.
y = projp1.
y + f * projp1_projp2.
y;
1328 intersectionp.
z = projp1.
z + f * projp1_projp2.
z;
1329
1330
1332
1334 {
1335 for (k = 1; k < poly->
nrings; k++)
1336 {
1337
1339 {
1341 break;
1342 }
1343 }
1344 if (intersects)
1345 {
1347 dl->
p1.
x = intersectionp.
x;
1348 dl->
p1.
y = intersectionp.
y;
1349 dl->
p1.
z = intersectionp.
z;
1350
1351 dl->
p2.
x = intersectionp.
x;
1352 dl->
p2.
y = intersectionp.
y;
1353 dl->
p2.
z = intersectionp.
z;
1355 }
1356 }
1357 }
1358
1359 projp1 = projp2;
1360 s1 = s2;
1361 p1 = p2;
1362 }
1363
1364
1365 for (j = 0; j < poly->
nrings; j++)
1367
1369}
int getPoint3dz_p(const POINTARRAY *pa, uint32_t n, POINT3DZ *point)
#define LW_TRUE
Return types for functions with status returns.
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,...
static int get_3dvector_from_points(POINT3DZ *p1, POINT3DZ *p2, VECTOR3D *v)
int lw_dist3d_pt_poly(POINT3DZ *p, LWPOLY *poly, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl)
Checking if the point projected on the plane of the polygon actually is inside that polygon.
double project_point_on_plane(POINT3DZ *p, PLANE3D *pl, POINT3DZ *p0)
Finds a point on a plane from where the original point is perpendicular to the plane.
int lw_dist3d_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2, DISTPTS3D *dl)
Finds all combinations of segments between two pointarrays.