Opened 9 years ago

Closed 9 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 9 years ago.

Download all attachments as: .zip

Change History (6)

by pramsey, 9 years ago

Attachment: sqrt.patch added

comment:1 by pramsey, 9 years ago

Resolution: fixed
Status: newclosed

Committed in 2.1 at r13247, trunk at r13248

comment:2 by strk, 9 years ago

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 by strk, 9 years ago

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 by strk, 9 years ago

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 by strk, 9 years ago

Resolution: fixed
Status: reopenedclosed

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

Note: See TracTickets for help on using tickets.