public class HTMindexImp extends Object implements HTMindex
. . /\ . / \ . /____\ . /\ /\ . / \ / \ . /____\/____\ .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 5.
Current Version =============== ID: $Id: HTMindexImp.java,v 1.2 2003/02/19 15:46:11 womullan Exp $ Revision: $Revision: 1.2 $ Date/time: $Date: 2003/02/19 15:46:11 $
| Modifier and Type | Field and Description |
|---|---|
int |
addlevel_ |
int |
buildlevel_ |
protected int |
index_ |
(package private) static int |
IOFFSET |
protected int |
lastSavedLeafIndex_ |
protected List |
layers_ |
protected int |
leaves_ |
int |
maxlevel_ |
protected int |
nNodes_ |
protected List |
nodes_ |
protected int |
nVertices_ |
protected int |
storedleaves_ |
protected List |
vertices_ |
| Constructor and Description |
|---|
HTMindexImp()
Constructor: depth 20 - keeping 5 levels in memory by default
|
HTMindexImp(double degResolution)
COnstructor for index - pass your desired resolution in degrees this will
contruct a HTM of level such that the triabgle widht is just less than
the desired resolution.
|
HTMindexImp(int maxlevel)
Constructor: give only the level to build - keeping 5 levels in memory by
default
|
HTMindexImp(int maxlevel,
int buildlevel)
Constructor : give the level of the index and optionally the level to
build - i.e.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
add(Vector3d v,
int i) |
double |
area(String htmName)
The area in steradians for a given index ID
|
double |
area(Vector3d n0,
Vector3d n1,
Vector3d n2)
area: routine to precompute the area of a node using AREA = 4*arctan
sqrt(tan(s/2)tan((s-a)/2)tan((s-b)/2)tan((s-c)/2)) with s = (a+b+c)/2
(with many thanks to Eduard Masana @ University of Barcelona)
|
Domain |
compliment(Domain d)
not implemented yet
|
boolean |
contains(Domain d,
Vector3d p)
does the domain coaintain thie given point
|
double |
distance(long htmId1,
long htmId2)
calls HTMfunc
|
double |
distance(String htmName1,
String htmName2)
calls HTMfunc
|
(package private) Layer |
getLayer(int index) |
(package private) QuadNode |
getNode(int index) |
(package private) Vector3d |
getVertex(int x) |
int |
idByLeafNumber(int n)
return leaf id for a certain bitlist index.
|
String |
idToName(long id)
calls HTMfunc
|
Vector3d |
idToPoint(long htmId)
for the given id return the vector at the center of the triangle calls
HTMfunc
|
Vector3d |
idToPoint(String htmName)
for the given id return the vector at the center of the triangle calls
HTMfunc
|
protected void |
init(int maxlevel,
int buildlevel) |
HTMrange |
intersect(Domain d)
performs the intersection by calling domain.intersect
|
Domain |
intersection(Domain d1,
Domain d2)
not implemented yet
|
(package private) boolean |
isInside(Vector3d v,
Vector3d v0,
Vector3d v1,
Vector3d 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(long id)
return leaf number in bitlist for a certain ID.
|
String |
lookup(double ra,
double dec)
find a node by giving a ra,dec in degrees.
|
String |
lookup(Vector3d v)
find a node by giving a vector.
|
long |
lookupId(double ra,
double dec)
find a node by giving a ra,dec in degrees.
|
long |
lookupId(Vector3d v)
find a node by giving a vector.
|
(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.
|
String |
nameByLeafNumber(int n)
return name for a certain leaf index This function is simply shorthand
for nameById(n + leafCount()).
|
long |
nameToId(String name)
This calls HTMfunc .
|
int |
newNode(int v1,
int v2,
int v3,
long id,
int parent)
Make a new Node: insert a new node_[] into the list.
|
Vector3d[] |
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(PrintStream out)
showVertices: print every vertex to the output stream
|
Domain |
simplify(Domain d)
return a HTM id number for a given position
|
Domain |
smooth(Domain d)
not implemented yet
|
(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.
|
Domain |
union(Domain d1,
Domain d2)
creates a new domain which contains all convexces of d1 and d2
|
(package private) Vector3d |
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.
|
public int maxlevel_
public int buildlevel_
public int addlevel_
protected int leaves_
protected int storedleaves_
protected List nodes_
protected List layers_
protected List vertices_
protected int index_
protected int nNodes_
protected int nVertices_
protected int lastSavedLeafIndex_
static final int IOFFSET
public HTMindexImp(double degResolution)
throws HTMException
HTMExceptionpublic HTMindexImp()
public HTMindexImp(int maxlevel)
public HTMindexImp(int maxlevel,
int buildlevel)
protected void init(int maxlevel,
int buildlevel)
public void showVertices(PrintStream out)
public int[] nodeVertexIds(int idx)
public Vector3d[] nodeVertex(int leaf)
void makeNewLayer(int oldlayer)
public int newNode(int v1,
int v2,
int v3,
long id,
int parent)
public double area(String htmName)
public double area(Vector3d n0, Vector3d n1, Vector3d n2)
void vMax()
void sortIndex()
public long nameToId(String name) throws HTMException
nameToId in interface HTMindexHTMExceptionpublic String idToName(long id) throws HTMException
idToName in interface HTMindexHTMExceptionpublic long lookupId(Vector3d v) throws HTMException
lookupId in interface HTMindexHTMExceptionpublic String lookup(Vector3d v) throws HTMException
lookup in interface HTMindexHTMExceptionboolean isInside(Vector3d v, Vector3d v0, Vector3d v1, Vector3d v2)
public int leafCount()
public int nVertices()
public int leafNumberById(long id)
public int idByLeafNumber(int n)
public String nameByLeafNumber(int n)
public String lookup(double ra, double dec) throws HTMException
lookup in interface HTMindexHTMExceptionpublic long lookupId(double ra,
double dec)
throws HTMException
lookupId in interface HTMindexHTMExceptionVector3d getVertex(int x)
Vector3d V(int index, int x)
QuadNode getNode(int index)
Layer getLayer(int index)
int noNodes()
int noVertices()
void add(Vector3d v, int i)
boolean isLeaf(int i)
public Vector3d idToPoint(long htmId) throws HTMException
idToPoint in interface HTMindexHTMExceptionpublic Vector3d idToPoint(String htmName) throws HTMException
idToPoint in interface HTMindexHTMExceptionpublic Domain simplify(Domain d)
HTMindexpublic boolean contains(Domain d, Vector3d p)
HTMindexpublic double distance(long htmId1,
long htmId2)
throws HTMException
distance in interface HTMindexHTMExceptionpublic double distance(String htmName1, String htmName2) throws HTMException
distance in interface HTMindexHTMExceptionpublic Domain intersection(Domain d1, Domain d2)
intersection in interface HTMindexpublic Domain union(Domain d1, Domain d2)
public Domain compliment(Domain d)
compliment in interface HTMindex