net.agmodel.physical
Class Angle

java.lang.Object
  extended bynet.agmodel.physical.AbstractQuantity
      extended bynet.agmodel.physical.Angle
All Implemented Interfaces:
Cloneable, Comparable, Serializable

public final class Angle
extends AbstractQuantity
implements Comparable

This class represents the figure formed by two lines diverging from a common point.

Version:
1.1, 22 March 1999
Author:
Jean-Marie Dautelle
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.agmodel.physical.AbstractQuantity
COMPLETE, DEVOID, SPATIALLYINTERPOLATED, TEMPORALLYINTERPOLATED, UNINTERPOLATED
 
Constructor Summary
Angle(double value, AngleUnit unit)
          Angle constructor.
 
Method Summary
static Angle acos(double x)
          Creates an Angle such as its cosine is the specified argument.
 Angle add(Angle x)
          Returns an Angle whose value is (this + x).
static Angle asin(double x)
          Creates an Angle such as its sine is the specified argument.
static Angle atan(double x)
          Creates an Angle such as its tangent is the specified argument.
static Angle atan2(Length y, Length x)
          Converts rectangular coordinates (xy) to polar (rho, theta).
 int compareTo(Angle x)
          Compares this Angle with the specified Angle.
 int compareTo(Object o)
          Compares this Angle with the specified Object.
 double cos()
          Returns the trigonometric cosine of this Angle.
 Angle divide(double coefficient)
          Returns an Angle whose value is (this / coefficient).
 int getDMSDegrees()
          Returns the degree component of the angle expressed in degrees, minutes and seconds
 int getDMSMinutes()
          Returns the minute component of the angle expressed in degrees, minutes and seconds
 double getDMSSeconds()
          Returns the minute component of the angle expressed in degrees, minutes and seconds
 double getValue(AngleUnit unit)
          Gets the angle in the specified unit.
 Angle multiply(double coefficient)
          Returns an Angle whose value is (this * coefficient).
 void normalize()
          Adds or removes a discrete number of revolution to this Angle.
 void setValue(double value, AngleUnit unit)
          Sets this Angle using the specified unit.
 double sin()
          Returns the trigonometric sine of this Angle.
 Angle substract(Angle x)
          Returns an Angle whose value is (this - x).
 double tan()
          Returns the trigonometric tangent of this Angle.
 
Methods inherited from class net.agmodel.physical.AbstractQuantity
clone, divide, isSpatiallyInterpolated, isTemporallyInterpolated, multiply, toComposite, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Angle

public Angle(double value,
             AngleUnit unit)
Angle constructor.

Parameters:
value - the angle in the specified unit.
unit - the measurement unit being used.
Throws:
ArrayArrayIndexOutOfBoundsException - unknown measurement unit
Method Detail

getValue

public double getValue(AngleUnit unit)
Gets the angle in the specified unit.

Parameters:
unit - the measurement unit being used.
Returns:
angle in the specified measurement unit.
Throws:
ArrayIndexOutOfBoundsException - unknown measurement unit

setValue

public void setValue(double value,
                     AngleUnit unit)
Sets this Angle using the specified unit.

Parameters:
value - the new angle in the specified unit.
unit - the measurement unit being used.
Throws:
ArrayIndexOutOfBoundsException - unknown measurement unit

getDMSDegrees

public int getDMSDegrees()
Returns the degree component of the angle expressed in degrees, minutes and seconds

See Also:
to express the entire angle in degrees

getDMSMinutes

public int getDMSMinutes()
Returns the minute component of the angle expressed in degrees, minutes and seconds

See Also:
to express the entire angle in minutes

getDMSSeconds

public double getDMSSeconds()
Returns the minute component of the angle expressed in degrees, minutes and seconds

See Also:
to express the entire angle in minutes

add

public Angle add(Angle x)
Returns an Angle whose value is (this + x).

Parameters:
x - the Angle to be added.
Returns:
(this + x)

substract

public Angle substract(Angle x)
Returns an Angle whose value is (this - x).

Parameters:
x - the Angle to be substracted.
Returns:
(this - x)

multiply

public Angle multiply(double coefficient)
Returns an Angle whose value is (this * coefficient).

Parameters:
coefficient - the dimensionless multiplier.
Returns:
(this * coefficient)

divide

public Angle divide(double coefficient)
Returns an Angle whose value is (this / coefficient).

Parameters:
coefficient - the dimensionless divisor.
Returns:
(this / coefficient)
Throws:
ArithmeticException - coefficient == 0.0

sin

public double sin()
Returns the trigonometric sine of this Angle.

Returns:
the sine of this Angle.

cos

public double cos()
Returns the trigonometric cosine of this Angle.

Returns:
the cosine of this Angle.

tan

public double tan()
Returns the trigonometric tangent of this Angle.

Returns:
the tangent of this Angle.

asin

public static Angle asin(double x)
Creates an Angle such as its sine is the specified argument.

Parameters:
x - sine value.
Returns:
a new Angle whose getValue(RADIAN) is in the range of -pi/2 through pi/2.

acos

public static Angle acos(double x)
Creates an Angle such as its cosine is the specified argument.

Parameters:
x - cosine value.
Returns:
a new Angle whose getValue(RADIAN) is in the range of 0.0 through pi.

atan

public static Angle atan(double x)
Creates an Angle such as its tangent is the specified argument.

Parameters:
x - tangent value.
Returns:
a new Angle whose getValue(RADIAN) is in the range of -pi/2 through pi/2.

atan2

public static Angle atan2(Length y,
                          Length x)
Converts rectangular coordinates (xy) to polar (rho, theta). This method computes the phase theta by computing an arc tangent of y/x whose getValue(RADIAN) is in the range of -pi to pi.

Parameters:
y - y coordinate value.
x - x coordinate value.
Returns:
the theta component of the point (rhotheta) in polar coordinates that corresponds to the point (xy) in Cartesian coordinates.
See Also:
Length.magnitude(Length, Length)

normalize

public void normalize()
Adds or removes a discrete number of revolution to this Angle. The normalized angle has a getValue(RADIAN) in the range of -pi through pi


compareTo

public int compareTo(Angle x)
Compares this Angle with the specified Angle. This method is provided in preference to individual methods for each of the six boolean comparison operators (<, ==, >, >=, !=, <=). The suggested idiom for performing these comparisons is: (x.compareTo(y) <op> 0), where <op> is one of the six comparison operators.

Parameters:
x - Angle to which this Angle is to be compared.
Returns:
-1, 0 or 1 as this Angle is numerically less than, equal to, or greater than x.

compareTo

public int compareTo(Object o)
Compares this Angle with the specified Object. If the Object is a Angle, this method behaves like compareTo(Angle). Otherwise, it throws a ClassCastException (as Angles are comparable only to other Angles).

Specified by:
compareTo in interface Comparable
Parameters:
o - Object to which this Angle is to be compared.
Returns:
a negative number, zero, or a positive number as this Angle is numerically less than, equal to, or greater than o, which must be a Angle.
Throws:
ClassCastException - o is not a Angle.
See Also:
compareTo(Angle), Comparable


Copyright (C) NARC 2001 All Rights Reserved.