cds.astro
Class Coocube

java.lang.Object
  extended by cds.astro.Coo
      extended by cds.astro.Coocube
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Coocube
extends Coo

The routines provided in this module define a "coordinate" as a face number (between 1 and 6), and two (X,Y) values in the range [-1,1[ representing the projection of a direction onto a cube. The face numbers, and the axis orientations, are:

 1 = +z X=+y Y=-x  (North Pole)
 2 = +y X=-z Y=-x  (azimuth +90)
 3 = +x X=+y Y=+z  (azimuth 0)
 4 = -x X=-z Y=-y  (azimuth 180)
 5 = -y X=+x Y=+z  (azimuth -90)
 6 = -z X=+x Y=-y  (South Pole)
           +---------+
           |    ^    |
           |    |x   |
           |<---+    |
           |    1    |
 +---------+---------+---------+---------+
 |    ^    |    ^    |         |         |
 |    |    |    |    |         |         |
 |   5+--->|  3 +--->|   2+--->|   4+--->|
 |      x  |      x  |   x|    |   x|    |
 |         |         |    v    |    v    |
 +---------+---------+---------+---------+
           |    ^    |
           |    |x   |
           |<---+    |
           |    6    |
           +---------+

These coordinates can be used to address accurately a point with 2 floating-point numbers associated to a 3-bit face number

Version:
1.0 16-sep-2002
Author:
Francois Ochsenbein
See Also:
Serialized Form

Field Summary
 byte face
          The face number in range 1 to 6 -- zero for undefined.
 double X
          The position on the face, a number between -1 and 1.
 double Y
          The position on the face, a number between -1 and 1.
 
Fields inherited from class cds.astro.Coo
decimals, ed, Umatrix3, x, y, z
 
Constructor Summary
Coocube()
          Define the default undefined Coocube
Coocube(Coo coo)
          Define the Coocube from a Coordinate
Coocube(int face, double X, double Y)
          Define the Coocube from its components
 
Method Summary
 java.lang.StringBuffer edit(java.lang.StringBuffer buf, int ndec)
          Edit the Coocube value as f:±X±Y
static int face(double[] u)
          Compute the face number from the unit vector
 void set(Coo coo)
          Compute the Coocube coordinates
 void set(double[] u)
          Compute the Coocube coordinates from the Direction Cosines
 void set(int face, double X, double Y)
          Compute the Coocube from its (XY) components
static int setUvec(int face, double X, double Y, double[] u)
          Transformation (face + Projections) --> unit vector
static int setXY(double[] u, double[] XY)
          Compute the (face, X, Y)
 java.lang.String toString()
          Default Edition of the Coocube values
 
Methods inherited from class cds.astro.Coo
add, add, clone, copyAngles, copyUvector, distance, distance, dump, editCoo, equals, eulerMatrix, getLat, getLon, localMatrix, localMatrix, localMatrix, moveMatrix, normalize, normalize, parse, parsing, rotate_1, rotate, rotateVector_1, rotateVector, set, set, set, set, setDecimals, setUvec, sub, sub
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

face

public byte face
The face number in range 1 to 6 -- zero for undefined.


X

public double X
The position on the face, a number between -1 and 1.


Y

public double Y
The position on the face, a number between -1 and 1.

Constructor Detail

Coocube

public Coocube()
Define the default undefined Coocube


Coocube

public Coocube(Coo coo)
Define the Coocube from a Coordinate


Coocube

public Coocube(int face,
               double X,
               double Y)
Define the Coocube from its components

Parameters:
face - the face number between 1 and 6 face is set to 0 in case of error.
X - x position on the face
Y - y position on the face
Method Detail

face

public static final int face(double[] u)
Compute the face number from the unit vector

Parameters:
u - unit vector (vector of 3 direction cosines)
Returns:
the face number in range 1..6 (0 if error)

setXY

public static final int setXY(double[] u,
                              double[] XY)
Compute the (face, X, Y)

Parameters:
u - the Direction Cosines
XY - the (X,Y) components
Returns:
the face number in range 1..6 (0 if error)

setUvec

public static final int setUvec(int face,
                                double X,
                                double Y,
                                double[] u)
Transformation (face + Projections) --> unit vector

Parameters:
face - the face number (1 to 6)
X - X value of the projection on the face n
Y - Y value of the projection on the face n
u - the unit vector (modified)
Returns:
the face number

set

public final void set(double[] u)
Compute the Coocube coordinates from the Direction Cosines

Parameters:
u - the Direction Cosines

set

public final void set(Coo coo)
Compute the Coocube coordinates

Overrides:
set in class Coo
Parameters:
coo - coordinates of a point

set

public final void set(int face,
                      double X,
                      double Y)
Compute the Coocube from its (XY) components

Parameters:
face - the face number between 1 and 6 face is set to 0 in case of error.
X - x position on the face
Y - y position on the face

edit

public java.lang.StringBuffer edit(java.lang.StringBuffer buf,
                                   int ndec)
Edit the Coocube value as f:±X±Y

Overrides:
edit in class Coo
Parameters:
buf - buffer for the edition
ndec - number of decimals for edition (a value of 6 corresponds to an accuracy of 0.3arcsec)
Returns:
the face number in range 1..6 (0 if error)

toString

public java.lang.String toString()
Default Edition of the Coocube values

Overrides:
toString in class Coo
Returns:
the string equivalent of the Coocube the angles in degrees.


Copyright © 2009 UDS/CNRS