17 #include "CUnit/Basic.h" 33 #define DIST2DTEST(str1, str2, res) \ 34 do_test_mindistance_tolerance(str1, str2, res, __LINE__, lwgeom_mindistance2d_tolerance);\ 35 do_test_mindistance_tolerance(str2, str1, res, __LINE__, lwgeom_mindistance2d_tolerance) 36 #define DIST3DTEST(str1, str2, res) \ 37 do_test_mindistance_tolerance(str1, str2, res, __LINE__, lwgeom_mindistance3d_tolerance) 44 double (*distancef)(
const LWGEOM *,
const LWGEOM *,
double))
49 char *msg1 =
"test_mindistance2d_tolerance failed (got %g expected %g) at line %d\n";
50 char *msg2 =
"\n\ndo_test_mindistance2d_tolerance: NULL lwgeom generated from WKT\n %s\n\n";
66 distance = distancef(lw1, lw2, 0.0);
70 if ( fabs(distance - expected_res) > 0.00001 )
72 printf(msg1, distance, expected_res, line);
87 DIST2DTEST(
"POINT(0 0)",
"MULTIPOINT(0 1.5,0 2,0 2.5)", 1.5);
92 DIST2DTEST(
"POINT(0 0)",
"GEOMETRYCOLLECTION(POINT(3 4))", 5.0);
97 DIST2DTEST(
"POINT(0 0)",
"GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(3 4)))", 5.0);
102 DIST2DTEST(
"POINT(0 0)",
"GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(3 4))))", 5.0);
107 DIST2DTEST(
"POINT(0 0)",
"GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT(3 4))))", 5.0);
112 DIST2DTEST(
"GEOMETRYCOLLECTION(POINT(0 0))",
"GEOMETRYCOLLECTION(POINT(3 4))", 5.0);
117 DIST2DTEST(
"GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(0 0)))",
"GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(3 4)))", 5.0);
122 DIST2DTEST(
"GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT(0 0)))",
"GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT(3 4)))", 5.0);
127 DIST2DTEST(
"LINESTRING(-2 0, -0.2 0)",
"POINT(-2 0)", 0);
132 DIST2DTEST(
"LINESTRING(-0.2 0, -2 0)",
"POINT(-2 0)", 0);
137 DIST2DTEST(
"LINESTRING(-1e-8 0, -0.2 0)",
"POINT(-1e-8 0)", 0);
142 DIST2DTEST(
"LINESTRING(-0.2 0, -1e-8 0)",
"POINT(-1e-8 0)", 0);
147 DIST2DTEST(
"CIRCULARSTRING(-1 0, 0 1, 1 0)",
"POINT(0 0)", 1);
148 DIST2DTEST(
"CIRCULARSTRING(-3 0, -2 0, -1 0, 0 1, 1 0)",
"POINT(0 0)", 1);
153 DIST2DTEST(
"CIRCULARSTRING(-1 0, 0 1, 1 0)",
"CIRCULARSTRING(0 0, 1 -1, 2 0)", 1);
158 static char *cs1 =
"CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(1 6, 6 1, 9 7),(9 7, 3 13, 1 6)),COMPOUNDCURVE((3 6, 5 4, 7 4, 7 6),CIRCULARSTRING(7 6,5 8,3 6)))";
167 DIST2DTEST(cs1,
"LINESTRING(0 0, 50 0)", 0.917484);
170 DIST2DTEST(cs1,
"LINESTRING(4 7, 5 6, 6 7)", 0.585786);
171 DIST2DTEST(cs1,
"LINESTRING(10 0, 10 2, 10 0)", 1.52913);
176 DIST2DTEST(cs1,
"POLYGON((10 4, 10 8, 13 8, 13 4, 10 4))", 0.58415);
177 DIST2DTEST(cs1,
"POLYGON((9 4, 9 8, 12 8, 12 4, 9 4))", 0);
178 DIST2DTEST(cs1,
"POLYGON((1 4, 1 8, 4 8, 4 4, 1 4))", 0);
183 DIST2DTEST(cs1,
"CURVEPOLYGON(CIRCULARSTRING(-1 4, 0 5, 1 4, 0 3, -1 4))", 0.0475666);
184 DIST2DTEST(cs1,
"CURVEPOLYGON(CIRCULARSTRING(1 4, 2 5, 3 4, 2 3, 1 4))", 0.0);
189 static char *cs2 =
"MULTISURFACE(POLYGON((0 0,0 4,4 4,4 0,0 0)),CURVEPOLYGON(CIRCULARSTRING(8 2,10 4,12 2,10 0,8 2)))";
190 DIST2DTEST(cs2,
"CURVEPOLYGON(CIRCULARSTRING(5 2,6 3,7 2,6 1,5 2))", 1);
191 DIST2DTEST(cs2,
"CURVEPOLYGON(CIRCULARSTRING(4 2,5 3,6 2,5 1,4 2))", 0);
192 DIST2DTEST(cs2,
"CURVEPOLYGON(CIRCULARSTRING(5 3,6 2,5 1,4 2,5 3))", 0);
193 DIST2DTEST(cs2,
"CURVEPOLYGON(CIRCULARSTRING(4.5 3,5.5 2,4.5 1,3.5 2,4.5 3))", 0);
194 DIST2DTEST(cs2,
"CURVEPOLYGON(CIRCULARSTRING(5.5 3,6.5 2,5.5 1,4.5 2,5.5 3))", 0.5);
195 DIST2DTEST(cs2,
"CURVEPOLYGON(CIRCULARSTRING(10 3,11 2,10 1,9 2,10 3))", 0);
196 DIST2DTEST(cs2,
"CURVEPOLYGON(CIRCULARSTRING(2 3,3 2,2 1,1 2,2 3))", 0);
197 DIST2DTEST(cs2,
"CURVEPOLYGON(CIRCULARSTRING(5 7,6 8,7 7,6 6,5 7))", 2.60555);
202 DIST2DTEST(
"LINESTRING(0.5 1,0.5 3)",
"MULTICURVE(CIRCULARSTRING(2 3,3 2,2 1,1 2,2 3),(0 0, 0 5))", 0.5);
210 DIST3DTEST(
"POINT(0 0 0)",
"MULTIPOINT(0 1.5 0, 0 2 0, 0 2.5 0)", 1.5);
211 DIST3DTEST(
"POINT(0 0 0)",
"MULTIPOINT(0 1.5 0, 0 2 0, 0 2.5 0)", 1.5);
212 DIST3DTEST(
"POINT(0 0 0)",
"GEOMETRYCOLLECTION(POINT(3 4 0))", 5.0);
213 DIST3DTEST(
"POINT(0 0 0)",
"GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(3 4 0)))", 5.0);
214 DIST3DTEST(
"POINT(0 0 0)",
"GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(3 4 0))))", 5.0);
215 DIST3DTEST(
"POINT(0 0)",
"GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT(3 4))))", 5.0);
216 DIST3DTEST(
"GEOMETRYCOLLECTION(POINT(0 0 0))",
"GEOMETRYCOLLECTION(POINT(3 4 0))", 5.0);
217 DIST3DTEST(
"GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(0 0 0)))",
218 "GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(3 4 0)))",
220 DIST3DTEST(
"GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT(0 0 0)))",
221 "GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT(3 4 0)))",
223 DIST3DTEST(
"LINESTRING(-2 0 0, -0.2 0 0)",
"POINT(-2 0 0)", 0);
224 DIST3DTEST(
"LINESTRING(-0.2 0 0, -2 0 0)",
"POINT(-2 0 0)", 0);
225 DIST3DTEST(
"LINESTRING(-1e-8 0 0, -0.2 0 0)",
"POINT(-1e-8 0 0)", 0);
226 DIST3DTEST(
"LINESTRING(-0.2 0 0, -1e-8 0 0)",
"POINT(-1e-8 0 0)", 0);
229 DIST3DTEST(
"LINESTRING(1 0 0 , 2 0 0)",
"POLYGON((1 1 0, 2 1 0, 2 2 0, 1 2 0, 1 1 0))", 1.0);
230 DIST3DTEST(
"LINESTRING(1 1 1 , 2 1 0)",
"POLYGON((1 1 0, 2 1 0, 2 2 0, 1 2 0, 1 1 0))", 0.0);
231 DIST3DTEST(
"LINESTRING(1 1 1 , 2 1 1)",
"POLYGON((1 1 0, 2 1 0, 2 2 0, 1 2 0, 1 1 0))", 1.0);
233 DIST3DTEST(
"LINESTRING(1 1 1 , 2 2 2)",
"POLYGON((0 0 0, 2 2 2, 3 3 1, 0 0 0))", 0.0);
236 DIST3DTEST(
"LINESTRING(-10000 -10000 0, 0 0 1)",
"POLYGON((0 0 0, 1 0 0, 1 1 0, 0 1 0, 0 0 0))", 1);
239 DIST3DTEST(
"LINESTRING(1 1 1 , 2 2 2)",
"POLYGON((0 0 0, 2 2 2, 3 3 3, 0 0 0))", 0);
259 CU_ASSERT_NOT_EQUAL(result, 0);
266 CU_ASSERT_EQUAL(result, 0);
280 CU_ASSERT_EQUAL(result, 0);
287 CU_ASSERT_EQUAL(result, 0);
294 CU_ASSERT_NOT_EQUAL(result, 0);
301 CU_ASSERT_EQUAL(boundary, 1);
308 CU_ASSERT_EQUAL(boundary, 1);
315 CU_ASSERT_EQUAL(boundary, 1);
322 CU_ASSERT_EQUAL(boundary, 1);
328 poly = (
LWPOLY*)
lwgeom_from_wkt(
"POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
LW_PARSER_CHECK_NONE);
336 CU_ASSERT_EQUAL(result, 0);
343 CU_ASSERT_EQUAL(result, 0);
350 CU_ASSERT_NOT_EQUAL(result, 0);
357 CU_ASSERT_EQUAL(boundary, 1);
364 CU_ASSERT_EQUAL(boundary, 1);
371 CU_ASSERT_EQUAL(boundary, 1);
378 CU_ASSERT_EQUAL(boundary, 1);
385 CU_ASSERT_EQUAL(boundary, 1);
399 poly1 = (
LWPOLY*)
lwgeom_from_wkt(
"POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
LW_PARSER_CHECK_NONE);
400 poly2 = (
LWPOLY*)
lwgeom_from_wkt(
"POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
LW_PARSER_CHECK_NONE);
404 CU_ASSERT_EQUAL(result,
LW_TRUE);
411 poly1 = (
LWPOLY*)
lwgeom_from_wkt(
"POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
LW_PARSER_CHECK_NONE);
423 poly1 = (
LWPOLY*)
lwgeom_from_wkt(
"POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
LW_PARSER_CHECK_NONE);
428 CU_ASSERT_EQUAL(result,
LW_TRUE);
435 poly1 = (
LWPOLY*)
lwgeom_from_wkt(
"POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
LW_PARSER_CHECK_NONE);
440 CU_ASSERT_EQUAL(result,
LW_TRUE);
455 CU_ASSERT_STRING_EQUAL(strout,
"LINESTRING(0 0,5 0,10 0)");
465 CU_ASSERT_EQUAL(lineout, NULL);
471 CU_ASSERT_EQUAL(lineout, NULL);
475 "MULTIPOLYGON(((0 0,20 0,20 20,0 20,0 0),(2 2,2 4,4 4,4 2,2 2),(6 6,6 8,8 8,8 6,6 6)),((40 0,40 20,60 20,60 0,40 0),(42 2,42 4,44 4,44 2,42 2)))" 479 CU_ASSERT_EQUAL(lineout, NULL);
483 "GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,20 0,20 20,0 20,0 0),(2 2,2 4,4 4,4 2,2 2),(6 6,6 8,8 8,8 6,6 6)),((40 0,40 20,60 20,60 0,40 0),(42 2,42 4,44 4,44 2,42 2))),MULTILINESTRING((0 0,10 0),(20 0, 30 0)),MULTIPOINT(0 0, 3 4))" 485 CU_ASSERT_FATAL(linein != NULL);
488 CU_ASSERT_EQUAL(lineout, NULL);
495 CU_ASSERT_STRING_EQUAL(strout,
"LINESTRING(20 0,25 0,30 0)");
506 double measure = 105.0;
515 CU_ASSERT_STRING_EQUAL(
"MULTIPOINT M (55.226131 55.226131 105)", str);
524 CU_ASSERT_STRING_EQUAL(
"MULTIPOINT M (55.226131 55.226131 105)", str);
546 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.5, 0.000001);
553 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.5, 0.000001);
560 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, sqrt(2.0), 0.000001);
567 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, sqrt(2.0)-1, 0.000001);
574 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0, 0.000001);
581 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0, 0.000001);
588 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1, 0.000001);
598 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.5, 0.000001);
621 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1, 0.000001);
629 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1, 0.000001);
633 A1.
x = -2; A1.
y = -2;
637 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1, 0.000001);
642 A2.
x = 0; A2.
y = 0.5;
645 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.5, 0.000001);
653 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0., 0.000001);
661 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, sqrt(2.0)-1, 0.000001);
669 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0, 0.000001);
678 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, sqrt(2.0)-1, 0.000001);
688 POINT2D A1, A2, A3, B1, B2, B3;
693 A1.
x = -1.0; A1.
y = 4.0;
694 A2.
x = 0.0; A2.
y = 5.0;
695 A3.
x = 1.0; A3.
y = 4.0;
696 B1.
x = 1.0; B1.
y = 6.0;
697 B2.
x = 6.0; B2.
y = 1.0;
698 B3.
x = 9.0; B3.
y = 7.0;
701 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.0475666, 0.000001);
715 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1, 0.000001);
724 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0, 0.000001);
733 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, sqrt(2)-1, 0.000001);
742 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0, 0.000001);
746 A1.
x = -2.0; A1.
y = 0.0;
747 A2.
x = 0.0; A2.
y = 2.0;
748 A3.
x = 2.0; A3.
y = 0.0;
751 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1.0, 0.000001);
755 A1.
x = -0.5 / sqrt(2.0); A1.
y = 0.5 / sqrt(2.0);
756 A2.
x = 0.0; A2.
y = 0.5;
757 A3.
x = 0.5 / sqrt(2.0); A3.
y = 0.5 / sqrt(2.0);
760 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.5, 0.000001);
764 A1.
x = -0.5 / sqrt(2.0); A1.
y = -0.5 / sqrt(2.0);
765 A2.
x = -0.5; A2.
y = 0.0;
766 A3.
x = -0.5 / sqrt(2.0); A3.
y = 0.5 / sqrt(2.0);
769 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.5, 0.000001);
773 A1.
x = -0.5 / sqrt(2.0); A1.
y = -0.5 / sqrt(2.0);
774 A2.
x = 0.0; A2.
y = -0.5;
775 A3.
x = 0.5 / sqrt(2.0); A3.
y = -0.5 / sqrt(2.0);
778 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.736813, 0.000001);
782 A1.
x = -1.0; A1.
y = 0.0;
783 A2.
x = 0.0; A2.
y = 1.0;
784 A3.
x = 1.0; A3.
y = 0.0;
787 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.0, 0.000001);
790 B1.
x = -10.0; B1.
y = 0.0;
791 B2.
x = 0.0 ; B2.
y = 10.0;
792 B3.
x = 10.0 ; B3.
y = 0.0;
795 A1.
x = -22.0; A1.
y = 0.0;
796 A2.
x = -17.0; A2.
y = -5.0;
797 A3.
x = -12.0; A3.
y = 0.0;
800 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 2.0, 0.000001);
803 A1.
x = -19.0; A1.
y = 0.0;
804 A2.
x = -14.0; A2.
y = -5.0;
805 A3.
x = - 9.0; A3.
y = 0.0;
808 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1.0, 0.000001);
811 A1.
x = -9.0; A1.
y = 0.0;
812 A2.
x = -4.0; A2.
y = -5.0;
813 A3.
x = 1.0; A3.
y = 0.0;
816 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1.0, 0.000001);
819 A1.
x = -1.0; A1.
y = 0.0;
820 A2.
x = 4.0; A2.
y = -5.0;
821 A3.
x = 9.0; A3.
y = 0.0;
824 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1.0, 0.000001);
827 A1.
x = 1.0; A1.
y = 0.0;
828 A2.
x = 6.0; A2.
y = -5.0;
829 A3.
x = 11.0; A3.
y = 0.0;
832 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1.0, 0.000001);
835 A1.
x = 11.0; A1.
y = 0.0;
836 A2.
x = 16.0; A2.
y = -5.0;
837 A3.
x = 21.0; A3.
y = 0.0;
840 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1.0, 0.000001);
844 A1.
x = -15.0; A1.
y = -6.0;
845 A2.
x = -10.0; A2.
y = -1.0;
846 A3.
x = - 5.0; A3.
y = -6.0;
849 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1.0, 0.000001);
852 A1.
x = -5.0; A1.
y = 0.0;
853 A2.
x = 0.0; A2.
y = 5.0;
854 A3.
x = 5.0; A3.
y = 0.0;
857 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 5.0, 0.000001);
860 A1.
x = -5.0; A1.
y = 0.0;
861 A2.
x = 0.0; A2.
y = -5.0;
862 A3.
x = 5.0; A3.
y = 0.0;
865 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 5.0, 0.000001);
884 CU_ASSERT_DOUBLE_EQUAL(d, M_PI, 0.000001);
886 CU_ASSERT_DOUBLE_EQUAL(d, M_PI, 0.000001);
895 CU_ASSERT_DOUBLE_EQUAL(d, M_PI, 0.000001);
897 CU_ASSERT_DOUBLE_EQUAL(d, M_PI, 0.000001);
906 CU_ASSERT_DOUBLE_EQUAL(d, 3*M_PI_2, 0.000001);
908 CU_ASSERT_DOUBLE_EQUAL(d, 3*M_PI_2, 0.000001);
928 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1, 0.000001);
935 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1, 0.000001);
938 P.
y = P.
x = 2 * cos(M_PI_4);
942 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1, 0.000001);
953 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, sqrt(2.0), 0.000001);
960 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1, 0.000001);
967 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.5, 0.000001);
974 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.5, 0.000001);
981 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.5, 0.000001);
988 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, sqrt(2.0)-1.0, 0.000001);
1011 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1, 0.000001);
1019 CU_ASSERT_STRING_EQUAL(
"lw_dist2d_ptarray_ptarrayarc called with non-arc input",
cu_error_msg);
1028 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 1, 0.000001);
1037 CU_ASSERT_DOUBLE_EQUAL(dl.
distance, 0.5, 0.000001);
1057 CU_ASSERT_STRING_EQUAL(
1058 "Both input geometries must have a measure dimension",
1070 CU_ASSERT_STRING_EQUAL(
1071 "Both input geometries must be linestrings",
1085 CU_ASSERT_STRING_EQUAL(
1086 "Both input lines must have at least 2 points",
1098 CU_ASSERT_STRING_EQUAL(
1099 "Both input lines must have at least 2 points",
1337 CU_pSuite suite = CU_add_suite(
"measures", NULL, NULL);
static void test_lw_dist2d_seg_arc(void)
#define DIST3DTEST(str1, str2, res)
int lwgeom_is_trajectory(const LWGEOM *geom)
Return LW_TRUE or LW_FALSE depending on whether or not a geometry is a linestring with measure value ...
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
Datum boundary(PG_FUNCTION_ARGS)
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
void lwgeom_free(LWGEOM *geom)
void lwline_free(LWLINE *line)
static void test_mindistance3d_tolerance(void)
static LWGEOM * lwgeom_from_text(const char *str)
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
void lwgeom_request_interrupt(void)
Request interruption of any running code.
static void test_lw_dist2d_arc_arc(void)
int lw_dist2d_arc_arc(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3, const POINT2D *B1, const POINT2D *B2, const POINT2D *B3, DISTPTS *dl)
RECT_NODE * rect_tree_new(const POINTARRAY *pa)
Build a tree of nodes from a point array, one node per edge, and each with an associated measure rang...
static void test_lw_dist2d_pt_arc(void)
static void test_lwgeom_segmentize2d(void)
static void test_lw_dist2d_pt_ptarrayarc(void)
int lwgeom_cpa_within(const LWGEOM *g1, const LWGEOM *g2, double maxdist)
Is the closest point of approach within a distance ?
static void do_test_mindistance_tolerance(char *in1, char *in2, double expected_res, int line, double(*distancef)(const LWGEOM *, const LWGEOM *, double))
#define LW_PARSER_CHECK_NONE
int rect_tree_contains_point(const RECT_NODE *node, const POINT2D *pt, int *on_boundary)
static void test_lwgeom_tcpa(void)
double lw_arc_length(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3)
Returns the length of a circular arc segment.
int lwgeom_parse_wkt(LWGEOM_PARSER_RESULT *parser_result, char *wktstr, int parse_flags)
Parse a WKT geometry string into an LWGEOM structure.
void lwpoly_free(LWPOLY *poly)
void cu_error_msg_reset()
#define LW_TRUE
Return types for functions with status returns.
Parser result structure: returns the result of attempting to convert (E)WKT/(E)WKB to LWGEOM...
int lw_dist2d_ptarray_ptarrayarc(const POINTARRAY *pa, const POINTARRAY *pb, DISTPTS *dl)
Test each segment of pa against each arc of pb for distance.
int lw_dist2d_pt_arc(const POINT2D *P, const POINT2D *A1, const POINT2D *A2, const POINT2D *A3, DISTPTS *dl)
#define PG_ADD_TEST(suite, testfunc)
#define ASSERT_INT_EQUAL(o, e)
int lw_dist2d_pt_ptarrayarc(const POINT2D *p, const POINTARRAY *pa, DISTPTS *dl)
Search all the arcs of pointarray to see which one is closest to p1 Returns minimum distance between ...
Datum distance(PG_FUNCTION_ARGS)
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
static void test_rect_tree_contains_point(void)
#define DIST2DTEST(str1, str2, res)
void measures_suite_setup(void)
double lwgeom_tcpa(const LWGEOM *g1, const LWGEOM *g2, double *mindist)
Find the time of closest point of approach.
LWGEOM * lwgeom_locate_along(const LWGEOM *lwin, double m, double offset)
Determine the location(s) along a measured line where m occurs and return as a multipoint.
static void test_lwgeom_locate_along(void)
LWGEOM * lwgeom_segmentize2d(LWGEOM *line, double dist)
int rect_tree_intersects_tree(const RECT_NODE *n1, const RECT_NODE *n2)
static void test_mindistance2d_tolerance(void)
int lw_dist2d_seg_arc(const POINT2D *A1, const POINT2D *A2, const POINT2D *B1, const POINT2D *B2, const POINT2D *B3, DISTPTS *dl)
Calculate the shortest distance between an arc and an edge.
static void test_lw_dist2d_ptarray_ptarrayarc(void)
#define ASSERT_DOUBLE_EQUAL(o, e)
void rect_tree_free(RECT_NODE *node)
Recurse from top of node tree and free all children.
Structure used in distance-calculations.
void lw_dist2d_distpts_init(DISTPTS *dl, int mode)
char cu_error_msg[MAX_CUNIT_ERROR_LENGTH+1]
static void test_lwgeom_is_trajectory(void)
static void test_rect_tree_intersects_tree(void)
static void test_lw_arc_length(void)