[Kstars-devel] More HTM progress
James Bowlin
bowlin at mindspring.com
Sun May 28 11:19:00 CEST 2006
I was able to compile the HTM code as a dynamic library (no biggie) which
then made it easier for me to create a Perl wrapper for the HTM code.
The following Perl code now works:
use HTMesh;
my $mesh = new HTMesh(6); # level 6 mesh
my ($ra, $dec) = (12.6, 32.8);
my $id = $mesh->lookup_id($ra, $dec);
print "id($ra, $dec) = $id\n";
my $name = $mesh->id_to_name($id);
print "name = $name\n";
print "\nrectangle ...\n";
$mesh->intersect_rect($ra, $dec, 1, 1); # ra, dec, delta_ra, delta_dec
while ($mesh->has_next()) {
print $mesh->next_id(), "\n";
}
print "\ncircle ...\n";
$mesh->intersect_circle2($ra, $dec, 60); # ra, dec, opening_angle
while ($mesh->has_next()) {
print $mesh->next_id(), "\n";
}
__END__
It produces:
id(12.6, 32.8) = 64223
name = N3223133
rectangle ...
64209
64210
64211
64217
64218
64219
64220
64221
64222
64223
circle ...
64209
64210
64211
64217
64218
64219
64220
64221
64222
64223
There were no gcc optimization flags set in their makefile. I added
-O2 and this produced a 33% speed boost. My most recent timing of
the indexing in a level 5 HTM resulted in about 100k points/sec.
Looking at their code, I am wondering how portable it will be especially
if it is part of a larger package like Kstars. I even wonder if it will
have problems on an AMD-64.
I'll be glad to share the (70 lines of) C++ code with you if you are
curious. It is pretty ugly in places, I just banged away at it until
I got something to work.
The units of the angular parameter for the intersect_circle()
routine has me confused. They named it "rad" and they get the
length (d) of the constraint vector from it via:
d = cos( pi * rad / (60 * 180) )
So the parameter called "rad" seems to be in units of minutes.
I feel like I am now in a position to index all of our stars;
modify the HIP files; and do some of the experiments we discussed
for optimizing our Kstars HTM implementation.
In the intersect_rect() routine, I put the [ra, dec] at the center
of the screen and made the size (2 * delta_ra) * (2 * delta_dec).
I thought this would correspond most closely to the intersect_circle()
parameters.
PLMK if you have any suggestions about what to explore next or
naming conventions or just about anything.
--
Peace, James
More information about the Kstars-devel
mailing list