Sun and Moon Diagram Component



Event Handlers


diagramMC.onViewerDirectionChanged()

This function (if defined) is called whenever the diagram orientation changes due to dragging.



Methods


diagramMC.addSun(angle)

This function adds a sun icon ("Sun Icon for Diagram" in the library) on the celestial equator at the angle specified by angle. The angle is measured counter-clockwise from the meridian in degrees.


diagramMC.addMoon(angle)

This function adds a moon icon ("Moon Icon for Diagram" in the library) on the celestial equator at the angle specified by angle. The angle is measured counter-clockwise from the meridian in degrees.


diagramMC.getSunLocations(), diagramMC.getMoonLocations()

The function getSunLocations returns an array of angles where sun icons have been added. The getMoonLocations function does the same for the moon icons.


diagramMC.setSize(size)

size is the diameter of the celestial sphere in pixels. The default is 150 px.


diagramMC.setLatitude(lat)

lat is in degrees. The default is 41°.


diagramMC.setViewerDirection(az, alt)

az and alt (both in degrees) determine the orientation of the celestial sphere. The defaults are 200° and 30°.


diagramMC.getViewerDirection()

This function returns an object with az and alt properties, which define the orientation of the diagram.


diagramMC.startDragging(), diagramMC.stopDragging()

When dragging the sphere's perspective (viewer direction) changes as the mouse moves.


diagramMC.clearDiagram()

This function removes all the sun and moon icons that have been attached to the celestial sphere.