|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcds.astro.Qbox
public class Qbox
The Qbox divides the celestial sphere into "cells" of approximative constant size. The routines provided in this module all deal with "qboxes". A qbox is just a number which represents one of the cells.
A qbox number is formed by the values of the projections (X,Y) of the directions on the 6 faces of a cube numbered 1 (z=1), 2 (y=1), 3 (x=1), 4 (x=-1), 5 (y=-1) and 6 (z=-1).
The faces and orientations are defined as:
+---------+
| ^ |
| | |
| 1+--->|
| x |
| |
+---------+---------+---------+---------+
| ^ | ^ | | |
| | | | | | |
| 5+--->| 3 +--->| 2+--->| 4+--->|
| x | x | x| | x| |
| | | v | v |
+---------+---------+---------+---------+
| ^ |
| |x |
|<---+ |
| 6 |
| |
+---------+
Each cube face is divided into 4 areas; each area is further
divided into four pieces, etc.
The number of valid qboxes is 6×4N:
Level Lower # qboxes qbox_size 0 9 6 83º 1 36 24 41º 2 144 96 20º 3 576 384 10º 4 2304 1536 5º 5 9216 6144 2º30' 6 36864 24576 1º15' 7 147456 98304 40' 8 589824 393216 20' 9 2359296 1572864 10' 10 9437184 6291456 5' 11 37748736 25165824 2'30" 12 150994944 100663296 1'15"where level is a number which can be changed at any time using setLevel(level) method.
The present implementation assumes that level<=12, corresponding to a maximum of 28 bits in the qbox number.
For a level 6, the qbox number is a short integer with bits (from left to right) 1ppp xyxy xyxy xyxy. The leftmost `1' bit allows the recognition of the level; bits p represent the face number (1 to 6), x and y the position, expressed with level bits, along the axises defined above for the face; going one level down in the hierarchy is therefore just a shift of 2 bits and updating the 2 rightmost bits.
The selection of valid qboxes makes usage of an Enumeration which returns the valid qboxes via its nextElement method.
Field Summary | |
---|---|
static int |
level
|
Constructor Summary | |
---|---|
Qbox()
Define the default Qbox which represents the whole sphere |
|
Qbox(Coo coo)
Define the Qbox containing a given position, at the current level. |
|
Qbox(Qbox qb)
Copy constructor. |
|
Qbox(java.lang.String text)
Define the Qbox from a text similar to the Edited qbox (see toString) |
Method Summary | |
---|---|
double |
area()
Compute the area (in square degrees) of a Qbox. |
int |
box()
Actual qbox value as an Integer |
Coocube |
center()
Convert a Qbox into the Coocube position of its center. |
static java.util.Enumeration |
circle(Coo center,
double radius)
Return all Qboxes concerned by a Circular Target |
boolean |
equals(java.lang.Object o)
MOD-BB 21-01-04 Ajout de cette methode. |
int |
face()
On which face is located the qbox ? |
int |
index()
Actual qbox index |
boolean |
isAny()
Status of a Qbox: check whether it's completely included in the Selection (no need to make further tests on Position) |
int |
level()
Actual qbox level |
static int |
level(int b)
Compute the level of any integer considered as a qbox |
java.util.Enumeration |
list()
List in an enumeration all Qboxes corresponding to a qbox To get all qboxes, just do the following: cq = new Qbox(); e=cq.list(); |
static java.util.Enumeration |
list(java.util.Vector vector)
List in an enumeration all Qboxes selected in a Vector |
static double |
maxRadius()
Return the maximal radius (in degrees) of any Qbox at the default level |
static double |
minRadius()
Return the maximal radius (in degrees) of any Qbox at the default level |
double |
radius()
Compute the radius (in degrees) of the Circle |
void |
set(Coo c)
Convert a Position into its Qbox at the default level |
void |
set(Coocube cc)
Convert a Coocube into a Qbox at the default level |
void |
set(Qbox qb)
Sets the Qbox value from another Qbox object |
static int |
setLevel(int lev)
Change the default Level which is 9. |
void |
toAny()
Set the Qbox to the 'Any' status the Selection (no need to make further tests on Position) |
java.lang.String |
toString()
Default Edition of the Qbox value |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int level
Constructor Detail |
---|
public Qbox()
public Qbox(Qbox qb)
qb
- Qbox object to copypublic Qbox(Coo coo)
coo
- coordinates object used to create the Qboxpublic Qbox(java.lang.String text) throws java.text.ParseException
text
- The text to interpret
java.text.ParseException
- when the text contains invalid charactersMethod Detail |
---|
public static final int setLevel(int lev)
lev
- the new level, between 0 and 12 -- other values do
not change it.
public static final int level(int b)
b
- the integer considered as a Qbox.
public final int level()
public final boolean isAny()
public final void toAny()
public final int box()
public final int index()
public final int face()
public final void set(Coocube cc)
cc
- the Coocube equivalent of the positionpublic final void set(Qbox qb)
qb
- Qbox object to copypublic final void set(Coo c)
c
- the Coocube equivqlent of the positionpublic final Coocube center()
public static final double maxRadius()
public static final double minRadius()
public final double area()
public final double radius()
public final java.lang.String toString()
toString
in class java.lang.Object
public java.util.Enumeration list()
public static java.util.Enumeration list(java.util.Vector vector)
vector
- a Vector of qboxes returned from a select routine
public static java.util.Enumeration circle(Coo center, double radius)
center
- the target centerradius
- the target radius
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Object a comparer.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |