@@ -231,7 +231,7 @@ static void test_lwcurve_linearize(void)
231
231
*/
232
232
out = lwcurve_linearize (in , 500 , toltype , LW_LINEARIZE_FLAG_SYMMETRIC );
233
233
str = lwgeom_to_text (out , 2 );
234
- ASSERT_STRING_EQUAL (str , "LINESTRING(20 50,72 -66)" );
234
+ ASSERT_STRING_EQUAL (str , "LINESTRING(20 50,22 -18, 72 -66)" );
235
235
lwfree (str );
236
236
lwgeom_free (out );
237
237
@@ -240,7 +240,7 @@ static void test_lwcurve_linearize(void)
240
240
/*
241
241
* ROBUSTNESS: big radius, small tolerance
242
242
* See https://trac.osgeo.org/postgis/ticket/4058
243
- * NOTE: we are really only interested in not enterying
243
+ * NOTE: we are really only interested in not entering
244
244
* an infinite loop here
245
245
*/
246
246
toltype = LW_LINEARIZE_TOLERANCE_TYPE_MAX_DEVIATION ;
@@ -250,12 +250,12 @@ static void test_lwcurve_linearize(void)
250
250
"2695865.195999999996275 1125835.189000)" );
251
251
out = lwcurve_linearize (in , 0.0001 , toltype , 0 );
252
252
str = lwgeom_to_text (out , 2 );
253
- ASSERT_STRING_EQUAL (str , "LINESTRING(2696000 1125700,2695866 1125836)" );
253
+ ASSERT_STRING_EQUAL (str , "LINESTRING(2696000 1125700,2695932 1125768, 2695866 1125836)" );
254
254
lwfree (str );
255
255
lwgeom_free (out );
256
256
out = lwcurve_linearize (in , 0.0001 , toltype , LW_LINEARIZE_FLAG_SYMMETRIC );
257
257
str = lwgeom_to_text (out , 2 );
258
- ASSERT_STRING_EQUAL (str , "LINESTRING(2696000 1125700,2695866 1125836)" );
258
+ ASSERT_STRING_EQUAL (str , "LINESTRING(2696000 1125700,2695932 1125768, 2695866 1125836)" );
259
259
lwfree (str );
260
260
lwgeom_free (out );
261
261
#ifndef SKIP_TEST_RETAIN_ANGLE
@@ -280,36 +280,36 @@ static void test_lwcurve_linearize(void)
280
280
281
281
in = lwgeom_from_text ("CIRCULARSTRING(0 0,100 100,200 0)" );
282
282
283
- /* Maximum of 45 degrees, asymmetric */
283
+ /* Maximum of 45 degrees per segment , asymmetric */
284
284
out = lwcurve_linearize (in , M_PI / 4.0 , toltype , 0 );
285
285
str = lwgeom_to_text (out , 2 );
286
286
ASSERT_STRING_EQUAL (str , "LINESTRING(0 0,30 70,100 100,170 70,200 0)" );
287
287
lwfree (str );
288
288
lwgeom_free (out );
289
- /* Maximum of 0 degrees (invalid) */
289
+ /* Maximum of 0 degrees per segment (invalid) */
290
290
cu_error_msg_reset ();
291
291
out = lwcurve_linearize (in , 0 , toltype , 0 );
292
292
CU_ASSERT ( out == NULL );
293
293
ASSERT_STRING_EQUAL (cu_error_msg , "lwarc_linearize: max angle must be bigger than 0, got 0" );
294
- /* Maximum of -2 degrees (invalid) */
294
+ /* Maximum of -2 degrees per segment (invalid) */
295
295
cu_error_msg_reset ();
296
296
out = lwcurve_linearize (in , -2 , toltype , 0 );
297
297
CU_ASSERT ( out == NULL );
298
298
ASSERT_STRING_EQUAL (cu_error_msg , "lwarc_linearize: max angle must be bigger than 0, got -2" );
299
- /* Maximum of 360 degrees, just return endpoints ... */
299
+ /* Maximum of 360 degrees per segment , just return minimum of two segments ... */
300
300
cu_error_msg_reset ();
301
301
out = lwcurve_linearize (in , M_PI * 4 , toltype , 0 );
302
302
str = lwgeom_to_text (out , 2 );
303
- ASSERT_STRING_EQUAL (str , "LINESTRING(0 0,200 0)" );
303
+ ASSERT_STRING_EQUAL (str , "LINESTRING(0 0,100 100, 200 0)" );
304
304
lwfree (str );
305
305
lwgeom_free (out );
306
- /* Maximum of 70 degrees, asymmetric */
306
+ /* Maximum of 70 degrees per segment , asymmetric */
307
307
out = lwcurve_linearize (in , 70 * M_PI / 180 , toltype , 0 );
308
308
str = lwgeom_to_text (out , 2 );
309
309
ASSERT_STRING_EQUAL (str , "LINESTRING(0 0,66 94,176 64,200 0)" );
310
310
lwfree (str );
311
311
lwgeom_free (out );
312
- /* Maximum of 70 degrees, symmetric */
312
+ /* Maximum of 70 degrees per segment , symmetric */
313
313
out = lwcurve_linearize (in , 70 * M_PI / 180 , toltype , LW_LINEARIZE_FLAG_SYMMETRIC );
314
314
str = lwgeom_to_text (out , 2 );
315
315
ASSERT_STRING_EQUAL (str , "LINESTRING(0 0,50 86,150 86,200 0)" );
0 commit comments