org.stellarium
Class StelUtility

java.lang.Object
  extended by org.stellarium.StelUtility

public class StelUtility
extends java.lang.Object

See Also:
C++ header of this file, C++ implementation of this file

Nested Class Summary
static class StelUtility.Coords
          Encapsulate longitude/latitude coordinates that were returned by reference in the C++ version.
(package private) static class StelUtility.Type
           
 
Field Summary
static double AU
          Astronomical Unit
static double M_PI
           
static double M_PI_2
           
static double M_PI_4
           
 
Constructor Summary
StelUtility()
           
 
Method Summary
(package private) static java.lang.String colorToString(SColor v)
           
static javax.vecmath.Point3d div(javax.vecmath.Point3d v, double d)
           
(package private) static double dmsToRad(int d, double m)
           
(package private)  double dmsToRad(int d, int m, double s)
           
static double dot(javax.vecmath.Tuple3d v1, javax.vecmath.Tuple3d v2)
          Returns the dot product of 2 Tuple3d.
static double getDecAngle(java.lang.String str)
           
static double getGMTShiftFromSystem(double jd)
           
static double getGMTShiftFromSystem(double jd, boolean _local)
          Return the number of hours to add to gmt time to get the local time in day jd taking the parameters from system.
static java.lang.String getISO8601TimeUTC(double jd)
          Return the time in ISO 8601 format that is : %Y-%m-%d %H:%M:%S
static double getLength(javax.vecmath.Tuple3d v)
           
static double getLengthSquared(javax.vecmath.Tuple3d v)
           
static java.lang.String getTimeZoneNameFromSystem(double jd)
          Return the time zone name taken from system locale
(package private) static double hmsToRad(int h, double m)
           
(package private)  double hmsToRad(int h, int m, double s)
           
static boolean isEmpty(java.lang.String str)
          test for nullity and emptyness
(package private) static boolean iswhite(char c)
          strips trailing whitespaces from buf.
static double magToLuminance(double mag, double surface)
          Provide the luminance in cd/m^2 from the magnitude and the surface in arcmin^2
(package private) static javax.vecmath.Vector3d mult(javax.vecmath.Matrix4d aMatrix, javax.vecmath.Vector3d aVector)
          Multiply a Matrix4d by a Vector3d
static javax.vecmath.Vector3d mult(javax.vecmath.Vector3d aVector, double a)
          Multiply the Vector by a scalar
static java.lang.String myStrFTime(int max, java.lang.String fmt, java.util.Date tm)
          Use to remove a boring warning
static void normalize(javax.vecmath.Point3d point3d)
           
static java.lang.String printAngleDms(double angle)
           
static java.lang.String printAngleDms(double angle, boolean decimals, boolean useD)
          Print the passed angle with the format dd�mm'ss.ss(.ss)"
static java.lang.String printAngleDmsStel(double location)
           
static java.lang.String printAngleHms(double angle)
          Obtains a human readable angle in the form: hhhmmmss.sss"
static StelUtility.Coords rectToSphe(javax.vecmath.Tuple3d v)
           
(package private) static java.lang.String skipwhite(java.lang.String s)
          salta espacios en blanco
static void spheToRect(double lng, double lat, double r, javax.vecmath.Tuple3d v)
           
static void spheToRect(double lng, double lat, javax.vecmath.Tuple3d v)
           
(package private) static void spheToRect(double lng, double lat, javax.vecmath.Vector3d v)
          Deprecated. should be a point
static SColor stringToColor(java.lang.String s)
          Obtains a Color from a String with the form x,y,z
(package private) static double[] stringToDoubles(java.lang.String s)
          Obtains an array of Doubles from a String with the form x,y,z
(package private) static float[] stringToFloats(java.lang.String s)
           
static double stringToJDay(java.lang.String date)
          Convert String int ISO 8601-like format [+/-]YYYY-MM-DDThh:mm:ss (no timzone offset) to julian day TODO: move to better location for reuse
static javax.vecmath.Point3d stringToPoint3d(java.lang.String s)
          Obtains a Point3d from a String with the form x,y,z
static javax.vecmath.Vector3d stringToVector3d(java.lang.String s)
          Obtains a Vector3d from a String with the form x,y,z
static double[] toArray(javax.vecmath.Matrix4d m)
           
static double[] toArray(javax.vecmath.Tuple3d v)
           
static float[] toArray(javax.vecmath.Tuple3f v)
           
static float[] toArray(javax.vecmath.Tuple4f tuple4f)
           
(package private) static java.lang.String trim(java.lang.String x)
           
static java.lang.String tuple3dToString(javax.vecmath.Tuple4f v)
           
