[Kstars-devel] Clipping Miky Way polygons

James Bowlin bowlin at mindspring.com
Sat Jun 10 21:25:04 CEST 2006


I added standard Sutherland-Hodgman polygon clipping to the 3.5.x branch
to clip the filled Milky Way.  There are still two annoying artifacts, both
of which are caused by the fact that our clipping boundary is a curve and
not a straight line.

The first artifact shows up when the clipped portion of the milky Way spans
about 10 degrees or more, it is very clear that the clipping line is a line
and not part of the arc of the "celestial horizon"  (is there already a
standard term for this?).  

The second artifact appears less often but is more annoying.  In some
unusual situations, the clipping line can cross over visible parts of the 
polygon and thus cause an "inside out" effect where bare sky gets filled
in instead of the Milky Way.

I think the easiest way to fix both of these problems is to chop up the
Milky Way into more pieces so that no one piece spans more than 5 or 10
degrees.  Instead of 11 pieces we would end up with maybe 50 or so.  This
will require a change in the file format.  I'm thinking about putting all
of the Milky Way data in one large file and adding simple letter prefixes
to indicate the start of a polygon and (possibly also hidden points) much
like the current file format for constellation lines.

The polygon clipping code would be slightly simplified if the first point
of each polygon is repeated as the last point as well in the data we
actually use for doing the drawing.  An easy way to keep this from
conflicting with the code that draws only the outlines of the Milky Way
is to have the outline code just start with the 2nd point in each
polygon instead of the first, or alternatively, not draw the line to
the last point in each polygon.  If we end up needing to put polygon
vertices in the interior of the Milky Way to reduce artifacts then we
may need to have two separate but similar Milky Way data structures,
one for outlines and another for the polygons.

I'm not certain that shrinking down the size of the polygons is going to
totally solve the two artifact problems but it will certainly reduce
them perhaps to a level where they become acceptable.  Reducing the size
of the polygons will also make a spatial index more effective if we want
to use it for doing course clipping of the Milky Way.


-- 
Peace, James


More information about the Kstars-devel mailing list