Computes pointarray to triangle distance.
1414{
1415 uint32_t i;
1416 double f, s1, s2;
1418 POINT3DZ p1, p2, projp1, projp2, intersectionp;
1419
1421
1422
1427
1428 for (i = 1; i < pa->
npoints; i++)
1429 {
1430 int intersects;
1436
1437
1438
1439
1440 if ((s1 * s2) < 0)
1441 {
1442
1443 f = fabs(s1) / (fabs(s1) + fabs(s2));
1445
1446
1447 intersectionp.
x = projp1.
x + f * projp1_projp2.
x;
1448 intersectionp.
y = projp1.
y + f * projp1_projp2.
y;
1449 intersectionp.
z = projp1.
z + f * projp1_projp2.
z;
1450
1451
1453
1455 {
1456 if (intersects)
1457 {
1459 dl->
p1.
x = intersectionp.
x;
1460 dl->
p1.
y = intersectionp.
y;
1461 dl->
p1.
z = intersectionp.
z;
1462
1463 dl->
p2.
x = intersectionp.
x;
1464 dl->
p2.
y = intersectionp.
y;
1465 dl->
p2.
z = intersectionp.
z;
1467 }
1468 }
1469 }
1470
1471 projp1 = projp2;
1472 s1 = s2;
1473 p1 = p2;
1474 }
1475
1476
1479}
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(const POINT3DZ *p1, const POINT3DZ *p2, 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.
int lw_dist3d_ptarray_ptarray(const POINTARRAY *l1, const POINTARRAY *l2, DISTPTS3D *dl)
Finds all combinations of segments between two pointarrays.
int lw_dist3d_pt_tri(const POINT3DZ *p, const LWTRIANGLE *tri, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl)