Opened 7 years ago

Closed 7 years ago

#3772 closed enhancement (fixed)

ST_CurveToLine balanced output segments

Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS 2.4.0
Component: postgis Version: master
Keywords: Cc:

Description

The Current ST_CurveToLine function does not make any effort to balance the resulting segments so that the length of first and last segments are equal. Rather, segments from the start try to be as long as needed to conver a quarter circle by as many segments as segments_per_qtr_circle argument requests.

This ticket is to allow for requesting a symmetric output instead, that is balancing the length of last segment so that it is the same of the first segment.

See also #2464

Attachments (2)

curvetoline.png (19.5 KB ) - added by strk 7 years ago.
curve2line.png (10.3 KB ) - added by strk 7 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by strk, 7 years ago

Summary: ST_CurveToLine symmetric outputST_CurveToLine balanced output segments

comment:3 by strk, 7 years ago

Resolution: fixed
Status: assignedclosed

In 15430:

Implement extended ST_CurveToLine signature

Adds lwcurve_linearize function at liblwgeom level.
Turns lwgeom_stroke into a wrapper, keept it for backward compatibility.
Reduces allocations in linearization procedures.

Implements SYMMETRIC and RETAIN_ANGLE flags.
Implements MAX_DEVIATION, MAX_ANGLE and SEGS_PER_QUADRANT configs.

Includes unit and SQL tests.
Includes documentation.

Closes #2464 (maxError configuration is MAX_DEVIATION)
Closes #3772 (balanced output is SYMMETRIC and RETAIN_ANGLE flags)

Document the new ST_CurveToLine signature

comment:4 by strk, 7 years ago

I'm reopening because of cases in which symmetricity isn't obtained:

SELECT ST_AsText(ST_CurveToLine(
'CIRCULARSTRING(2680931.973 1225272.341,2680930.723 1225270.971,2680928.869 1225270.923,2680927.625 1225272.101,2680927.57 1225273.814)'::geometry
,0.1,1,1));
LINESTRING(2680931.973 1225272.341,2680931.25863031 1225271.3088611,2680930.11688384 1225270.78727718,2680928.869 1225270.923,2680927.83651479 1225271.7294398,2680927.42757841 1225272.97408509,2680927.57 1225273.814)

comment:5 by strk, 7 years ago

Resolution: fixed
Status: closedreopened

by strk, 7 years ago

Attachment: curvetoline.png added

by strk, 7 years ago

Attachment: curve2line.png added

comment:6 by strk, 7 years ago

Further reduction:

SELECT ST_AsText(ST_CurveToLine(
'CIRCULARSTRING(2680928.869 1225270.923,2680927.625 1225272.101,2680927.57 1225273.814)'::geometry
,0.1,1,1));

LINESTRING(2680928.869 1225270.923,2680927.83651479 1225271.7294398,2680927.42757841 1225272.97408509,2680927.57 1225273.814)

Visually:

I guess it has to do with the fact that the origin is not shifted appropriately, but rather is always anchored at angle 0.

comment:7 by strk, 7 years ago

Resolution: fixed
Status: reopenedclosed

In 15465:

Fix angle reminder computation

Closes #3772 again (see comment:6)
Add specific testcase

Note: See TracTickets for help on using tickets.