# Functions

The following functions are available globally.

• ``` asteroidDiameter(magnitude:albedo:) ```

See AA p. 391. AA+ result is given in kilometers

#### Declaration

Swift

``public func asteroidDiameter(magnitude: Magnitude, albedo: Double) -> Kilometer``
• ``` apparentAsteroidDiameter(magnitude:albedo:) ```

See AA p. 391. AA+ result is given in kilometers

#### Declaration

Swift

``public func apparentAsteroidDiameter(magnitude: Magnitude, albedo: Double) -> ArcSecond``
• ``` refraction(fromApparentAltitude:pressure:temperature:) ```

Compute the atmospheric refraction from the apparent altitude of a celestial body h0 that has been already measured, and from which one must substract R to find the true altitude h.

#### Declaration

Swift

``public func refraction(fromApparentAltitude h0: Degree, pressure: Millibar = 1010, temperature: Celsius = 10) -> ArcMinute``

#### Parameters

 ``` h0 ``` The apparent altitude ``` pressure ``` The atmospheric pressure at Earth’s surface ``` temperature ``` The air temperature at Earth’s surface

#### Return Value

The refraction amplitude, in arcminutes.

• ``` refraction(fromTrueAltitude:pressure:temperature:) ```

Compute the atmospheric refraction from the true “airless” altitude of a celestial body h that has been already calculated, and from which one must add R to find the apparent altitude h0.

#### Declaration

Swift

``public func refraction(fromTrueAltitude h: Degree, pressure: Millibar = 1010, temperature: Celsius = 10) -> ArcMinute``

#### Parameters

 ``` h ``` The true altitude ``` pressure ``` The atmospheric pressure at Earth’s surface ``` temperature ``` The air temperature at Earth’s surface

#### Return Value

The refraction amplitude, in arcminutes.

• ``` binaryStarDetails(time:elements:) ```

Returns the details of a binary star.

#### Declaration

Swift

``public func binaryStarDetails(time: Double, elements: BinaryStarOrbitalElements) -> BinaryStarDetails``

#### Parameters

 ``` time ``` The time at which the details must be computed. ``` elements ``` the binary star orbital elements

#### Return Value

The details of a binary star.

• ``` binaryStarApparentEccentricity(eccentricity:inclination:omega:) ```

Return the apparent eccentricity of the binary stars orbit.

#### Declaration

Swift

``public func binaryStarApparentEccentricity(eccentricity: Double, inclination: Degree, omega: Degree) -> Double``

#### Parameters

 ``` eccentricity ``` The true orbital eccentricity ``` inclination ``` The orbit inclination ``` omega ``` The longitude of periastron

#### Return Value

The apparent eccentricity of the orbit, as seen on the sky.

• ``` unreachable() ```

This is a `noreturn` function that pauses forever

#### Declaration

Swift

``public func unreachable() -> Never``
• ``` ==(_:_:) ```

Undocumented

#### Declaration

Swift

``public func == (lhs: SexagesimalNotation, rhs: SexagesimalNotation) -> Bool``
• ``` riseTransitSet(forJulianDay:equCoords1:equCoords2:equCoords3:geoCoords:apparentRiseSetAltitude:) ```

Calculate the rise, transit and set times of a celestial body for a given location on Earth.

One must correct the instants of the geometric rise and set of the center of the celestial body by the athomspheric refraction. Because of it, the body is actually below the horizon at the instant of its apparent rise or set. The value of 0º34’ is generally adopted for the effect of refraction at the horizon. For the Sun, the calculated times generally refer to the apparent rise or set of the upper limb of the disk, hence, 0º16’ should be added to the semidiameter

Actually, the amount of refraction changes with air temperature, pressure and the elevation of the observer. A change of temperature from winter to summer can shift the times of sunrise and sunset by about 20 secondes in mid-northern and mid-southern latitudes. Similarly, observing sunrise or sunset over a range of barometric pressures leads to a variation of a dozen seconds in the times. However, in this chapter we shall use a mean value of the atmospheric refraction at the horizon, namely the value of 0º34’ mentionned above.

Notes: The geographic longitude must be expressed postively west from Greenwhich, in degrees. The standard altitude, i.e. the geometric altitude of the center of the body at the time of apparent rising, setting, namely: h0 = -0º34’ = 0º.5667 for stars and planets h0 = -0º50’ = 0º.8333 for the sun h0 = +0º.125 for the moon Actually, for the moon h0 is not constant. See p.102 of AA.

#### Declaration

Swift

``````public func riseTransitSet(forJulianDay julianDay: JulianDay,
equCoords1: EquatorialCoordinates,
equCoords2: EquatorialCoordinates,
equCoords3: EquatorialCoordinates,
geoCoords: GeographicCoordinates,
apparentRiseSetAltitude: Degree) -> RiseTransitSetTimesDetails``````

#### Parameters

 ``` julianDay ``` the date at which one want to compute the times. MUST BE SET AT 0h UT for the given DAY. ``` equCoords1 ``` the equatorial coordinates of the body at Date - 1 Day. ``` equCoords2 ``` the equatorial coordinates of the body at Date. ``` equCoords3 ``` the equatorial coordinates of the body at Date + 1 Day. ``` geoCoords ``` the location on Earth, with its altitude set to the standard one (see above)

#### Return Value

the times of rise, transit and set, with an indication if it is actually valid or not.