Calculating the phase of the Moon is pretty straightforward. I'm not asking that. The moon actually changes its phase-angle and illumination because of librations and other factors. (see here for the moon phases for 2011: https://www.youtube.com/watch?v=3f_21N3wcX8)
Meeus in Astronomical Algorithms (pgs. 98-99 Ch. 14 and pgs. 345-357, chs. 48-50), gives formulae for the phase, illumination, phase-angle and and the parallactic angle to show the position and illumination of the moon. The problem I have is implementation in php. How to translate angles in order to achieve the relevant filled-in arc, together with a dark circle to create the appearance of the moon correctly as it would appear in the night sky.
I am aware of imagearc ( resource $image , int $cx , int $cy , int $width , int $height , int $start , int $end , int $color) which obviously creates the arc, with the relevant angle.
To create the horns, or the illusion of a crescent, can one superimpose two arcs on top of each other? The other question is can this be used in tandem with a blur, shadow and actual moon image to make it more realistic? Or am I better off implementing this in CSS? Are there any implementations in code that draws the actual moon as determined by the Phase and Paralletic angles?