CU_ASSERT_EQUAL(dist, 0.0);
lwline_free(line);
+ line = lwgeom_as_lwline(lwgeom_from_text("LINESTRING M (0 0 0, 10 0 20)"));
+
+ p.x = 5; p.y = 0;
+ loc = ptarray_locate_point(line->points, &p, &dist, &l);
+ CU_ASSERT_EQUAL(loc, 0.5);
+ CU_ASSERT_EQUAL(dist, 0.0);
+ CU_ASSERT_EQUAL(l.m, 10.0);
+
+ lwline_free(line);
+
}
static void test_ptarray_isccw(void)
LWDEBUGF(3, "mindist: %g", mindist);
/*
- * If mindist is not 0 we need to project the
+ * We need to project the
* point on the closest segment.
*/
- if ( FP_GT(mindist, 0.0) )
- {
- getPoint4d_p(pa, seg, &start4d);
- getPoint4d_p(pa, seg+1, &end4d);
- closest_point_on_segment(p4d, &start4d, &end4d, proj4d);
- }
- else
- {
- if ( proj4d)
- *proj4d = *p4d;
- }
+ getPoint4d_p(pa, seg, &start4d);
+ getPoint4d_p(pa, seg+1, &end4d);
+ closest_point_on_segment(p4d, &start4d, &end4d, proj4d);
/* Copy 4D values into 2D holder */
proj.x = proj4d->x;