[Kstars-devel] Index Out-of-Range error in HighPMStarList::reindex

James Bowlin bowlin at mindspring.com
Thu Jul 10 00:42:56 CEST 2008


On Wed July 9 2008, Akarsh Simha wrote:
> I'm getting an index out-of-range error at some date far in the
> future (around 3000 AD) where SkyMesh::indexStar() is reporting a
> trixel = 512. This is causing an index out-of-range in the starIndex
> which has only 512 slots.
>
> How does SkyMesh::indexStar() work? Does it return a number in the
> range 0 - 255 or is it 1 - 256? This is approximately line #82 of
> highpmstarlist.cpp

The indexStar() function is very simple.  Here is the code from SkyMesh 
and the code that is then called in HTMesh:

Trixel SkyMesh::indexStar( StarObject *star )
{
    double ra, dec;
    star->getIndexCoords( &m_KSNumbers, &ra, &dec );
    return HTMesh::index( ra, dec );
}

Trixel HTMesh::index(double ra, double dec) const
{
    return (Trixel) htm->idByPoint(ra, dec) - magicNum;
}

The value of magicNum should be the total number of trixels which in 
this case is 512.  As you discovered, I was expecting it would only 
generate values from 0 to 511.

It would be interesting to see what values of RA and Dec are causing an 
index number of 512 to be generated.  

You could increase the size of the starIndex to work around this problem 
for now.  You would probably also want to increase the size in the 
PolyListIndex constructor as well.


-- 
Peace, James


More information about the Kstars-devel mailing list