Skip to contents

Function that calculates coordinates of a polygon representing the shape of the illuminated fraction of the moon, as observed from Earth. The shape has a radius of 1 and is centred around (0, 0). It does not consider lunar eclipses.

Usage

lunar_phase_polygon(date, longitude, latitude, n = 100)

Arguments

date

A datetime object used to calculate the illuminated fraction of the moon

longitude, latitude

Used to calculate zenith angle. This will result in a more accurate shape of the moon as observed at the specified location.

n

Number of coordinates in the returned polygon shape (should be even).

Value

Returns a data.frame with coordinates of a polygon representing the shape of the illuminated fraction of the moon.

Author

Pepijn de Vries

Examples

disc_illum <- lunar_phase_polygon(as.POSIXct("2025-04-01"))
plot(NA, NA, xlim = c(-1,1), ylim = c(-1, 1), asp = 1,
     xlab = "x coord", ylab = "y coord")
polygon(disc_illum$x, disc_illum$y, col = "white")


disc_illum <- lunar_phase_polygon(as.POSIXct("2025-04-01"), 5, 50)
plot(NA, NA, xlim = c(-1,1), ylim = c(-1, 1), asp = 1,
     xlab = "x coord", ylab = "y coord")
polygon(disc_illum$x, disc_illum$y, col = "white")