Class Sun

java.lang.Object
org.oscim.renderer.light.Sun

public class Sun extends Object
See https://lexikon.astronomie.info/zeitgleichung
  • Field Details

    • SHADOW_ALPHA

      public static float SHADOW_ALPHA
  • Constructor Details

    • Sun

      public Sun()
      Track sun position (accuracy of ~1 minute).
  • Method Details

    • getColor

      public int getColor()
      RGB - the color of sun. A - the diffuse of shadow.
    • getColorMap

      public Map<Float,Integer> getColorMap()
      Get the colors of day cycle.
      Returns:
      the color map
    • getLatitude

      public float getLatitude()
    • getLongitude

      public float getLongitude()
    • getPosition

      public float[] getPosition()
    • getProgress

      public float getProgress()
    • getSunrise

      public float getSunrise()
      Returns:
      the local sunrise time in hours.
    • getSunset

      public float getSunset()
      Returns:
      the local sunset time in hours.
    • setColor

      public void setColor(int color)
      Parameters:
      color - RGB - the color of sun, A - the diffuse of shadow
    • setColorMap

      public void setColorMap(Map<Float,Integer> colorMap)
      Set the colors of day cycle.
    • setCoordinates

      public void setCoordinates(float latitude, float longitude)
    • setDayOfYear

      public void setDayOfYear(int day)
      Customize day of the year.
    • setPosition

      public void setPosition(float x, float y, float z)
    • setProgress

      public void setProgress(float progress)
      Customize progress.
    • setProgress

      public float setProgress(int hour, int minute, int second)
      Customize progress with specified time.
      Parameters:
      hour - the hour [0..23]
      minute - the minute [0..59]
      second - the second [0..59]
      Returns:
      the progress in range 0 to 2
    • update

      public void update()
      Update sun progress, position and color to current date time.
    • updateColor

      public int updateColor()
    • updatePosition

      public float[] updatePosition()
      Very simple normalized sun coordinates.
    • updateProgress

      public float updateProgress()
      The progress of the daylight in range 0 (sunrise) to 1 (sunset) and of the night in range 1 (sunset) to 2 (sunrise).
      Returns:
      the progress in range 0 to 2
    • updateToDay

      public void updateToDay()
      Calculate the sunrise and sunset of set day (local time).