Make sure to retain first point of curves on linearization (#2427)

git-svn-id: http://svn.osgeo.org/postgis/trunk@11790 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2013-08-13 22:54:21 +00:00
parent 6a21d5ece0
commit 63dc80d4dc
4 changed files with 6 additions and 2 deletions

View file

@ -399,7 +399,7 @@ static void test_ptarray_desegmentize()
in = out;
out = lwgeom_desegmentize(in);
str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
CU_ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE((0 0,1 1,1 1),CIRCULARSTRING(1 1,1.8049097 1.9807853,3 1),(3 1,4 4))");
CU_ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE((0 0,1 1),CIRCULARSTRING(1 1,1.8049097 1.9807853,3 1),(3 1,4 4))");
lwgeom_free(in);
lwgeom_free(out);
// printf("%s\n", str);

View file

@ -175,7 +175,8 @@ lwcircle_segmentize(POINT4D *p1, POINT4D *p2, POINT4D *p3, uint32_t perQuad)
pa = ptarray_construct_empty(1, 1, 32);
/* Sweep from a1 to a3 */
for ( angle = a1; clockwise ? angle > a3 : angle < a3; angle += increment )
ptarray_append_point(pa, p1, LW_FALSE);
for ( angle = a1 + increment; clockwise ? angle > a3 : angle < a3; angle += increment )
{
pt.x = center.x + radius * cos(angle);
pt.y = center.y + radius * sin(angle);

View file

@ -841,5 +841,7 @@ SELECT '#2424', ST_AsText(ST_SnapToGrid(ST_CurveToLine(
'MULTICURVE(COMPOUNDCURVE((0 0, 10 0),CIRCULARSTRING(10 0, 20 1, 30 10)))',
2),1));
SELECT '#2427', st_astext(st_pointn(ST_CurveToLine('CIRCULARSTRING(-1 0,0 1,0 -1)'),1));
-- Clean up
DELETE FROM spatial_ref_sys;

View file

@ -250,3 +250,4 @@ ERROR: invalid GML representation
#2420|LINESTRING(0 0,10 0,10 10,0 10,0 0)
#2423|POLYGON((-10 0,-9.2388 3.82683,-7.07107 7.07107,-3.82683 9.2388,0 10,3.82683 9.2388,7.07107 7.07107,9.2388 3.82683,10 0,-10 0))
#2424|MULTILINESTRING((0 0,10 0,24 3,30 10))
#2427|POINT(-1 0)