Package org.oscim.renderer.light
Class Sun
java.lang.Object
org.oscim.renderer.light.Sun
See https://lexikon.astronomie.info/zeitgleichung
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetColor()RGB - the color of sun.Get the colors of day cycle.floatfloatfloat[]floatfloatfloatvoidsetColor(int color) voidsetColorMap(Map<Float, Integer> colorMap) Set the colors of day cycle.voidsetCoordinates(float latitude, float longitude) voidsetDayOfYear(int day) Customize day of the year.voidsetPosition(float x, float y, float z) voidsetProgress(float progress) Customize progress.floatsetProgress(int hour, int minute, int second) Customize progress with specified time.voidupdate()Update sun progress, position and color to current date time.intfloat[]Very simple normalized sun coordinates.floatThe progress of the daylight in range 0 (sunrise) to 1 (sunset) and of the night in range 1 (sunset) to 2 (sunrise).voidCalculate the sunrise and sunset of set day (local time).
-
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
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
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).
-