edu.pdx.starview.calc
Class SVAngle

java.lang.Object
  extended byedu.pdx.starview.calc.SVAngle

public class SVAngle
extends java.lang.Object

General Purpose angle representation that can quickly and easily do calculations on an angle. Credits: This code was based on the source for KStars-20040229

Author:
Dave Camarillo

Constructor Summary
SVAngle()
          Default Constructor
SVAngle(double x)
          Alternate constructor.
SVAngle(int d, int m, int s, int ms)
          Default Constructor.
SVAngle(SVAngle d)
          Copy-Constructor
 
Method Summary
 double acos()
           
 double asin()
           
 double atan()
           
 double cos()
           
 double Degrees()
           
 int getArcmin()
           
 int getArcsec()
           
 int getDegree()
           
 SVAngle getDiff(SVAngle rhs)
           
 java.lang.String getDMSString()
           
 java.lang.String getHMSString()
           
 int getHour()
           
 double getHours()
           
 int getMarcsec()
           
 int getMinute()
           
 int getMsecond()
           
 double getRadians()
           
 SVAngle getReducedDiff(SVAngle rhs)
           
 int getSecond()
           
static double normalizeRadians(double r)
           
 void set(SVAngle d)
          Copy value of another dms angle
 void setD(double x)
          Sets floating-point value of angle, in degrees.
 void setD(int d, int m, int s, int ms)
          Sets floating-point value of angle, in degrees.
 void setH(double x)
          converts argument from hours to degrees, then sets floating-point value of angle, in degrees.
 void setH(int h, int m, int s, int ms)
          Set from HMS notation
 void setRadians(double Rad)
          Set angle according to the argument, which is in radians
 double sin()
           
 double tan()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SVAngle

public SVAngle(int d,
               int m,
               int s,
               int ms)
Default Constructor. Set the floating-point value of the angle according to the three integer arguments.

Parameters:
d - degree portion of angle (int). Defaults to zero.
m - arcminute portion of angle (int). Defaults to zero.
s - arcsecond portion of angle (int). Defaults to zero.
ms - arcsecond portion of angle (int). Defaults to zero.

SVAngle

public SVAngle(SVAngle d)
Copy-Constructor

Parameters:
d - Source to set degree value from.

SVAngle

public SVAngle()
Default Constructor


SVAngle

public SVAngle(double x)
Alternate constructor. Sets the floating-point angle to the argument, in degrees.

Parameters:
x - angle expressed as a floating-point number (in degrees)
Method Detail

setD

public void setD(double x)
Sets floating-point value of angle, in degrees.

Parameters:
x - new angle (double)

setD

public void setD(int d,
                 int m,
                 int s,
                 int ms)
Sets floating-point value of angle, in degrees. This is an overloaded member function; it behaves essentially like the above function. The floating-point value of the angle (D) is determined from the following formulae: \f$ fabs(D) = fabs(d) + \frac{(m + (s/60))}{60} \f$ \f$ sgn(D) = sgn(d) \f$

Parameters:
d - integer degrees portion of angle
m - integer arcminutes portion of angle
s - integer arcseconds portion of angle
ms - integer arcseconds portion of angle

Degrees

public double Degrees()
Returns:
angle in degrees expressed as a double.

set

public void set(SVAngle d)
Copy value of another dms angle

Parameters:
d - set angle according to this dms object

getRadians

public double getRadians()
Returns:
The radian value of the angle.

sin

public double sin()
Returns:
the sin value of the angle.

cos

public double cos()
Returns:
the cos of the angle.

tan

public double tan()
Returns:
the tan of the angle.

acos

public double acos()

atan

public double atan()

asin

public double asin()

setRadians

public void setRadians(double Rad)
Set angle according to the argument, which is in radians


getHours

public double getHours()
Returns:
angle in hours expressed as a double.

getArcmin

public int getArcmin()
Returns:
The arcminute value of the angle.

getArcsec

public int getArcsec()
Returns:
The arc-second value of the angle.

getMarcsec

public int getMarcsec()
Returns:
The arc-milisecond value of the angle.

getHour

public int getHour()
Returns:
integer hour portion of the angle

getMinute

public int getMinute()
Returns:
The minute portion of the angle (for use in HMS notation).

getSecond

public int getSecond()
Returns:
integer seconds portion of the angle

getMsecond

public int getMsecond()
Returns:
integer milliseconds portion of the angle

getDegree

public int getDegree()
Returns:
integer degrees portion of the angle

getDMSString

public java.lang.String getDMSString()
Returns:
A Degree-ArcMinute-ArcSecond-ArcMilisecond string of the angle.

getHMSString

public java.lang.String getHMSString()
Returns:
A Hour-Minute-Second-Milisecond string of the angle.

setH

public void setH(double x)
converts argument from hours to degrees, then sets floating-point value of angle, in degrees.

Parameters:
x - new angle, in hours (double)

setH

public void setH(int h,
                 int m,
                 int s,
                 int ms)
Set from HMS notation

Parameters:
h - Hours
m - Minutes
s - Seconds
ms - Miliseconds

toString

public java.lang.String toString()
Returns:
A string of the decimal representation of the degree value.

normalizeRadians

public static double normalizeRadians(double r)

getReducedDiff

public SVAngle getReducedDiff(SVAngle rhs)

getDiff

public SVAngle getDiff(SVAngle rhs)