static java.lang.String tuple3fToString(javax.vecmath.Tuple3f v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

M_PI

public static final double M_PI
See Also:
Constant Field Values

M_PI_2

public static final double M_PI_2
See Also:
Constant Field Values

M_PI_4

public static final double M_PI_4
See Also:
Constant Field Values

AU

public static final double AU
Astronomical Unit

See Also:
Constant Field Values
Constructor Detail

StelUtility

public StelUtility()
Method Detail

hmsToRad

double hmsToRad(int h,
                int m,
                double s)

dmsToRad

double dmsToRad(int d,
                int m,
                double s)

hmsToRad

static double hmsToRad(int h,
                       double m)

dmsToRad

static double dmsToRad(int d,
                       double m)

spheToRect

static void spheToRect(double lng,
                       double lat,
                       javax.vecmath.Vector3d v)
Deprecated. should be a point

Parameters:
lng -
lat -
v -

spheToRect

public static void spheToRect(double lng,
                              double lat,
                              javax.vecmath.Tuple3d v)

spheToRect

public static void spheToRect(double lng,
                              double lat,
                              double r,
                              javax.vecmath.Tuple3d v)

stringToJDay

public static double stringToJDay(java.lang.String date)
                           throws StellariumException
Convert String int ISO 8601-like format [+/-]YYYY-MM-DDThh:mm:ss (no timzone offset) to julian day TODO: move to better location for reuse

Parameters:
date - The string date
Returns:
The Julian date
Throws:
StellariumException - If the date could not be successfuly parsed.

normalize

public static void normalize(javax.vecmath.Point3d point3d)

rectToSphe

public static StelUtility.Coords rectToSphe(javax.vecmath.Tuple3d v)

getLength

public static double getLength(javax.vecmath.Tuple3d v)

getLengthSquared

public static double getLengthSquared(javax.vecmath.Tuple3d v)

stringToVector3d

public static javax.vecmath.Vector3d stringToVector3d(java.lang.String s)
Obtains a Vector3d from a String with the form x,y,z


stringToPoint3d

public static javax.vecmath.Point3d stringToPoint3d(java.lang.String s)
Obtains a Point3d from a String with the form x,y,z


stringToColor

public static SColor stringToColor(java.lang.String s)
Obtains a Color from a String with the form x,y,z


stringToDoubles

static double[] stringToDoubles(java.lang.String s)
Obtains an array of Doubles from a String with the form x,y,z


stringToFloats

static float[] stringToFloats(java.lang.String s)

tuple3dToString

public static java.lang.String tuple3dToString(javax.vecmath.Tuple4f v)
Returns:
A String from a Vector3d with the form x,y,z

tuple3fToString

public static java.lang.String tuple3fToString(javax.vecmath.Tuple3f v)
Returns:
A String from a Vector3d with the form x,y,z

colorToString

static java.lang.String colorToString(SColor v)
Returns:
A String from a Color with the form x,y,z

magToLuminance

public static double magToLuminance(double mag,
                                    double surface)
Provide the luminance in cd/m^2 from the magnitude and the surface in arcmin^2


iswhite

static boolean iswhite(char c)
strips trailing whitespaces from buf.


trim

static java.lang.String trim(java.lang.String x)

skipwhite

static java.lang.String skipwhite(java.lang.String s)
salta espacios en blanco


getDecAngle

public static double getDecAngle(java.lang.String str)

printAngleDms

public static java.lang.String printAngleDms(double angle)

printAngleDms

public static java.lang.String printAngleDms(double angle,
                                             boolean decimals,
                                             boolean useD)
Print the passed angle with the format dd�mm'ss.ss(.ss)"

Parameters:
angle - Angle in radian
decimals - Define if 2 decimal must also be printed
useD - Define if letter "d" must be used instead of �
Returns:
The corresponding string

printAngleDmsStel

public static java.lang.String printAngleDmsStel(double location)

printAngleHms

public static java.lang.String printAngleHms(double angle)
Obtains a human readable angle in the form: hhhmmmss.sss"


mult

static javax.vecmath.Vector3d mult(javax.vecmath.Matrix4d aMatrix,
                                   javax.vecmath.Vector3d aVector)
Multiply a Matrix4d by a Vector3d

Returns:
aMatrix * aVector

mult

public static javax.vecmath.Vector3d mult(javax.vecmath.Vector3d aVector,
                                          double a)
Multiply the Vector by a scalar

Parameters:
aVector -
a -
Returns:
aVector * a

div

public static javax.vecmath.Point3d div(javax.vecmath.Point3d v,
                                        double d)

dot

public static double dot(javax.vecmath.Tuple3d v1,
                         javax.vecmath.Tuple3d v2)
Returns the dot product of 2 Tuple3d.

Parameters:
v1 - the other vector
v2 - the other vector
Returns:
the dot product of v1 and v2

toArray

public static double[] toArray(javax.vecmath.Matrix4d m)

toArray

public static double[] toArray(javax.vecmath.Tuple3d v)

toArray

public static float[] toArray(javax.vecmath.Tuple3f v)

toArray

public static float[] toArray(javax.vecmath.Tuple4f tuple4f)

myStrFTime

public static java.lang.String myStrFTime(int max,
                                          java.lang.String fmt,
                                          java.util.Date tm)
Use to remove a boring warning

Parameters:
max - The maximum number of characters to issue
fmt - The time format pattern
tm - The date for format
Returns:
The formatted text

getGMTShiftFromSystem

public static double getGMTShiftFromSystem(double jd)

getTimeZoneNameFromSystem

public static java.lang.String getTimeZoneNameFromSystem(double jd)
Return the time zone name taken from system locale

Parameters:
jd - Julian Day
Returns:

getGMTShiftFromSystem

public static double getGMTShiftFromSystem(double jd,
                                           boolean _local)
Return the number of hours to add to gmt time to get the local time in day jd taking the parameters from system. This takes into account the daylight saving time if there is. (positive for Est of GMT) TODO : %z in strftime only works on GNU compiler Fixed 31-05-2004 Now use the extern variables set by tzset()

Parameters:
jd - Julian Day
_local -

getISO8601TimeUTC

public static java.lang.String getISO8601TimeUTC(double jd)
Return the time in ISO 8601 format that is : %Y-%m-%d %H:%M:%S


isEmpty

public static boolean isEmpty(java.lang.String str)
test for nullity and emptyness