Opened 15 years ago

Closed 15 years ago

#777 closed defect (fixed)

Improve arc tessellation in LineBuffer

Reported by: waltweltonlair Owned by: waltweltonlair
Priority: medium Milestone: 2.1
Component: General Version: 2.0.1
Severity: trivial Keywords:
Cc: External ID:

Description

LineBuffer::ArcTo tessellates arcs by first approximating them with cubic splines, and then tessellating the splines. I've noticed that the tessellation often generates many more points than necessary. In particular, it tries to set the minimum segment length for the tessellation to one pixel, limiting it to about 100 segments per cubic. Since a full circle gets approximated by 8 cubics, this can result in roughly 800 segments in the tessellation. In my case I was seeing this number of points for a circle about 300 pixels in diameter (makes sense - the circumference is on the order of 900 pixels, and the code tries to keep the segment length to around 1 pixel).

For a circle of radius R, the number of segments needed to approximate it with tolerance E is 2 * PI * sqrt(R / (8 * E)). So to approximate a 300-pixel-wide circle to 1/4 pixel accuracy requires about 54 segments - way less than 800.

LineBuffer::ArcTo will be updated to use this improved (and simplified) tessellation for arcs. I'm going to remove all the cubic approximations, and just use a simple direct tessellation based on the error formula above.

Change History (2)

comment:1 by waltweltonlair, 15 years ago

Status: newassigned

comment:2 by waltweltonlair, 15 years ago

Resolution: fixed
Status: assignedclosed

Fixed in trunk with submission https://trac.osgeo.org/mapguide/changeset/3480.

Note: See TracTickets for help on using tickets.