The Hierarchical Triangular Mesh

User Guide

Prev
Next
Contents

It is a ssumed you have either the Java htmIndex.jar or the C++ source and have sucessfully made teh binaries. To make the C++ get the tar file. Untar it. Then in the directory type :

./configure
make
make lookup
In the case of Java you have nothing to do.

You may get the latest available code from the download page.

Lookup an ID

The simplest application shipped with the HTM code is an ID lookup. In c++ this is a program called intersect. In java it is a clas called edu.jhu.htmExamples.lookup. Both applications work in the same manner taking a level to compute the id to and either an RA Dec or x,y,z coordinate. i.e.

In java :

 java -classpath htmIndex.jar edu.jhu.htmExamples.lookup 20 45 45

(x,y,z)  = 0.5000000000000001 0.5 0.7071067811865475
(ra,dec) = 45.0 45.0
ID/Name  = 17557813719055 N333133333033333000033

In C++ :

lookup 20 45 45

Depth = 20
(x,y,z)  =   0.5000000000000000,   0.5000000000000000,   0.7071067811865475
(ra,dec) =  45.0000000000000071,  44.9999999999999929
 Lookup performance: 0.000000 /sec
ID/Name  = 17557813719055 N333133333033333000033

An online jsp page also provides a lookup service for RA,Dec at HtmTools.jsp

Perform a complex intersection

The real power of HTM lies in the convex intersections. The intersect application allows a "domain" file to be loaded and returns the HTMids which are contained in the domain. Domain files are described in the code files or you can look online at the javadocs for intersect .

The C++ application for perfomring an intersect is called "intersect" ant the equivolent java class is edu.jhu.htmExamples.intersect. Again both applications work in a similar manner. Most bassically you may pass a level and the name of a domain file.

Assume we have a simple domain file gr1 which defines a rectangle of 1 square degree as follows (this is in the src bundle) :

#DOMAIN
1
#RECTANGLE_RADEC
40.0 65.0
40.0 66.0
41.0 65.0
41.0 66.0

We may run this through intersect as follows.

In java :

java -classpath htmIndex.jar edu.jhu.htmExamples.intersect -symbolic 6 gr1

#DOMAIN
1
#CONVEX
4 ZERO
-0.6427876096865396 0.7660444431189778 7.951790406489363E-16 0.0 ZERO
-0.6891665347268039 -0.588603826377946 0.42260504372982827 0.0 ZERO
0.6946697916648571 0.5933040518358793 -0.40672371780292393 0.0 ZERO
0.656059028990507 -0.7547095802227723 7.95179040648939E-16 0.0 ZERO

level is         :10
olevel is        :10
savelevel        :5
nranges is       :100
varlength        :false
expand           :false
 Intersect  took 34 milis
N31331110000 N31331113333
N31331130200 N31331130200
N31331130202 N31331130203
N31331132100 N31331132133
N31331133100 N31331133103
N31331133121 N31331133121
N31331133130 N31331133133
N31333020121 N31333020121

In C++ :

 intersect -verbose -symbolic 10 gr1

Depth = 10, output level = 10
#DOMAIN
1
#CONVEX
4
-0.64278760968654 0.7660444431189775 4.09237650802725e-16 0
-0.6891665347268034 -0.5886038263779464 0.4226050437298281 0
0.6946697916648575 0.5933040518358793 -0.4067237178029229 0
0.6560590289905068 -0.7547095802227725 2.822730285897355e-16 0
1 intersections done at a rate of inf intersections/sec
N31331110000 N31331113333
N31331130200 N31331130200
N31331130202 N31331130203
N31331132100 N31331132133
N31331133100 N31331133103
N31331133121 N31331133121
N31331133130 N31331133133
N31333020121 N31333020121

Again the online jsp page provides an intersection service for triangles and rectangles at HtmTools.jsp

By default the list returned is the list of ranges of IDs contained in the domain. To get an exhaustive list add the -expand option. With -expand the above list would become the following list of 285 htms. As a sainty check consider that at level 10 there are 8,388,608 HTMs so in 1 sqaure degree we would expect to find ~ 203 htms in a square degree (41253 degrees on the sphere). Since the triangels will not fit exatly in a square degree we may assume more triangles than 203 will be returned.

