|
||||||||
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)
|
Coo[] |
corners()
Get the 4 corners of a Qbox. |
static int |
corners(int qboxno,
double[] blur)
Compute the Corners of a Qbox from qbox number |
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 |
inside(Coo point)
Tests whether a point is inside a Qbox |
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.ArrayList vector)
List in an enumeration all Qboxes selected in a ArrayList |
static java.util.Enumeration |
list(Region region)
Return all Qboxes concerned by a Region (circle, box, zone, etc...) |
static double |
maxRadius()
Return the maximal radius (in degrees) of any Qbox at the default level |
static double |
maxRadius(int qbox)
Return the maximal radius (in degrees) of a Qbox |
static double |
minRadius()
Return the minimal radius (in degrees) of a Qbox. |
static double |
minRadius(int qbox)
Return the minimal radius (in degrees) of any Qbox at the default level |
double |
radius()
Compute the radius (in degrees) of the Circle containing the Qbox. |
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. |
java.lang.String |
toString()
Default Edition of the Qbox value |
static int |
ucenter(int qboxno,
double[] ucenter)
Compute the unit vector of the center of a Qbox. |
static int |
ucorners(int qboxno,
double[][] ucorn)
Compute the 4 vectors representing the corners of a Qbox. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, 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 corners(int qboxno, double[] blur)
qboxno
- the qbox numberblur
- the (xy) position of Bottom-Left and Up-Right points
in the tangential projection.
public static final int ucenter(int qboxno, double[] ucenter)
qboxno
- the qbox numberucenter
- a [3] array containing on return the unit vector
public static final int ucorners(int qboxno, double[][] ucorn)
qboxno
- the qbox numberucorn
- a [4][3] array of vertices vector.
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 final boolean inside(Coo point)
point
- a point to test
public static final double maxRadius()
public static final double maxRadius(int qbox)
qbox
- a valid qbox number
public static final double minRadius()
public static final double minRadius(int qbox)
qbox
- a valid qbox number
public final double area()
public final double radius()
public final Coo[] corners()
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.ArrayList vector)
vector
- a ArrayList of qboxes returned from a select routine
public static java.util.Enumeration list(Region region)
region
- A region defined according to AbstractRegion.
public static java.util.Enumeration circle(Coo center, double 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 |