|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hermit.utils.Angle
public class Angle
Utilities for handling and formatting angles, including latitudes and longitudes.
Field Summary | |
---|---|
static double |
HALFPI
Half pi; a quarter circle in radians; same as 90 degrees. |
static double |
TWOPI
Two times pi; a circle in radians; same as 360 degrees. |
Constructor Summary | |
---|---|
Angle(double radians)
Create an Angle from an angle given in radians. |
Method Summary | |
---|---|
Angle |
add(double radians)
Calculate the azimuth which is the given angular offset from this one. |
static java.lang.String |
formatBearing(double val)
Format an angle as a bearing. |
java.lang.String |
formatDeg()
Format this azimuth for user display in degrees. |
java.lang.String |
formatDegMin()
Format this azimuth for user display in degrees and minutes. |
static java.lang.String |
formatDegMin(double angle)
Format an angle for user display in degrees and minutes. |
static java.lang.String |
formatDegMin(double angle,
char pos,
char neg)
Format a latitude or longitude angle as a string in the format "W171° 15.165'". |
static void |
formatDegMin(double angle,
char pos,
char neg,
java.lang.StringBuilder sb)
Format a latitude or longitude angle as a string in the format "W171°15.165'". |
java.lang.String |
formatDegMinSec()
Format this azimuth for user display in degrees and minutes. |
static java.lang.String |
formatDegMinSec(double angle)
Format an angle for user display in degrees and minutes. |
static java.lang.String |
formatDegMinSec(double angle,
char posSign,
char negSign)
Format an angle for user display in degrees and minutes. |
static java.lang.String |
formatFloat(double val,
int frac)
Format a floating-point value. |
static java.lang.String |
formatLatLon(double lat,
double lon)
Format a latitude and longitude for user display in degrees and minutes. |
static java.lang.String |
formatRightAsc(double angle)
Format an angle for user display as a right ascension. |
static Angle |
fromDegrees(double degrees)
Create a Angle from an angle given in degrees. |
static Angle |
fromDegrees(int d,
int m,
double s)
Create a Angle from an angle given in degrees, minutes and seconds. |
static Angle |
fromRightAscension(int rh,
int rm,
double rs)
Create a Angle from a right ascension given in hours, minutes and seconds. |
double |
getDegrees()
Get the azimuth in degrees. |
double |
getRadians()
Get the angle in radians. |
static double |
modPi(double v)
Return the given value mod PI, with negative values made positive -- in other words, the value put into the range [0 .. |
static double |
modTwoPi(double v)
Return the given value mod 2*PI, with negative values made positive -- in other words, the value put into the range [0 .. |
java.lang.String |
toString()
Format this azimuth as a String. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final double HALFPI
public static final double TWOPI
Constructor Detail |
---|
public Angle(double radians)
radians
- Source angle in radians.Method Detail |
---|
public static Angle fromDegrees(double degrees)
degrees
- Source angle in degrees.
public static Angle fromDegrees(int d, int m, double s)
If any of the parameters is negative, the result is negative.
d
- Whole degrees.m
- Minutes.s
- Seconds.
public static Angle fromRightAscension(int rh, int rm, double rs)
If any of the parameters is negative, the result is negative (though they really shouldn't be).
rh
- Hours of right ascension.rm
- Minutes of right ascension.rs
- Seconds of right ascension.
public final double getRadians()
public final double getDegrees()
public Angle add(double radians)
radians
- Offset to add to this Azimuth, in radians;
positive is clockwise from north, may be
negative.
public static final double modPi(double v)
v
- Input value.
public static final double modTwoPi(double v)
v
- Input value.
public java.lang.String formatDeg()
public java.lang.String formatDegMin()
public java.lang.String formatDegMinSec()
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String formatFloat(double val, int frac)
val
- The value to format.frac
- Maximum number of digits after the point.
public static java.lang.String formatBearing(double val)
val
- The value to format.
public static java.lang.String formatDegMin(double angle)
angle
- The angle to format.
public static java.lang.String formatDegMin(double angle, char pos, char neg)
angle
- Angle to format.pos
- Sign character to use if positive.neg
- Sign character to use if negative.
public static void formatDegMin(double angle, char pos, char neg, java.lang.StringBuilder sb)
angle
- Angle to format.pos
- Sign character to use if positive.neg
- Sign character to use if negative.sb
- StringBuilder to write the result into.public static java.lang.String formatDegMinSec(double angle)
angle
- The angle to format.
public static java.lang.String formatDegMinSec(double angle, char posSign, char negSign)
angle
- The angle to format.posSign
- Sign to use for positive values; none if null.negSign
- Sign to use for negative values; none if null.
public static java.lang.String formatLatLon(double lat, double lon)
lat
- The latitude.lon
- The longitude.
public static java.lang.String formatRightAsc(double angle)
angle
- The angle to format.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |