HTM Index 1.0




jhu.htmIndex
Class SpatialDomain

java.lang.Object
  |
  +--jhu.htmIndex.SpatialDomain

public class SpatialDomain
extends java.lang.Object

A SpatialDomain manages a list of SpatialConvexes. This is the data structure that can define any area on the sphere. With the intersect method, the htm index returns the triangle nodes that intersect with the area specified by the current SpatialDomain instance. There are two lists returned: one for the nodes fully contained in the area and one for the triangles which lie only partially in the domain.


Constructor Summary
SpatialDomain()
          Default constructor
SpatialDomain(SpatialIndex idx)
          Constructor: needs SpatialIndex
 
Method Summary
 void add(SpatialConvex c)
          Add a convex
 void clear()
          Clear domain, empty convex list
 SpatialConvex getConvex(int i)
          Fetch the convex number i
 int getNumberOfConvexes()
          Return the number of convexes in this domain
 boolean intersect(java.util.List partial, java.util.List full)
          Same intersection, but return vectors of ids instead of bitlists.
 boolean intersect(SpatialIndex idx, java.util.BitSet partial, java.util.BitSet full)
          Intersect with index.
 boolean intersect(SpatialIndex idx, java.util.List partial, java.util.List full)
          Same intersection, but return vectors of ids instead of bitlists.
 void read(java.io.Reader in)
          Read in a domain from a Reader (input stream).
 void setIndex(SpatialIndex idx)
          Set index pointer and initialize markup if not done with constructor
 java.lang.String toString()
          Convert domain to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpatialDomain

public SpatialDomain()
Default constructor

SpatialDomain

public SpatialDomain(SpatialIndex idx)
Constructor: needs SpatialIndex
Method Detail

setIndex

public void setIndex(SpatialIndex idx)
Set index pointer and initialize markup if not done with constructor

add

public void add(SpatialConvex c)
Add a convex

intersect

public boolean intersect(SpatialIndex idx,
                         java.util.BitSet partial,
                         java.util.BitSet full)
Intersect with index. Return the bitlist of the leafnodes that are partially and fully intersected by this domain.

intersect

public boolean intersect(SpatialIndex idx,
                         java.util.List partial,
                         java.util.List full)
Same intersection, but return vectors of ids instead of bitlists.

intersect

public boolean intersect(java.util.List partial,
                         java.util.List full)
Same intersection, but return vectors of ids instead of bitlists.

getConvex

public SpatialConvex getConvex(int i)
Fetch the convex number i

getNumberOfConvexes

public int getNumberOfConvexes()
Return the number of convexes in this domain

toString

public java.lang.String toString()
Convert domain to a string. This string can be written into a file and can recover the domain using the read method.
Overrides:
toString in class java.lang.Object

clear

public void clear()
Clear domain, empty convex list

read

public void read(java.io.Reader in)
          throws java.io.IOException
Read in a domain from a Reader (input stream).

Domain files format

A constraint is represented in the file as a set of 4 floatingpoint numbers x y z d where a=(x,y,z). Example:

1 0 0 0.5

A convex is the area defined by several constraints on the sphere that is common to all constraints. Of course such an area has to be convex.

A convex in the file is defined by a number (number of constraints in the convex) followed by as many convexes (each on one line.) Example:

4
0.5 0.707107 0.5 0.58077530122080200
0.5 0.707107 0.5 0.84077530122080200
-0.5 -0.907107 0.3  -0.87530122080200
0.2 -0.907107 0.3  -0.77530122080200

A domain is an accumulation of convexes. A domain in the domainfile is represented by a number (number of convexes) followed by that many convexes. A domainfile may only contain one domain. It may contain comment lines, starting with #.

Special Identifiers

The domain file accepts several special convex identifiers to read in special formats. These identifiers must come as a single comment line before the data, and no additional comments are allowed These are

#TRIANGLE			- the next three lines are triangle corners
#TRIANGLE_RADEC		- same, given in ra/dec
#RECTANGLE			- the next four lines are rectangle corners
#RECTANGLE_RADEC		- same, given in ra/dec
#CONVEX			- read convex in default format
#CONVEX_RADEC		- read the convex in ra/dec format

Examples of a domain files

Example 1:
#DOMAIN
1
#CONVEX
3
0.5 0.707107 0.5 0.58077530122080200
0.5 0.5 0.707107 0.63480775301220802
0.707107 -0.5 0.5 0.8480775301220802


Example 2:
#DOMAIN
2
#CONVEX
4
0 0 1 0.3
-1 -3 -5 -0.97
5 -3 -10 -0.97
2 2 -5 -0.97
#CONVEX_RADEC
1
25.23 -55.9 0.99
Example 3:
#DOMAIN
1
#RECTANGLE_RADEC
54 29
54 30
55 29
55 30


Example 4:

#DOMAIN
1
#TRIANGLE
0 0 1
0 0.9 0.9
0.9 0 0.9

HTM Index 1.0





©Copyright The Johns Hopkins University 1999, All Rights Reserved.
See the HTM Homepage for details.
Last Build: Oct 26, 1999 Peter Z. Kunszt