Represents the Sun on a little portion of Earth.

Constructors

Sun

#Since v5.0
public Sun()
Create a utility object not associated with any document

Finalizer

~Sun

#
~Sun()

Properties

Accuracy

#Since v8.0
public Sun.Accuracies Accuracy { get; set; }
Accuracy.

Altitude

#Since v5.0
public double Altitude { get; set; }
The sun's altitude above the horizon in degrees in the range -90 to +90. Setting this value will also set the sun to manual control mode.

Azimuth

#Since v5.0
public double Azimuth { get; set; }
The sun's azimuth in degrees. The value increases Eastwards with North as zero. Setting this value will also set the sun to manual control mode. Note: This value is not affected by the direction of north.

DaylightSaving

#Since v5.10
public bool DaylightSaving { get; set; }
obsoleteUse DaylightSavingOn

DaylightSavingMinutes

#Since v6.0
public int DaylightSavingMinutes { get; set; }
Daylight saving time in minutes

DaylightSavingOn

#Since v5.10
public bool DaylightSavingOn { get; set; }
Daylight saving time 'on' state

Enabled

#Since v5.0
public bool Enabled { get; set; }
Turn the sun on/off in this document.

Hash

#Since v8.0
[CLSCompliant(false)] public uint Hash { get; }
Get a hash of the sun state.

Intensity

#Since v7.0
public double Intensity { get; set; }
Sun intensity.

Latitude

#Since v5.0
public double Latitude { get; set; }
The observer's latitude.

Light

#Since v6.0
public Light Light { get; }
Get a Light which represents the sun. If manual control is in effect, no sun calculation is performed; the function uses the last known values of azimuth and altitude. If manual control is not in effect, the observer's position, date, time, time zone and daylight saving values are used to calculate the position of the sun.

Longitude

#Since v5.0
public double Longitude { get; set; }
The observer's longitude.

ManualControl

#Since v5.10
public bool ManualControl { get; set; }
obsoleteUse ManualControlOn

ManualControlOn

#Since v8.0
public bool ManualControlOn { get; set; }
Manual control 'on' state. When true, allows the user to set the sun azimuth and altitude directly. When false, the values are computed.

North

#Since v5.0
public double North { get; set; }
Angle in degrees on world X-Y plane that should be considered north in the model. The angle is measured starting at the x-axis and increases anti-clockwise. The y-axis corresponds to a 'north' angle of 90 degrees.

SkylightOn

#Since v5.10
public bool SkylightOn { get; set; }
obsoleteUse Rhino.Render.Skylight instead
Turn skylight on or off.

TimeZone

#Since v5.10
public double TimeZone { get; set; }
The observer's time zone measured in hours relative to UTC.

Vector

#Since v5.0
public Vector3d Vector { get; set; }

Methods

AltitudeFromValues

#Since v6.0
public static double AltitudeFromValues(double latitude, double longitude, double timezoneHours, int daylightMinutes, DateTime when, double hours, bool fast = false)
latitude (double)
longitude (double)
timezoneHours (double)
daylightMinutes (int)
when (DateTime)
hours (double)
fast (bool = false)

BeginChange

public void BeginChange(ChangeContexts cc)
inherited fromDocumentOrFreeFloatingBase

ColorFromAltitude

#Since v6.0
public static Color ColorFromAltitude(double altitudeDegrees)
Get sun color based on altitude.
altitudeDegrees (double)The altitude sun angle in degrees.
Returns color for altitude.

CopyFrom

#Since v6.0
public override void CopyFrom(FreeFloatingBase src)
src (FreeFloatingBase)

Dispose

#Since v5.0
public void Dispose()

GetDateTime

#Since v5.0
public DateTime GetDateTime(DateTimeKind kind)
Get the observer's date and time as a DateTime with kind DateTimeKind.Local. Param 'kind' specifies the kind of date and time to retrieve from the sun. - If DateTimeKind.Local, the returned DateTime will contain the local sun time, i.e., the time you see in the UI under 'Local'. - If DateTimeKind.Utc, the returned DateTime will contain the UTC sun time, i.e., the time you see in the UI under 'UTC', which is the Sun's local time adjusted for its time zone and daylight saving (if any). **** Local sun time is to do with the Sun's time zone and not the time zone of the computer. **** The returned DateTime object always has a kind of Local even if you requested the sun's UTC date and time. This is because the Sun's time zone is nothing to do with the actual computer's time zone and converting the result would cause further confusion.
kind (DateTimeKind)

Here

#Since v6.0
public static bool Here(out double latitude, out double longitude)
latitude (out double)
longitude (out double)

JulianDay

#Since v6.0
public static double JulianDay(double timezoneHours, int daylightMinutes, DateTime when, double hours)
timezoneHours (double)
daylightMinutes (int)
when (DateTime)
hours (double)

SetDateTime

#Since v6.0
public void SetDateTime(DateTime time, DateTimeKind kind)
Set the observer's date and time. kind specifies the kind of date and time to set to the sun. Note that this is distinct from the DateTimeKind of 'time' which has nothing to do with the sun's local/UTC scenario. - If 'kind' is DateTimeKind.Local, the sun's local time will be set, i.e., the time you see in the UI under 'Local'. This is the preferred way to use this function. - If 'kind' is DateTimeKind.Utc, the sun's UTC time will be set, i.e., the time you see in the UI under 'UTC'. This is only for completeness; it's not likely to be useful, but if you do use it, be aware that the sun will convert this time to local using its currently set time zone and daylight saving information (not the locale's information). Caveat: Local sun time is to do with the Sun's time zone and not the time zone of the computer. Caveat: If the supplied DateTime object has a kind of Local, it will be used verbatim. If, however, it has a kind of Utc, it will be converted to local time on the computer using the computer's time zone and daylight saving locale information before being passed to the sun. To avoid confusion, it's best to always use DateTimes with Kind 'Local' when setting the sun's date and time. This is because the Sun's time zone is nothing to do with the actual computer's time zone.
time (DateTime)
kind (DateTimeKind)

SetPosition

#Since v5.0 Obsolete v8.0
public void SetPosition(DateTime when, double latitudeDegrees, double longitudeDegrees)
obsoleteUse SetDateTime() and Latitude / Longitude properties instead
when (DateTime)
latitudeDegrees (double)
longitudeDegrees (double)

SetPosition

#Since v5.0 Obsolete v8.0
public void SetPosition(double azimuthDegrees, double altitudeDegrees)
obsoleteUse Azimuth and Altitude properties instead
azimuthDegrees (double)
altitudeDegrees (double)

ShowDialog

#Since v5.0 Obsolete v6.0
[EditorBrowsable(EditorBrowsableState.Never)] public void ShowDialog()
obsoleteUse Rhino.UI.Dialogs.ShowSunDialog() instead
Show the modal sun dialog.

SunDirection

#Since v5.0
public static Vector3d SunDirection(double latitude, double longitude, DateTime when)
latitude (double)
longitude (double)
when (DateTime)

TwilightZone

#Since v6.0
public static double TwilightZone()

Events

Changed

#Since v5.10
public static event EventHandler<RenderPropertyChangedEvent> Changed
This event is raised when a Sun property value is changed.