This site Web
Home Page | The Sun API | Gallery | InfoSearch | News | Links | Contact Us

Sunlit Design > The Sun API > Documentation > sdUnit2D Function


Index


- Introduction
+ Using the Functions
+ User Guide
+ Function Reference
+ Constants

Contact Developer

Downloads

sdUnit2D Function

Description

Returns the result of converting a value in some unit into degrees.

Syntax

sdUnit2D(value,fromunit)

degree    a numeric value to be converted

fromunit    a constant value showing which unit to convert from.

Return Values

sdUnit2D returns a double precision number.

Errors

If this function finds any errors in it's input parameter(s) it returns -99999999

Remarks

The function converts between units of time (Day, Hour, Minute, Second) and units of rotation (Degree, Arcminute, Arcsecond, Radian) on the basis that:

  • 24 hours = 360 degrees and

  • 24 hours = 2pi radians and

  • 1 hour = 15 degrees and

  • 4 minutes = 1 degree, etc.

You can convert a degree value to another unit by using the sdD2Unit function.

You can convert a degree value to it's Degrees:Minute:Seconds components using the sdDUnpackx function and to a printable text format using sdD2Text function.

Example

 To convert 23 arcseconds to degrees
    sdUnit2D(23,sdUnitArcSec)equals 0.0063888888888888...

To convert pi/2 radians to degrees:
    sdUnit2D(sdPI()/2,sdUnitRadian) equals 90