[Kstars-devel] Clipping Miky Way polygons

James Bowlin bowlin at mindspring.com
Wed Jun 14 19:51:55 CEST 2006


I am ready to port the Milky Way polygon clipping code to 4.0 whenever you
are ready for it.  The code changes should be entirely in the Milky Way
component and composite.  The biggest change is actually in the data. 
I created milkyway.dat that looks like:

M  6.31500  36.0000
D  6.28583  36.3411
D  6.24861  36.7781
D  6.21139  37.2133

etc.  

It breaks the Milky Way up into 135 polygons.  I tried fewer polygons but
some minor artifacts persisted so I bumped up the number.  I created two
tools to help with this work:

  polylines.pl: Selects points from orignal mwNN.dat files,
                draws the new polygons on KStars, and then
                generates the new milkyway.dat file.
               
cull-points.pl: Removes points from milkyway.dat that are close
                together and aren't nodes specified in polylines.pl
                above.

The new system is not perfect, but it is very, very good.  I didn't have
a facility in my tools to add extra points that were not already in the
mwNN.dat files.  If I wanted to improve things further, I would add this
feature and use it to break up a few of the larger polygons by adding some
interior points.  I think things are probably good enough as they are.  If
we ever do want to make this change in the future, it won't affect the
KStars code, just the tools and the milkyway.dat file.

Creating the new polygons caused 250 extra points to be added, bumping the
total number of points from 3358 to 3597.  To counteract this, I wrote
cull-points.pl that culls out points that are close together.  It is smart
but not real smart.  It won't remove points that are on either end of a long
span or any points specified in the polylines program.  The problem is that
the little "islands" in the middle of the Milky Way need a higher point
density than the edges of the Milky Way but the program is not yet smart
enough to make this distinction.  I took a compromise approach and reduced
the total number of points to 2139.  I compared the new data set with the
orignal by implementing both Milky Way drawing routines in the 3.5.x code
and drawing one on top of the other.  Anyway, this is easy to change since
it just requires re-running the two tools above and changing the milkyway.dat
file.  I think a smarter cull-points program could be used to reduce the
total number of points to about 1,000 but I'm in no rush to do this now.

I can send you .png's of the two data sets plotted one on top of the other
if you would like to see for yourself.

I am currently (in 3.5.x) storing the Milky Way data in a QPtrList of
CSegments.  On first glance, this should translate to a QList of CSegments
but the interesting question is:  how to integrate this with the new
Component/Composite model.  Ideally, we would do it in a way that would
ease the transition to the use of a spatial index.  

I need to think about this for a little bit.

-- 
Peace, James


More information about the Kstars-devel mailing list