[Kstars-devel] Porting line clipping to 4.0

James Bowlin bowlin at mindspring.com
Fri Jun 9 23:20:50 CEST 2006


I added line clipping code to my copy of the 3.5.x branch so the 
constellation lines can be partially drawn near the "celestial horizon"
instead of just disappearing entirely as they do now. It works well and
Jason encouraged me to port it to the 4.0 trunk.

I've ported the code over but I am now having a problem getting one
specific line to work properly even though it worked fine in the 3.5.x
branch.  Here is where I am having trouble:

 mid = SkyPoint( ra * 12. / dms::PI, dec * 180. / dms::PI );
omid = toScreen( &mid, Options::projection(), Options::useAltAz(), Options::useRefraction(), scale, &clipped );

I've added a "bool *clipped" as an optional parameter to toScreen() but
I don't think that is the cause of the problem because I call toScreen()
with it in other places and it seems to work fine.

The problem I have is that the omid.x() and omid.y() values are always the
same, even through the SkyPoint, mid, varies in position.   I added some
printf's:

  printf( " mid = [%8.2f, %8.2f]\n", mid.ra()->Degrees(), mid.dec()->Degrees() );
  printf( "omid = [%8.2f, %8.2f]\n", omid.x(), omid.y() );

and they produce output like the following:

 mid = [   64.13,   -26.94]
omid = [  857.39,   253.67]
...
 mid = [ -109.42,    35.25]
omid = [  857.39,   253.67]

Notice the values from mid vary greatly but the values from omid stay the
same.  I realize having mid be an actual SkyPoint instead of a pointer to
a SkyPoint is  a bit unusual but changing it to a pointer made no difference
in either the 3.5.x code or the 4.0 code but did require an extra delete
which is why I do it as above.

I'm guessing that maybe there is some new magical incantation I need to
perform on the new SkyPoint, mid, before it is ready to be sent to toScreen().

Any suggestions?

-- 
Peace, James


More information about the Kstars-devel mailing list