|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jhu.htmIndex.SpatialIndex
The Spatial Index is a quad tree of spherical triangles. The tree is built in the following way: Start out with 8 triangles on the sphere using the 3 main circles to determine them. Then, every triangle can be decomposed into 4 new triangles by drawing main circles between midpoints of its edges:
. . /\ . / \ . /____\ . /\ /\ . / \ / \ . /____\/____\ .This is how the quad tree is built up to a certain level by decomposing every triangle again and again. For a complete descrption, please go to the HTM index website
This implementation builds the index up to a specified level (maxlevel) You can specify that it should keep the first few levels in memory with the second constructor argument (buildlevel). The default buildlevel is 2.
Field Summary | |
int |
buildlevel_
|
(package private) static int |
IOFFSET
|
int |
maxlevel_
|
Constructor Summary | |
SpatialIndex(int maxlevel)
Constructor: give only the level to build - keeping 2 levels in memory by default |
|
SpatialIndex(int maxlevel,
int buildlevel)
Constructor : give the level of the index and optionally the level to build - i.e. |
Method Summary | |
(package private) void |
add(SpatialVector v,
int i)
|
double |
area(int ID)
The area in steradians for a given index ID |
double |
area(SpatialVector n0,
SpatialVector n1,
SpatialVector n2)
area: routine to precompute the area of a node uses Girard's formula: AREA = A+B+C - Pi |
(package private) SpatialLayer |
getLayer(int index)
|
(package private) SpatialQuadNode |
getNode(int index)
|
(package private) SpatialVector |
getVertex(int x)
|
int |
idByLeafNumber(int n)
return leaf id for a certain bitlist index. |
static int |
idByName(java.lang.String name)
Translate ascii leaf name to a uint32 The following encoding is used: The string leaf name has the always the same structure, it begins with an N or S, indicating north or south cap and then numbers 0-3 follow indicating which child to descend into. |
int |
idByPoint(double ra,
double dec)
find a node by giving a ra,dec in degrees. |
int |
idByPoint(SpatialVector v)
find a node by giving a vector. |
(package private) boolean |
isInside(SpatialVector v,
SpatialVector v0,
SpatialVector v1,
SpatialVector v2)
Test whether a vector v is inside a triangle v0,v1,v2. |
(package private) boolean |
isLeaf(int i)
|
int |
leafCount()
leafCount: return number of leaf nodes |
int |
leafNumberById(int id)
return leaf number in bitlist for a certain ID. |
(package private) void |
makeNewLayer(int oldlayer)
makeNewLayer: generate a new layer and the nodes in it Here it is where the construction actually happens, generating new triangles out of old ones. |
static java.lang.String |
nameById(int id)
Translate uint32 to an ascii leaf name The encoding described above may be decoded again using the following procedure: Traverse the uint32 from left to right. |
java.lang.String |
nameByLeafNumber(int n)
return name for a certain leaf index (to be used for name lookup from a bitlist). |
java.lang.String |
nameByPoint(double ra,
double dec)
find a node by giving a ra,dec in degrees. |
java.lang.String |
nameByPoint(SpatialVector vector)
find a node by giving a vector. |
int |
newNode(int v1,
int v2,
int v3,
int id,
int parent)
Make a new Node: insert a new node_[] into the list. |
SpatialVector[] |
nodeVertex(int leaf)
nodeVertex: return the vectors of the vertices, based on a bitlist leaf index |
int[] |
nodeVertexIds(int idx)
nodeVertex: return index of vertices for a node |
(package private) int |
noNodes()
|
(package private) int |
noVertices()
|
int |
nVertices()
nVertices: return number of vertices |
void |
showVertices(java.io.PrintStream out)
showVertices: print every vertex to the output stream |
(package private) void |
sortIndex()
sortIndex: sort the index so that the first node is the invalid node (index 0), the next 8 nodes are the root nodes and then we put all the leaf nodes in the following block in ascending id-order. |
(package private) SpatialVector |
V(int index,
int x)
|
(package private) void |
vMax()
vMax: compute the maximum number of vertices for the polyhedron after buildlevel of subdivisions and the total number of nodes that we store also, calculate the number of leaf nodes that we eventually have. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public int maxlevel_
public int buildlevel_
static final int IOFFSET
Constructor Detail |
public SpatialIndex(int maxlevel)
public SpatialIndex(int maxlevel, int buildlevel)
Method Detail |
public void showVertices(java.io.PrintStream out)
public int[] nodeVertexIds(int idx)
public SpatialVector[] nodeVertex(int leaf)
void makeNewLayer(int oldlayer)
public int newNode(int v1, int v2, int v3, int id, int parent)
public double area(int ID)
public double area(SpatialVector n0, SpatialVector n1, SpatialVector n2)
void vMax()
void sortIndex()
public static int idByName(java.lang.String name)
public static java.lang.String nameById(int id)
public int idByPoint(SpatialVector v)
boolean isInside(SpatialVector v, SpatialVector v0, SpatialVector v1, SpatialVector v2)
public int leafCount()
public int nVertices()
public int leafNumberById(int id)
public int idByLeafNumber(int n)
public java.lang.String nameByLeafNumber(int n)
public int idByPoint(double ra, double dec)
public java.lang.String nameByPoint(SpatialVector vector)
public java.lang.String nameByPoint(double ra, double dec)
SpatialVector getVertex(int x)
SpatialVector V(int index, int x)
SpatialQuadNode getNode(int index)
SpatialLayer getLayer(int index)
int noNodes()
int noVertices()
void add(SpatialVector v, int i)
boolean isLeaf(int i)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |