Rhino C++ API  8.7
Public Member Functions | Static Public Member Functions | Friends | List of all members
ON_Sun Class Reference

#include <opennurbs_sun.h>

Public Member Functions

 ON_Sun ()
 
 ON_Sun (const ON_Sun &sun)
 
 ON_Sun (ON_EarthAnchorPoint &eap)
 
 ON_Sun (ON_XMLNode &model_node)
 
virtual ~ON_Sun ()
 
virtual ON_SunEngine::Accuracy Accuracy (void) const
 Get the accuracy of the sun calculations. The default is minimum accuracy (for more speed). More...
 
virtual double Altitude (void) const
 Returns the altitude of the sun in degrees. More...
 
virtual double Azimuth (void) const
 
virtual ON_3dVector CalculateVectorFromAzimuthAndAltitude (void) const
 
virtual ON__UINT32 DataCRC (ON__UINT32 current_remainder) const
 Returns the CRC of the sun state. More...
 
virtual int DaylightSavingMinutes (void) const
 Returns the daylight saving offset of the observer in minutes. More...
 
virtual bool DaylightSavingOn (void) const
 Returns true if daylight saving is on, else false. More...
 
virtual bool EnableAllowed (void) const
 Returns true if enabling/disabling the sun is allowed, else false. More...
 
virtual bool EnableOn (void) const
 Returns true if the sun is enabled, else false. More...
 
virtual void * EVF (const wchar_t *func, void *data)
 Emergency virtual function for future expansion. More...
 
virtual double Intensity (void) const
 Returns the intensity to be used for the sun. This is 1.0 by default. More...
 
virtual bool IsValid (void) const
 Returns true if all the sun parameters are valid, or false if any value is invalid. More...
 
virtual double Latitude (void) const
 Returns the latitude of the observer. More...
 
virtual ON_Light Light (void) const
 < These utility methods are provided for convenience and perform calculations by using ON_SunEngine. More...
 
virtual void LoadFromXMLNode (const ON_XMLNode &node)
 Load the sun properties from a 'sun' XML node. More...
 
virtual void LocalDateTime (int &year, int &month, int &day, double &hours) const
 
virtual double Longitude (void) const
 Returns the longitude of the observer. More...
 
virtual bool ManualControlAllowed (void) const
 Returns true if manual control of the sun position is allowed, else false. More...
 
virtual bool ManualControlOn (void) const
 Returns true if manual control of the sun position is in effect, else false. More...
 
virtual double North (void) const
 
virtual void OnInternalXmlChanged (const ON_Sun *)
 For internal use only. More...
 
virtual bool operator!= (const ON_Sun &sun) const
 
virtual const ON_Sunoperator= (const ON_Sun &sun)
 
virtual bool operator== (const ON_Sun &sun) const
 
virtual bool ReadFromArchive (ON_BinaryArchive &archive)
 Read the sun properties from an archive that was created by WriteToArchive(). More...
 
virtual void SaveToXMLNode (ON_XMLNode &node) const
 Save the sun properties to a 'sun' XML node. More...
 
virtual void SetAccuracy (ON_SunEngine::Accuracy acc)
 Set the accuracy of the sun calculations. The default is minimum accuracy (for more speed). More...
 
virtual void SetAltitude (double altitude)
 
virtual void SetAzimuth (double azimuth)
 
virtual void SetAzimuthAndAltitudeFromVector (const ON_3dVector &v)
 Calculates and sets the sun's azimuth and altitude taking into account the direction of north. More...
 
virtual void SetDaylightSavingMinutes (int minutes)
 Set the daylight saving of the observer in minutes, in the range 0 to 120. More...
 
virtual void SetDaylightSavingOn (bool on)
 Set whether or not the observer is using daylight saving time. More...
 
virtual void SetEnableAllowed (bool allowed)
 Set whether or not enabling/disabling the sun is allowed. More...
 
virtual void SetEnableOn (bool on)
 Set whether or not the sun is enabled. More...
 
virtual void SetIntensity (double intensity)
 Set the intensity to be used for the sun. This is 1.0 by default. More...
 
virtual void SetLatitude (double latitude)
 
virtual bool SetLocalDateTime (int year, int month, int day, double hours)
 
virtual void SetLongitude (double longitude)
 
virtual void SetManualControlAllowed (bool allowed)
 Set whether or not manual control of the sun position is allowed. More...
 
virtual void SetManualControlOn (bool manual)
 Set whether or not manual control of the sun position is in effect. More...
 
virtual void SetNorth (double north)
 
virtual void SetShadowIntensity (double intensity)
 This is currently unused. More...
 
virtual void SetTimeZone (double hours)
 Set the time zone of the observer in hours, in the range -12 to +13. More...
 
virtual bool SetUTCDateTime (int year, int month, int day, double hours)
 
virtual double ShadowIntensity (void) const
 This is currently unused. More...
 
virtual double TimeZone (void) const
 Returns the time zone of the observer in decimal hours. More...
 
virtual void UTCDateTime (int &year, int &month, int &day, double &hours) const
 
virtual bool WriteToArchive (ON_BinaryArchive &archive) const
 Write the sun properties to an archive. More...
 

Static Public Member Functions

static bool IsValidDateTime (int year, int month, int day, int hour, int min, int sec)
 Returns true if the specified time is within the range supported by ON_Sun. More...
 
static int MaxYear (void)
 Returns the maximum allowed year for sun methods. More...
 
static int MinYear (void)
 Returns the minimum allowed year for sun methods. More...
 
static ON_4fColor SunColorFromAltitude (double altitude)
 Get a color for rendering a sun light when the sun is at a particular altitude in the sky. More...
 

Friends

class ON_3dmRenderSettingsPrivate
 < For internal use only. More...
 
class ONX_Model
 

Detailed Description

Class ON_Sun represents a 'sun'. It can calculate the apparent position of the sun in the sky at a particular instant for a particular location on the Earth's surface. It can also be used to get the sun's color, a light representing the sun, or to generate an ephemeris.

Constructor & Destructor Documentation

◆ ON_Sun() [1/4]

ON_Sun::ON_Sun ( )

◆ ON_Sun() [2/4]

ON_Sun::ON_Sun ( ON_EarthAnchorPoint eap)

◆ ON_Sun() [3/4]

ON_Sun::ON_Sun ( ON_XMLNode model_node)

◆ ON_Sun() [4/4]

ON_Sun::ON_Sun ( const ON_Sun sun)

◆ ~ON_Sun()

virtual ON_Sun::~ON_Sun ( )
virtual

Member Function Documentation

◆ Accuracy()

virtual ON_SunEngine::Accuracy ON_Sun::Accuracy ( void  ) const
virtual

Get the accuracy of the sun calculations. The default is minimum accuracy (for more speed).

◆ Altitude()

virtual double ON_Sun::Altitude ( void  ) const
virtual

Returns the altitude of the sun in degrees.

◆ Azimuth()

virtual double ON_Sun::Azimuth ( void  ) const
virtual

Returns the azimuth of the sun in degrees. The value increases Eastwards with North as zero. Note: This value is not affected by the direction of north. See North().

◆ CalculateVectorFromAzimuthAndAltitude()

virtual ON_3dVector ON_Sun::CalculateVectorFromAzimuthAndAltitude ( void  ) const
virtual

Returns The sun's direction vector in world space, taking into account the sun's azimuth and altitude and the direction of north. Note that this does not actually calculate the azimuth or altitude from the place and time; it merely uses the stored azimuth and altitude values.

◆ DataCRC()

virtual ON__UINT32 ON_Sun::DataCRC ( ON__UINT32  current_remainder) const
virtual

Returns the CRC of the sun state.

◆ DaylightSavingMinutes()

virtual int ON_Sun::DaylightSavingMinutes ( void  ) const
virtual

Returns the daylight saving offset of the observer in minutes.

◆ DaylightSavingOn()

virtual bool ON_Sun::DaylightSavingOn ( void  ) const
virtual

Returns true if daylight saving is on, else false.

◆ EnableAllowed()

virtual bool ON_Sun::EnableAllowed ( void  ) const
virtual

Returns true if enabling/disabling the sun is allowed, else false.

◆ EnableOn()

virtual bool ON_Sun::EnableOn ( void  ) const
virtual

Returns true if the sun is enabled, else false.

◆ EVF()

virtual void* ON_Sun::EVF ( const wchar_t *  func,
void *  data 
)
virtual

Emergency virtual function for future expansion.

◆ Intensity()

virtual double ON_Sun::Intensity ( void  ) const
virtual

Returns the intensity to be used for the sun. This is 1.0 by default.

◆ IsValid()

virtual bool ON_Sun::IsValid ( void  ) const
virtual

Returns true if all the sun parameters are valid, or false if any value is invalid.

◆ IsValidDateTime()

static bool ON_Sun::IsValidDateTime ( int  year,
int  month,
int  day,
int  hour,
int  min,
int  sec 
)
static

Returns true if the specified time is within the range supported by ON_Sun.

◆ Latitude()

virtual double ON_Sun::Latitude ( void  ) const
virtual

Returns the latitude of the observer.

◆ Light()

virtual ON_Light ON_Sun::Light ( void  ) const
virtual

< These utility methods are provided for convenience and perform calculations by using ON_SunEngine.

Get an ON_Light which represents the sun. Note that this does not actually calculate the sun's azimuth or altitude from the place and time. It merely uses the stored azimuth and altitude values.

◆ LoadFromXMLNode()

virtual void ON_Sun::LoadFromXMLNode ( const ON_XMLNode node)
virtual

Load the sun properties from a 'sun' XML node.

◆ LocalDateTime()

virtual void ON_Sun::LocalDateTime ( int &  year,
int &  month,
int &  day,
double &  hours 
) const
virtual

Retrieves the local date and time of the observer. Param year accepts the year in the range MinYear() to MaxYear(). Param month accepts the month in the range 1 to 12. Param day accepts the day in the range 1 to 31. Param hours accepts the time expressed as decimal hours in the range 0 to 24. Returns The local date and time of the observer.

◆ Longitude()

virtual double ON_Sun::Longitude ( void  ) const
virtual

Returns the longitude of the observer.

◆ ManualControlAllowed()

virtual bool ON_Sun::ManualControlAllowed ( void  ) const
virtual

Returns true if manual control of the sun position is allowed, else false.

◆ ManualControlOn()

virtual bool ON_Sun::ManualControlOn ( void  ) const
virtual

Returns true if manual control of the sun position is in effect, else false.

◆ MaxYear()

static int ON_Sun::MaxYear ( void  )
static

Returns the maximum allowed year for sun methods.

◆ MinYear()

static int ON_Sun::MinYear ( void  )
static

Returns the minimum allowed year for sun methods.

◆ North()

virtual double ON_Sun::North ( void  ) const
virtual

Returns The world angle corresponding to North in degrees. This angle is zero along the x-axis and increases anticlockwise.

◆ OnInternalXmlChanged()

virtual void ON_Sun::OnInternalXmlChanged ( const ON_Sun )
virtual

For internal use only.

◆ operator!=()

virtual bool ON_Sun::operator!= ( const ON_Sun sun) const
virtual

◆ operator=()

virtual const ON_Sun& ON_Sun::operator= ( const ON_Sun sun)
virtual

◆ operator==()

virtual bool ON_Sun::operator== ( const ON_Sun sun) const
virtual

◆ ReadFromArchive()

virtual bool ON_Sun::ReadFromArchive ( ON_BinaryArchive archive)
virtual

Read the sun properties from an archive that was created by WriteToArchive().

◆ SaveToXMLNode()

virtual void ON_Sun::SaveToXMLNode ( ON_XMLNode node) const
virtual

Save the sun properties to a 'sun' XML node.

◆ SetAccuracy()

virtual void ON_Sun::SetAccuracy ( ON_SunEngine::Accuracy  acc)
virtual

Set the accuracy of the sun calculations. The default is minimum accuracy (for more speed).

◆ SetAltitude()

virtual void ON_Sun::SetAltitude ( double  altitude)
virtual

Set the sun's altitude when manual control is in effect. Param altitude is the sun's altitude in degrees in the range -90 to +90.

◆ SetAzimuth()

virtual void ON_Sun::SetAzimuth ( double  azimuth)
virtual

Set the azimuth of the sun when manual control is in effect. Param azimuth is the sun's azimuth in degrees. The value increases Eastwards with North as zero. Note: This value is not affected by the direction of north.

◆ SetAzimuthAndAltitudeFromVector()

virtual void ON_Sun::SetAzimuthAndAltitudeFromVector ( const ON_3dVector v)
virtual

Calculates and sets the sun's azimuth and altitude taking into account the direction of north.

◆ SetDaylightSavingMinutes()

virtual void ON_Sun::SetDaylightSavingMinutes ( int  minutes)
virtual

Set the daylight saving of the observer in minutes, in the range 0 to 120.

◆ SetDaylightSavingOn()

virtual void ON_Sun::SetDaylightSavingOn ( bool  on)
virtual

Set whether or not the observer is using daylight saving time.

◆ SetEnableAllowed()

virtual void ON_Sun::SetEnableAllowed ( bool  allowed)
virtual

Set whether or not enabling/disabling the sun is allowed.

◆ SetEnableOn()

virtual void ON_Sun::SetEnableOn ( bool  on)
virtual

Set whether or not the sun is enabled.

◆ SetIntensity()

virtual void ON_Sun::SetIntensity ( double  intensity)
virtual

Set the intensity to be used for the sun. This is 1.0 by default.

◆ SetLatitude()

virtual void ON_Sun::SetLatitude ( double  latitude)
virtual

Set the latitude of the observer. Param latitude is the observer's latitude in degrees in the range -90 to +90.

◆ SetLocalDateTime()

virtual bool ON_Sun::SetLocalDateTime ( int  year,
int  month,
int  day,
double  hours 
)
virtual

Set the local date and time of the observer. Param year is the year which must lie between MinYear() to MaxYear() inclusive. Param month is the month in the range 1 to 12. Param day is the day in the range 1 to 31. Param hours is the time expressed as decimal hours in the range 0 to 24. Returns true if successful, false if the date is out of range.

◆ SetLongitude()

virtual void ON_Sun::SetLongitude ( double  longitude)
virtual

Set the longitude of the observer. Param longitude is the observer's longitude in degrees in the range -180 to +180.

◆ SetManualControlAllowed()

virtual void ON_Sun::SetManualControlAllowed ( bool  allowed)
virtual

Set whether or not manual control of the sun position is allowed.

◆ SetManualControlOn()

virtual void ON_Sun::SetManualControlOn ( bool  manual)
virtual

Set whether or not manual control of the sun position is in effect.

◆ SetNorth()

virtual void ON_Sun::SetNorth ( double  north)
virtual

Set the azimuth corresponding to North. north is the world angle corresponding to North in degrees in the range 0 to 360. This angle is zero along the x-axis and increases anticlockwise.

◆ SetShadowIntensity()

virtual void ON_Sun::SetShadowIntensity ( double  intensity)
virtual

This is currently unused.

◆ SetTimeZone()

virtual void ON_Sun::SetTimeZone ( double  hours)
virtual

Set the time zone of the observer in hours, in the range -12 to +13.

◆ SetUTCDateTime()

virtual bool ON_Sun::SetUTCDateTime ( int  year,
int  month,
int  day,
double  hours 
)
virtual

Set the date and time of the observer expressed in Coordinated Universal Time. This is the same as the local date and time adjusted for the observer's time zone and daylight saving. Param year is the year which must lie between MinYear() to MaxYear() inclusive. Param month is the month in the range 1 to 12. Param day is the day in the range 1 to 31. Param hours is the time expressed as decimal hours in the range 0 to 24. Returns true if successful, false if the date is out of range.

◆ ShadowIntensity()

virtual double ON_Sun::ShadowIntensity ( void  ) const
virtual

This is currently unused.

◆ SunColorFromAltitude()

static ON_4fColor ON_Sun::SunColorFromAltitude ( double  altitude)
static

Get a color for rendering a sun light when the sun is at a particular altitude in the sky.

◆ TimeZone()

virtual double ON_Sun::TimeZone ( void  ) const
virtual

Returns the time zone of the observer in decimal hours.

◆ UTCDateTime()

virtual void ON_Sun::UTCDateTime ( int &  year,
int &  month,
int &  day,
double &  hours 
) const
virtual

Retrieves the date and time of the observer expressed in Coordinated Universal Time. This is the same as the local date and time adjusted for the observer's time zone and daylight saving. Param year accepts the year in the range MinYear() to MaxYear(). Param month accepts the month in the range 1 to 12. Param day accepts the day in the range 1 to 31. Param hours accepts the time expressed as decimal hours in the range 0 to 24. Returns The UTC date and time of the observer.

◆ WriteToArchive()

virtual bool ON_Sun::WriteToArchive ( ON_BinaryArchive archive) const
virtual

Write the sun properties to an archive.

Friends And Related Function Documentation

◆ ON_3dmRenderSettingsPrivate

friend class ON_3dmRenderSettingsPrivate
friend

< For internal use only.

◆ ONX_Model

friend class ONX_Model
friend