[mapguide-trac] #777: Improve arc tessellation in LineBuffer

MapGuide Open Source trac_mapguide at osgeo.org
Fri Nov 21 23:24:45 EST 2008


#777: Improve arc tessellation in LineBuffer
------------------------------+---------------------------------------------
   Reporter:  waltweltonlair  |       Owner:  waltweltonlair
       Type:  defect          |      Status:  new           
   Priority:  medium          |   Milestone:  2.1           
  Component:  General         |     Version:  2.0.1         
   Severity:  trivial         |    Keywords:                
External_id:                  |  
------------------------------+---------------------------------------------
 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.

-- 
Ticket URL: <https://trac.osgeo.org/mapguide/ticket/777>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals


More information about the mapguide-trac mailing list