Opened 5 years ago

Closed 5 years ago

#3048 closed defect (fixed)

Use Squared Distance instead of Distance in Simplify

Reported by: pramsey Owned by: pramsey
Priority: high Milestone: PostGIS 2.1.6
Component: postgis Version: 2.1.x
Keywords: Cc:

Description

By avoiding sqrt() and using getPoint_cp, speed up the simplification routines, particularly on large polygons. Patch from J. Santana.

Attachments (1)

sqrt.patch (4.6 KB) - added by pramsey 5 years ago.

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by pramsey

Attachment: sqrt.patch added

comment:1 Changed 5 years ago by pramsey

Resolution: fixed
Status: newclosed

Committed in 2.1 at r13247, trunk at r13248

comment:2 Changed 5 years ago by strk

A couple of warnings left:

measures.c:2159:1: warning: no previous prototype for 'distance2d_sqr_pt_pt' [-Wmissing-prototypes]
 distance2d_sqr_pt_pt(const POINT2D *p1, const POINT2D *p2)
 ^
measures.c:2223:1: warning: no previous prototype for 'distance2d_sqr_pt_seg' [-Wmissing-prototypes]
 distance2d_sqr_pt_seg(const POINT2D *p, const POINT2D *A, const POINT2D *B)
 ^

comment:3 Changed 5 years ago by strk

btw, the algo was using square distance in its beginning (11 years ago). I dont' remember when it got changed to use flat distance. REF: r329

comment:4 Changed 5 years ago by strk

Resolution: fixed
Status: closedreopened

I was wrong, as of r329 only variable _names_ had the "sqared" label, but the implementation was bogus. The fix, later, went the way to use flat distance rather than squared one.

Anyway, simplify tests are failing for me, both in unit test and regress. Am I the only one ?

comment:5 Changed 5 years ago by strk

Resolution: fixed
Status: reopenedclosed

I was the only one, reconfiguring the sourcetree gave me a green

Note: See TracTickets for help on using tickets.