## EDU.gatech.cc.is.util Class Units

```java.lang.Object
|
+--EDU.gatech.cc.is.util.Units
```

public class Units
extends java.lang.Object

Routines for units conversion.

 Field Summary `static double` `HUGE`           A very large number `static double` `PI2`           Handy to have 2 PI around.

 Constructor Summary `Units()`

 Method Summary `static double` ```BestTurnDeg(double start, double finish)```           Compute the best direction and angle to turn from the start angle to the finish angle in degrees. `static double` ```BestTurnRad(double start, double finish)```           Compute the best direction and angle to turn from the start angle to the finish angle in radians. `static double` `ClipDeg(double deg)`           Limit the angle to between 0 and 359.9999. `static double` `ClipRad(double rad)`           Limit the angle to between 0 and 2 PI. `static double` `Deg10ToRad(int deg10)`           Convert 10ths of degrees to radians. `static double` `DegToRad(double deg)`           Convert degrees to radians. `static double` `DegToRad(int deg)`           Convert degrees to radians. `static double` `Inch10ToMeter(int inch10)`           Convert 10ths of inches to meters. `static double` `InchToMeter(double inch)`           Convert inches to meters. `static double` `InchToMeter(int inch)`           Convert inches to meters. `static void` `main(java.lang.String[] args)`           Test the units functions. `static double` `MeterToInch(double meter)`           Convert meters to inches. `static int` `MeterToInch10(double meter)`           Convert meters to 10ths of inches. `static double` `RadToDeg(double rad)`           Convert radians to degrees. `static int` `RadToDeg10(double rad)`           Convert radians to 10ths of degrees. `static double` `readDouble(java.io.StreamTokenizer in)`           read a double from a stream.

 Methods inherited from class java.lang.Object ```clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait```

 Field Detail

### PI2

`public static final double PI2`
Handy to have 2 PI around.

### HUGE

`public static final double HUGE`
A very large number
 Constructor Detail

### Units

`public Units()`
 Method Detail

`public static double DegToRad(double deg)`
Parameters:
`deg` - double, degrees.
Returns:

`public static double DegToRad(int deg)`
Parameters:
`deg` - int, degrees.
Returns:

`public static double Deg10ToRad(int deg10)`
Convert 10ths of degrees to radians.
Parameters:
`deg10` - int, 10ths of degrees.
Returns:

`public static double RadToDeg(double rad)`
Parameters:
`rad` - double, radians.
Returns:
degrees.

`public static int RadToDeg10(double rad)`
Convert radians to 10ths of degrees.
Parameters:
`rad` - double, radians.
Returns:
10ths of degrees.

### InchToMeter

`public static double InchToMeter(int inch)`
Convert inches to meters.
Parameters:
`inch` - int, inches.
Returns:
meters.

### InchToMeter

`public static double InchToMeter(double inch)`
Convert inches to meters.
Parameters:
`inch` - double, inches.
Returns:
meters.

### Inch10ToMeter

`public static double Inch10ToMeter(int inch10)`
Convert 10ths of inches to meters.
Parameters:
`inch` - int, inches.
Returns:
10ths of meters.

### MeterToInch10

`public static int MeterToInch10(double meter)`
Convert meters to 10ths of inches.
Parameters:
`meter` - double, meters.
Returns:
inches.

### MeterToInch

`public static double MeterToInch(double meter)`
Convert meters to inches.
Parameters:
`meter` - double, meters.
Returns:
inches.

`public static double ClipRad(double rad)`
Limit the angle to between 0 and 2 PI.
Parameters:
`rad` - double, angle in radians to be clipped.
Returns:
the clipped angle.

### ClipDeg

`public static double ClipDeg(double deg)`
Limit the angle to between 0 and 359.9999.
Parameters:
`deg` - double, angle in degrees to be clipped.
Returns:
the clipped angle.

### BestTurnDeg

```public static double BestTurnDeg(double start,
double finish)```
Compute the best direction and angle to turn from the start angle to the finish angle in degrees.
Parameters:
`start` - The starting angle.
`finish` - The desired angle.
Returns:
the required turn.

```public static double readDouble(java.io.StreamTokenizer in)
throws java.lang.Exception```
read a double from a stream. Assumes you have just read the token.
Parameters:
`in` - StreamTokenizer, the stream to read from.
Returns:
the double.
Throws:
java.lang.Exception - if there is no number there.

```public static double BestTurnRad(double start,
`start` - The starting angle.
`finish` - The desired angle.
`public static void main(java.lang.String[] args)`