N31331110000
N31331110001
N31331110002
N31331110003
N31331110010
N31331110011
N31331110012
N31331110013
N31331110020
N31331110021
N31331110022
N31331110023
N31331110030
N31331110031
N31331110032
N31331110033
N31331110100
N31331110101
N31331110102
N31331110103
N31331110110
N31331110111
N31331110112
N31331110113
N31331110120
N31331110121
N31331110122
N31331110123
N31331110130
N31331110131
N31331110132
N31331110133
N31331110200
N31331110201
N31331110202
N31331110203
N31331110210
N31331110211
N31331110212
N31331110213
N31331110220
N31331110221
N31331110222
N31331110223
N31331110230
N31331110231
N31331110232
N31331110233
N31331110300
N31331110301
N31331110302
N31331110303
N31331110310
N31331110311
N31331110312
N31331110313
N31331110320
N31331110321
N31331110322
N31331110323
N31331110330
N31331110331
N31331110332
N31331110333
N31331111000
N31331111001
N31331111002
N31331111003
N31331111010
N31331111011
N31331111012
N31331111013
N31331111020
N31331111021
N31331111022
N31331111023
N31331111030
N31331111031
N31331111032
N31331111033
N31331111100
N31331111101
N31331111102
N31331111103
N31331111110
N31331111111
N31331111112
N31331111113
N31331111120
N31331111121
N31331111122
N31331111123
N31331111130
N31331111131
N31331111132
N31331111133
N31331111200
N31331111201
N31331111202
N31331111203
N31331111210
N31331111211
N31331111212
N31331111213
N31331111220
N31331111221
N31331111222
N31331111223
N31331111230
N31331111231
N31331111232
N31331111233
N31331111300
N31331111301
N31331111302
N31331111303
N31331111310
N31331111311
N31331111312
N31331111313
N31331111320
N31331111321
N31331111322
N31331111323
N31331111330
N31331111331
N31331111332
N31331111333
N31331112000
N31331112001
N31331112002
N31331112003
N31331112010
N31331112011
N31331112012
N31331112013
N31331112020
N31331112021
N31331112022
N31331112023
N31331112030
N31331112031
N31331112032
N31331112033
N31331112100
N31331112101
N31331112102
N31331112103
N31331112110
N31331112111
N31331112112
N31331112113
N31331112120
N31331112121
N31331112122
N31331112123
N31331112130
N31331112131
N31331112132
N31331112133
N31331112200
N31331112201
N31331112202
N31331112203
N31331112210
N31331112211
N31331112212
N31331112213
N31331112220
N31331112221
N31331112222
N31331112223
N31331112230
N31331112231
N31331112232
N31331112233
N31331112300
N31331112301
N31331112302
N31331112303
N31331112310
N31331112311
N31331112312
N31331112313
N31331112320
N31331112321
N31331112322
N31331112323
N31331112330
N31331112331
N31331112332
N31331112333
N31331113000
N31331113001
N31331113002
N31331113003
N31331113010
N31331113011
N31331113012
N31331113013
N31331113020
N31331113021
N31331113022
N31331113023
N31331113030
N31331113031
N31331113032
N31331113033
N31331113100
N31331113101
N31331113102
N31331113103
N31331113110
N31331113111
N31331113112
N31331113113
N31331113120
N31331113121
N31331113122
N31331113123
N31331113130
N31331113131
N31331113132
N31331113133
N31331113200
N31331113201
N31331113202
N31331113203
N31331113210
N31331113211
N31331113212
N31331113213
N31331113220
N31331113221
N31331113222
N31331113223
N31331113230
N31331113231
N31331113232
N31331113233
N31331113300
N31331113301
N31331113302
N31331113303
N31331113310
N31331113311
N31331113312
N31331113313
N31331113320
N31331113321
N31331113322
N31331113323
N31331113330
N31331113331
N31331113332
N31331113333
N31331130200
N31331130202
N31331130203
N31331132100
N31331132101
N31331132102
N31331132103
N31331132110
N31331132111
N31331132112
N31331132113
N31331132120
N31331132121
N31331132122
N31331132123
N31331132130
N31331132131
N31331132132
N31331132133
N31331133100
N31331133101
N31331133102
N31331133103
N31331133121
N31331133130
N31331133131
N31331133132
N31331133133
N31333020121
Prev
Next
Contents
William O'Mullane
Last Modified: