PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void test_mindistance2d_tolerance ( void  )
static

Definition at line 71 of file cu_measures.c.

References DIST2DTEST.

Referenced by measures_suite_setup().

72 {
73  /*
74  ** Simple case.
75  */
76  DIST2DTEST("POINT(0 0)", "MULTIPOINT(0 1.5,0 2,0 2.5)", 1.5);
77 
78  /*
79  ** Point vs Geometry Collection.
80  */
81  DIST2DTEST("POINT(0 0)", "GEOMETRYCOLLECTION(POINT(3 4))", 5.0);
82 
83  /*
84  ** Point vs Geometry Collection Collection.
85  */
86  DIST2DTEST("POINT(0 0)", "GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(3 4)))", 5.0);
87 
88  /*
89  ** Point vs Geometry Collection Collection Collection.
90  */
91  DIST2DTEST("POINT(0 0)", "GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(3 4))))", 5.0);
92 
93  /*
94  ** Point vs Geometry Collection Collection Collection Multipoint.
95  */
96  DIST2DTEST("POINT(0 0)", "GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT(3 4))))", 5.0);
97 
98  /*
99  ** Geometry Collection vs Geometry Collection
100  */
101  DIST2DTEST("GEOMETRYCOLLECTION(POINT(0 0))", "GEOMETRYCOLLECTION(POINT(3 4))", 5.0);
102 
103  /*
104  ** Geometry Collection Collection vs Geometry Collection Collection
105  */
106  DIST2DTEST("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(0 0)))", "GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(3 4)))", 5.0);
107 
108  /*
109  ** Geometry Collection Collection Multipoint vs Geometry Collection Collection Multipoint
110  */
111  DIST2DTEST("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT(0 0)))", "GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT(3 4)))", 5.0);
112 
113  /*
114  ** Linestring vs its start point
115  */
116  DIST2DTEST("LINESTRING(-2 0, -0.2 0)", "POINT(-2 0)", 0);
117 
118  /*
119  ** Linestring vs its end point
120  */
121  DIST2DTEST("LINESTRING(-0.2 0, -2 0)", "POINT(-2 0)", 0);
122 
123  /*
124  ** Linestring vs its start point (tricky number, see #1459)
125  */
126  DIST2DTEST("LINESTRING(-1e-8 0, -0.2 0)", "POINT(-1e-8 0)", 0);
127 
128  /*
129  ** Linestring vs its end point (tricky number, see #1459)
130  */
131  DIST2DTEST("LINESTRING(-0.2 0, -1e-8 0)", "POINT(-1e-8 0)", 0);
132 
133  /*
134  * Circular string and point
135  */
136  DIST2DTEST("CIRCULARSTRING(-1 0, 0 1, 1 0)", "POINT(0 0)", 1);
137  DIST2DTEST("CIRCULARSTRING(-3 0, -2 0, -1 0, 0 1, 1 0)", "POINT(0 0)", 1);
138 
139  /*
140  * Circular string and Circular string
141  */
142  DIST2DTEST("CIRCULARSTRING(-1 0, 0 1, 1 0)", "CIRCULARSTRING(0 0, 1 -1, 2 0)", 1);
143 
144  /*
145  * CurvePolygon and Point
146  */
147  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)))";
148  DIST2DTEST(cs1, "POINT(3 14)", 1);
149  DIST2DTEST(cs1, "POINT(3 8)", 0);
150  DIST2DTEST(cs1, "POINT(6 5)", 1);
151  DIST2DTEST(cs1, "POINT(6 4)", 0);
152 
153  /*
154  * CurvePolygon and Linestring
155  */
156  DIST2DTEST(cs1, "LINESTRING(0 0, 50 0)", 0.917484);
157  DIST2DTEST(cs1, "LINESTRING(6 0, 10 7)", 0);
158  DIST2DTEST(cs1, "LINESTRING(4 4, 4 8)", 0);
159  DIST2DTEST(cs1, "LINESTRING(4 7, 5 6, 6 7)", 0.585786);
160  DIST2DTEST(cs1, "LINESTRING(10 0, 10 2, 10 0)", 1.52913);
161 
162  /*
163  * CurvePolygon and Polygon
164  */
165  DIST2DTEST(cs1, "POLYGON((10 4, 10 8, 13 8, 13 4, 10 4))", 0.58415);
166  DIST2DTEST(cs1, "POLYGON((9 4, 9 8, 12 8, 12 4, 9 4))", 0);
167  DIST2DTEST(cs1, "POLYGON((1 4, 1 8, 4 8, 4 4, 1 4))", 0);
168 
169  /*
170  * CurvePolygon and CurvePolygon
171  */
172  DIST2DTEST(cs1, "CURVEPOLYGON(CIRCULARSTRING(-1 4, 0 5, 1 4, 0 3, -1 4))", 0.0475666);
173  DIST2DTEST(cs1, "CURVEPOLYGON(CIRCULARSTRING(1 4, 2 5, 3 4, 2 3, 1 4))", 0.0);
174 
175  /*
176  * MultiSurface and CurvePolygon
177  */
178  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)))";
179  DIST2DTEST(cs2, "CURVEPOLYGON(CIRCULARSTRING(5 2,6 3,7 2,6 1,5 2))", 1);
180  DIST2DTEST(cs2, "CURVEPOLYGON(CIRCULARSTRING(4 2,5 3,6 2,5 1,4 2))", 0);
181  DIST2DTEST(cs2, "CURVEPOLYGON(CIRCULARSTRING(5 3,6 2,5 1,4 2,5 3))", 0);
182  DIST2DTEST(cs2, "CURVEPOLYGON(CIRCULARSTRING(4.5 3,5.5 2,4.5 1,3.5 2,4.5 3))", 0);
183  DIST2DTEST(cs2, "CURVEPOLYGON(CIRCULARSTRING(5.5 3,6.5 2,5.5 1,4.5 2,5.5 3))", 0.5);
184  DIST2DTEST(cs2, "CURVEPOLYGON(CIRCULARSTRING(10 3,11 2,10 1,9 2,10 3))", 0);
185  DIST2DTEST(cs2, "CURVEPOLYGON(CIRCULARSTRING(2 3,3 2,2 1,1 2,2 3))", 0);
186  DIST2DTEST(cs2, "CURVEPOLYGON(CIRCULARSTRING(5 7,6 8,7 7,6 6,5 7))", 2.60555);
187 
188  /*
189  * MultiCurve and Linestring
190  */
191  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);
192 
193 }
#define DIST2DTEST(str1, str2, res)
Definition: cu_measures.c:31

Here is the caller graph for this function: