new SkyDome( [config])
A class for segmenting the sky dome and using it for calculations.
This class divides the sky dome into a series of segments or 'patches' and then stores a range of calculated shading and others values, as well as luminance/radiance distributions over each sky patch.
Parameters:
| Name | Type | Argument | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object |
<optional> |
An optional configuration object. |
||||||||
Properties of
|
|||||||||||
| Name | Type | Argument | Description |
|---|---|---|---|
useColors |
boolean |
<optional> |
Whether or not to store colours for each sky patch. |
Classes
Members
-
:number
g_subdivisionCount <inner>
-
Stores the number of discreet subdivision patches in the current sky.
Type
- number
Methods
-
calculateMetrics()
-
Calculates shading and sky factor values.
Returns:
Returns an object containing statistical obstruction data.
- Type
- object
-
callbackOnScaleChange( [callback])
-
Gets/sets the function called when the sky luminance distribution scale changes.
Parameters:
Name Type Argument Description callbackfunction <optional>
An optional callback function.
Returns:
Returns the current callback or, if a value is given, returns this shading object to support method chaining.
- Type
- function | object
-
cancelCumulativeSky()
-
Cancels the current cumulative sky calculation, if in progress.
-
clearColors()
-
Clear all segment color data and release memory.
Returns:
Returns this sky dome instance to support method chaining.
- Type
- PD.SkyDome
-
clearShadingData()
-
Resets all shading data in the internal array to zero.
Returns:
Returns this sky dome instance to support method chaining.
- Type
- PD.SkyDome
-
copyShadingData( [result])
-
Copy the shading data array.
Parameters:
Name Type Argument Description resultArray.<number> <optional>
An optional array to receive the shading data.
Returns:
An array of shading data, one value per sky segment.
- Type
- Array.<number>
-
copySkyPatchesToCanvas(canvas, projection [, shading])
-
Renders sky patch luminances and shading to the canvas.
Parameters:
Name Type Argument Description canvasCanvasElement The canvas element to render in.
projectionfunction | PD.PROJECTION A function for projecting altitude angles to radius, or a projection enumerator value.
shadingArray.<number> <optional>
An optional array containing shading data for each sun patch, defaults to internal shading.
Returns:
Returns true if sky was rendered to canvas.
- Type
- boolean
-
copyToCanvas(canvas, projection [, shading])
-
Renders sky patch luminances and shading to the canvas.
Parameters:
Name Type Argument Description canvasCanvasElement The canvas element to render in.
projectionfunction | PD.PROJECTION A function for projecting altitude angles to radius, or a projection enumerator value.
shadingArray.<number> <optional>
An optional array containing shading data for each sun patch, defaults to internal shading.
Returns:
Returns true if sky was rendered to canvas.
- Type
- boolean
-
copyToPolyMesh(mesh, center, radius [, outlines])
-
Copies the sky dome geometry to a mesh in model coordinates/units.
This method is used when adding a sky dome to a mesh that contains other geometry or more than one sky dome. It positions the sky dome hemisphere geometry at the given center and with the given radius. If you want to use a separate mesh per sky dome and independently position and size them, you should use the
copyToTransformedPolyMesh()method instead.Parameters:
Name Type Argument Description meshPD.PolyMesh The mesh to update.
centerPD.Utils.VectorObject The position of the sky dome in model coordinates.
radiusnumber The radius of the sky dome in model units.
outlinesboolean <optional>
Whether to include sky segment outlines, defaults to false.
Returns:
Returns an object containing statistical obstruction data.
- Type
- object
-
copyToTransformedPolyMesh(mesh [, outlines])
-
Copies the sky dome geometry to a mesh, centred at the origin and with unit radius.
This method is used when the mesh contains only this sky dome geometry and the host will scale and position it appropriately within the model. If you need to specify an absolute position, or add more than one sky dome to it, then you should use the
copyToPolyMesh()method instead.Parameters:
Name Type Argument Description meshPD.PolyMesh The mesh to update.
outlinesboolean <optional>
Whether to include sky segment outlines, defaults to false.
Returns:
Returns an object containing statistical obstruction data.
- Type
- object
-
copyToTransformedPolyMesh2D(mesh [, outlines])
-
Copies the sky dome geometry to a mesh as a flat diagram, centred at the origin and with unit radius.
This method is used when the mesh contains only this sky dome geometry and the host will scale and position it appropriately within the model. If you need to specify an absolute position, or add more than one sky dome to it, then you should use the
copyToPolyMesh()method instead.Parameters:
Name Type Argument Description meshPD.PolyMesh The mesh to update.
outlinesboolean <optional>
Whether to include sky segment outlines, defaults to false.
Returns:
Returns an object containing statistical obstruction data.
- Type
- object
-
createNewSkyPatchCache(solar, jitter)
-
Creates a new detached cache for storing radiance/illuminance values for fast random-access or sequentially iterating through sky patches based on the current sky distribution.
NOTE: As this is a detached cache, you must manually call the
update()method yourself to update this cache whenever the sky distribution is recalculated.Parameters:
Name Type Description solarPD.SolarPosition The solar position calculation object.
jitterboolean Whether or not to pseudo-randomly slightly perturb the patch center.
Returns:
Returns the horizontal illuminance cache object.
- Type
- object
-
fadeToBlack( [state])
-
Gets/sets whether or not to fade zero values to black or the minimum colour scale.
Parameters:
Name Type Argument Description stateboolean <optional>
An optional boolean used to set the state of this value.
Returns:
Returns whether or not zero values are shown black or, if a value is given, this shading object to support method chaining.
- Type
- object
-
fitDistributionScale()
-
Fits the scale used to color the sky luminance distribution scale.
Returns:
Returns this shading object to support method chaining.
- Type
- object
-
generateCumulativeSky(solar, options)
-
Calculates the sky luminance values for the given Sun position.
Parameters:
Name Type Description solarPD.SolarPosition The solar position calculation object.
optionsobject A configuration object with the following properties.
Properties of
options:Name Type Description fromDaynumber The day of the year to start calculating, inclusive (0 to 365/6).
toDaynumber The day of the year to end calculating, inclusive (0 to 365/6).
fromTimenumber The hour of each day to start calculating, in decimal hours (0.0 to 24.0).
toTimenumber The hour of each day to stop calculating, in decimal hours (0.0 to 24.0).
timeStepnumber The fractional hour for each calculation step (0 to 1).
progressfunction An optional callback to display progress.
completefunction An optional callback when complete.
-
getAltitudeBandSegmentsFromDegrees(alt_degrees)
-
Retrieves the number of segments in the corresponding radial band at the given sky altitude.
Parameters:
Name Type Description alt_degreesnumber The altitude angle, in decimal degrees (0 - 90).
Returns:
Returns the number of segments in that band (3 - 72), or zero if altitude outside range.
- Type
- number
-
getAltitudeBandSegmentsFromRadians(alt_radians)
-
Retrieves the number of segments in the corresponding radial band at the given sky altitude.
Parameters:
Name Type Description alt_radiansnumber The altitude angle, in radians (0 - PI/2).
Returns:
Returns the number of segments in that band (3 - 72), or zero if altitude outside range.
- Type
- number
-
getColors()
-
Returns the shading data array.
Returns:
An array of [r,g,b,a] color arrays, one per sky segment.
- Type
- Array.<Array.<number>>
-
getShadingData()
-
Retrieve the shading data array.
Returns:
An array of shading data, one value per sky segment.
- Type
- Array.<number>
-
getShadingMetrics()
-
Retrieves an object containing metrics for the last shading calculation.
This is a simple object containing the following properties.
Property Type Description skyFactorLuminance number Fraction of the available sky luminance distribution not obstructed by shading. skyFactorUniform number Fraction of the visible sky dome not obstructed by shading. Returns:
Returns an object containing statistical obstruction data.
- Type
- object
-
getSkyParams()
-
Retrieves the calculated sky coefficients and distribution data.
This object stores all the information required to generate a Perez or CIE standard general sky distribution, and is passed around between different levels of the calculation functions.
This method returns an object with the following properties.
Property Type Description iterator object The iterator used to calculate sky patch values. sunAngles Array An [azi,alt] array containing the azimuth and altitude of the Sun in the calculated sky. sunVector Vector3 A 3D vector giving the direction towards the r of the Sun. segmentVector Vector3 A 3D vector giving the direction towards the centre of the current sky patch. A, B, C, D, E numbers These are the five (5) Perez Sky Coefficients defining the current sky conditions. totalDiffuseHorizontal number The total of all sky patch values, multiplied by the cosine of the altitude at their center. resultsArray Array The array containing the calculated illuminance/radiance values for each sky patch. maxValue number The highest calculated value of all the current sky patches. exp_d_PI number Caches the value of exp(d * PI/2) to avoid continuous recalculation. skyType number The CIE Std. Gen. Sky type for this sky (1-16, 17:WeatherData). Returns:
Returns the object containing calculated sky parameters.
- Type
- object
-
getSkyPatchCSSColors( [shading])
-
Update and retrieve the current list of CSS colour strings for each sky segment.
Parameters:
Name Type Argument Description shadingArray.<number> <optional>
An optional array containing shading data for each sun patch, defaults to internal shading.
Returns:
Returns an array of
#RRGGBBcolor strings.- Type
- Array.<string>
-
getSkyPatchCache()
-
Returns the internally linked horizontal illuminance cache, if it exists.
NOTE: To create and link this cache, you must have first called the
useSkyPatchCache()method.Returns:
Returns the horizontal illuminance cache object, or null if not yet created.
- Type
- object | null
-
getSkyPatchColor(index)
-
Get the shading colour at the given data segment.
Parameters:
Name Type Description indexnumber The numerical index of the data segment to set.
Returns:
Returns the [r,g,b[,a]] color array.
- Type
- Array.<number>
-
getSkyPatchContribution(index)
-
Get the sky distribution value at the given data segment.
Parameters:
Name Type Description indexnumber The numerical index of the data segment.
Returns:
Returns the sky distribution value at the given segment
- Type
- number
-
getSkyPatchContributionArray()
-
Get the array of sky distribution values for all segments.
Returns:
Returns the array of sky distribution values.
- Type
- Array
-
getSkyPatchCount()
-
Retrieves the number of subdivision patches in the current sky.
Returns:
Returns the number of subdivision patches in the current sky.
- Type
- number
-
getSkyPatchIndexByDegrees(azi_degrees, alt_degrees)
-
Retrieves the index of the sky segment in the shading data array.
Parameters:
Name Type Description azi_degreesnumber The azimuth angle, in decimal degrees (0 - 360).
alt_degreesnumber The altitude angle, in decimal degrees (0 - 90).
Returns:
Returns the shading data array index.
- Type
- number
-
getSkyPatchIndexByRadians(azi_radians, alt_radians)
-
Retrieves the index of the sky segment in the shading data array.
Parameters:
Name Type Description azi_radiansnumber The azimuth angle, in radians (0 - 2*PI).
alt_radiansnumber The altitude angle, in radians (0 - PI/2).
Returns:
Returns the shading data array index.
- Type
- number
-
getSkyPatchShading(index)
-
Get the shading value at the given sky segment.
Parameters:
Name Type Description indexnumber The numerical index of the sky segment to set.
-
hasShadingData()
-
Retrieves whether or not the shading data array is valid for the current sky.
Returns:
Returns true if the array of shading data matches the number of sky segments.
- Type
- boolean
-
isCumulative()
-
Retrieves whether or not the current sky distribution is a cumulative one.
Returns:
Returns true for cumulative, false for instantaneous.
- Type
- boolean
-
isDynamicSky()
-
Returns true if an update is required when Sun position changes.
A false value means that the sky distribution is static regardless of Sun position.
Returns:
Returns true if this sky distribution changes with solar position.
- Type
- boolean
-
isGeneratingCumulativeSky()
-
Determines whether or not a cumulative sky calculation is running.
Returns:
Returns true if a cumulative sky calculation is in progress.
- Type
- boolean
-
lockScale( [lock])
-
Gets/sets whether or not the scale is locked at its current value.
Parameters:
Name Type Argument Description lockboolean <optional>
An optional new lock state.
Returns:
Returns the current lock state or, if a value is given, returns this shading object to support method chaining.
- Type
- boolean | object
-
luminanceColorScaleAsHex(fraction)
-
Calculates a CSS sky colour based on the luminance scale.
Parameters:
Name Type Description fractionnumber The fractional luminance value.
Returns:
Returns a CSS color string.
- Type
- string
-
newSkyPatchIterator()
-
Create a new shading segment iterator.
Returns:
Returns a new shading iterator object.
- Type
- object
-
perezSky( [perez])
-
Gets/sets the Perez sky object.
Parameters:
Name Type Argument Description perezPD.PerezSky <optional>
An optional new Perez sky object to use.
Returns:
Returns the current Perez sky object or, if a value is given, this shading object to support method chaining.
- Type
- PD.PerezSky | object
-
setColors(colors)
-
Copies the colour data to the internal shading colour array.
Parameters:
Name Type Description colorsArray.<Array.<number>> An array of [r,g,b,a] color arrays, one per sky segment.
Returns:
Returns true if the given data array is the same size as the shading color array and the data was copied, otherwise false.
- Type
- boolean
-
setShadingData(data)
-
Copies the shading data to the internal shading value array.
Parameters:
Name Type Description dataArray.<number> An array of shading values, one per sky segment.
Returns:
Returns true if the given data array is the same size as the shading array and the data was copied, otherwise false.
- Type
- boolean
-
setSkyCoefficients(A, B, C, D, E, solar)
-
Sets the 5 Perez sky coefficients and the Sun position.
Parameters:
Name Type Description Anumber The first Perez sky coefficient: Horizon-Zenith Gradient.
Bnumber The second Perez sky coefficient: Gradient Intensity.
Cnumber The third Perez sky coefficient: Circumsolar Intensity.
Dnumber The fourth Perez sky coefficient: Circumsolar Radius.
Enumber The fifth Perez sky coefficient: Backscattering Effect.
solarPD.SolarPosition The solar position calculation object with the current Sun angles.
Returns:
Returns true if distribution changed and update required.
- Type
- boolean
-
setSkyPatchColor(index, color)
-
Set the shading colour at the given data segment.
Parameters:
Name Type Description indexnumber The numerical index of the data segment to set.
colorArray.<number> The [r,g,b[,a]] color array to set.
-
setSkyPatchShading(index, shading)
-
Set the shading value at the given sky segment.
Parameters:
Name Type Description indexnumber The numerical index of the sky segment to set.
shadingnumber The shading value to set (0 to 1).
-
setSkyTypeAndUpdate(skyType, solar [, forceUpdate])
-
Sets the type of CIE Standard General Sky to generate.
This method also recalculates the sky distribution if the sky type or Sun position has changed. If you do not want to automatically update the sky, use the
skyType(type)method.Values for
sky_typehave the following meaning:- 0: Means that no sky distribution is calculated.
- 1 to 15: Mean use the corresponding CIE Standard General Sky types.
- 16: Means using the older pre-2000 CIE Overcast Sky equations.
- 17: Means using the the current weather data and solar position to compute the sky type and Perez sky coefficients.
- 18: Means using Perez sky coefficients were previously set using
setSkyCoefficients().
Parameters:
Name Type Argument Description skyTypenumber The CIE Standard General Sky type (0 to 16).
solarPD.SolarPosition The solar position calculation object.
forceUpdateboolean <optional>
When set to true, the sky will always update.
Returns:
Returns true if distribution changed and update performed.
- Type
- boolean
-
setSubdivision(angle [, type])
-
Sets the angle and type of sky subdivision.
Parameters:
Name Type Argument Description anglenumber The sky segment angle, in decimal degrees (1.2 to 15.0).
typenumber <optional>
An optional sky subdivision method to use (0, 1, 2 or 3).
Returns:
Returns true if changed and update required.
- Type
- boolean
-
showCumulativeSky()
-
Copies any previously calculated cumulative sky to the sky distribution.
Returns:
Returns true if valid cumulative sky data was copies.
- Type
- boolean
-
skyDistributionFalseColor( [state])
-
Gets/sets whether or not to show sky luminance as false colour scale.
Parameters:
Name Type Argument Description stateboolean <optional>
An optional false color scale state.
Returns:
Returns the current false color scale state or, if a value is given, this shading object to support method chaining.
- Type
- boolean | object
-
skyDistributionScale( [scale])
-
Gets/sets the scale used to color the sky luminance distribution.
Parameters:
Name Type Argument Description scalenumber <optional>
An optional luminance ratio scale.
Returns:
Returns the current luminance ratio scale or, if a value is given, returns this shading object to support method chaining.
- Type
- number | object
-
skyType( [sky_type])
-
Gets/sets the CIE Standard General Sky to use for luminance distribution.
If you wish to automatically recalculate the sky distribution if the sky type or Sun position has changed, use the
this.setSkyTypeAndUpdate(type)method.Parameters:
Name Type Argument Description sky_typenumber <optional>
An optional sky type index (0 to 16).
Returns:
Returns the current sky type index or, if a value is given, this shading object to support method chaining.
- Type
- number
-
subdivisionAngle( [angle])
-
Gets/sets the angle sky subdivision.
Parameters:
Name Type Argument Description anglenumber <optional>
An optional sky segment angle to set, in decimal degrees (1.2 to 15.0).
Returns:
Returns the sky segment angle in decimal degrees or, if a value is given, this shading object to support method chaining.
- Type
- number
-
updatePolyMeshColors(mesh, shading)
-
Updates the color buffer of the sky dome geometry to match sky conditions.
This methods pairs with the
copyToTransformedPolyMesh()method in assuming that the mesh contains only the sky dome geometry, as created by that method, and quickly updates just the color buffer. This is because changes to the sky dome geometry are far less frequent than changes to the sky distribution or calculated shading as sky conditions change whenever the date, time, location (and therefore sun position) or sky type change.Parameters:
Name Type Description meshPD.PolyMesh The mesh to update.
shadingArray.<number> A shading mask array containing shading data for each sky segment.
Returns:
Returns an object containing statistical obstruction data.
- Type
- object
-
updateSkyDistribution(solar [, forceUpdate])
-
Calculates the sky luminance values for the given Sun position.
Parameters:
Name Type Argument Description solarPD.SolarPosition The solar position calculation object.
forceUpdateboolean <optional>
Some sky distributions don't change with Sun position. However to generate them in the first place, set this to true.
-
useColors( [state])
-
Gets/sets whether or not to store colours for each sky segment.
Parameters:
Name Type Argument Description stateboolean <optional>
An optional boolean used to set the state of this value.
Returns:
Returns whether or not colors are being used or, if a value is given, this shading object to support method chaining.
- Type
- object
-
useIlluminance()
-
Retrieves whether or not illuminance is being used instead of radiance.
Returns:
Returns true for luminance, false for radiance.
- Type
- number
-
useNearestNeighborForDirectSun(state)
-
Whether or not to apportion direct radiation between the four nearest sky patches.
When set to false, this uses the actual solar disk to determine which sky patches receive what portion of direct solar radiation or luminance.
Parameters:
Name Type Description stateboolean When true, apportions between nearest four, otherwise uses solar disk.
Returns:
Returns this shading object to support method chaining.
- Type
- object
-
useSkyPatchCache(solar, jitter)
-
Embeds a cache for storing radiance/illuminance values for fast random-access or sequentially iterating through sky patches based on the current sky distribution.
This cache is internally linked to this shading instance and is therefore updated automatically whenever the sky distribution is recalculated.
Parameters:
Name Type Description solarPD.SolarPosition The solar position calculation object.
jitterboolean Whether or not to pseudo-randomly slightly perturb the patch center.
Returns:
Returns the horizontal illuminance cache object.
- Type
- object
-
weatherData( [weather])
-
Gets/sets the annual hourly weather data object.
Parameters:
Name Type Argument Description weatherPD.WeatherData <optional>
An optional new weather data set to use.
Returns:
Returns the current weather data object or, if a value is given, this shading object to support method chaining.
- Type
- PD.WeatherData | PD.SkyDome
-
getProjectRadiusFunction(projection) <static>
-
Retrieves the conversion function associated with a projection.
Parameters:
Name Type Description projectionPD.PROJECTION The projection enumerator.
Returns:
Returns the associated function, defaulting to equidistant.
- Type
- function
-
interpolateProjectionFactory(projectFrom, projectTo) <static>
-
A factory function that returns an object containing two functions, one (
set) for updating the transition fraction and the other (convert) for assigning and doing the actual conversion.Parameters:
Name Type Description projectFromPD.PROJECTION The current projection enumerator.
projectToPD.PROJECTION The new projection enumerator to animate to.
Returns:
Returns an object with
set(fraction)andconvert(alt)properties.- Type
- object
-
projectEquidistant(alt) <static>
-
Converts an altitude angle into a linearly projected chart radius.
: , - ~ : ~ - , , ' : ' , , : , , |=|=|=|=|=|=|=| , -+-+-+-+-+-+-+-+- - + - - - - - - x-o-o-o-o-o-o-+ - , : , , : , , : , , : , ' ' - , _ : _ , ' :Parameters:
Name Type Description altnumber The chart altitude in degrees (-90 to 90).
Returns:
Returns a fractional radius (0 to 1).
- Type
- number
-
projectSpherical(alt) <static>
-
Converts an altitude angle into a spherically projected chart radius.
: , - ~ : ~ -., , ' : /| ' , , : / | , , : / | , , :/ a | , - + - - - - - - x - -o- - - - + - , : | , , - + - -+ - , , cos(a) , , : , ' ' - , _ : _ , ' :Parameters:
Name Type Description altnumber The chart altitude in degrees (-90 to 90).
Returns:
Returns a fractional radius (0 to 1).
- Type
- number
-
projectStereographic(alt) <static>
-
Converts an altitude angle into a stereographic projected chart radius.
cos(alt) - + - - - -+ - : : , - ~ + ~ - , : | , ' + - - - .+, - - - + - , : .'/ , | , : .' / , | sin(alt) , : .' / , | - + - - - - - + x'- -o- - - - + - + - , : / , | , : / , | , :a/ , | r = 1 , :/ , | ' - , _ : _ , - ' | : - - - - - - - + - | OPP cos(alt) tan(a) = ----- = -------------- ADJ r + sin(alt) ┌ cos(alt) ┐ a = atan | -------------- | └ r + sin(alt) ┘ tan(a) OPP x->o = -------- = tan(a) = ----- r ADJParameters:
Name Type Description altnumber The chart altitude in degrees (-90 to 90).
Returns:
Returns a fractional radius (0 to 1).
- Type
- number
-
assignDirectSolarByDisk(params, direct_beam, array) <inner>
-
Assigns the given direct solar data to nearest sky segments.
Parameters:
Name Type Description paramsCIESkyParams The current CIE sky parameters.
direct_beamnumber The direct irradiance/illuminance value to assign to sky patches.
arrayArray The array to add the direct value to.
-
assignDirectSolarByQuad(params, direct_beam, array) <inner>
-
Assigns the given direct solar data to nearest sky segments.
Parameters:
Name Type Description paramsCIESkyParams The current CIE sky parameters.
direct_beamnumber The direct irradiance/illuminance value to assign to sky patches.
arrayArray The array to add the direct value to.
-
calculateCircumferenceIncrement(inc) <inner>
-
Used to keep circle line circular at large angle increments.
This is required for the various bands to line up when the number of segments per band changes with altitude.
Parameters:
Name Type Description incnumber The azimuth band increment value.
Returns:
Returns the increment for each band segment.
- Type
- number
-
calculateEqualAngleSky(angle) <inner>
-
Sets the sky subdivision angle and recalculates segmentation.
In this subdivision method, the sky dome is divided by equal altitude and azimuth angles, resulting in the same number of radial segments in each altitude band. This means that sky patches nearer the zenith are much smaller than those at the horizon, but this greatly simplifies the process of contouring the data.
Parameters:
Name Type Description anglenumber The spherical angle to segment the sky, in decimal degrees (1.2 to 15).
-
calculateEqualAreaSky(angle) <inner>
-
Sets the sky subdivision angle and recalculates segmentation.
This subdivision method divides the sky dome into equal altitude bands based on the given angle and then varies the number of radial segments in each band to ensure all sky patches represent a similar solid angle. In this method there is no single sun patch at the zenith, but the altitude is evenly divided.
Parameters:
Name Type Description anglenumber The spherical angle to segment the sky, in decimal degrees (1.2 to 15).
-
calculateRelativeLuminance(zen_angle, sun_angle) <inner>
-
Calculates the relative luminance of a point on the sky dome.
Ref: ISO 15469:2004(E) / CIE S 011/E:2003: Spatial Distribution of Daylight - CIE Standard General Sky
Parameters:
Name Type Description zen_anglenumber Angle between sky patch center and Zenith, in radians.
sun_anglenumber Angle between sky patch center and the Sun, in radians.
Returns:
Returns the ratio of segment luminance to zenith luminance.
- Type
- boolean
-
calculateTregenzaSky(angle) <inner>
-
Sets the sky subdivision angle and recalculates segmentation.
This subdivision method is based on the 145 sky segments proposed by Tregenza which, similar to the equal-area approach, divides the sky dome into equal altitude bands of 12 degrees each and then varies the number of radial segments in each band to ensure all sky patches represent a similar solid angle. The difference is that Tregenza's method uses a single sky patch at the zenith and more detailed sky subdivision is only possible by subdividing each of the original 145 sky segments.
Parameters:
Name Type Description anglenumber The spherical angle to segment the sky, in decimal degrees (1.2 to 15).
-
callbackProcessSkyPatch(iterator, params) <inner>
-
Callback function invoked by sky segment iterator when calculating sky luminance.
Ref: ISO 15469:2004(E) / CIE S 011/E:2003: Spatial Distribution of Daylight - CIE Standard General Sky
NOTE: This callback references the
g_skyParamsproperty, which must be set first by invoking theupdateSkyDistribution()method, and then updates entries in theg_skyDistributionarray.Parameters:
Name Type Description iteratorSkyPatchIterator The SkyPatchIterator object.
paramsCIESkyParams The CIE sky parameters.
-
callbackProcessSkyPatchAndCache(iterator, params) <inner>
-
Callback function invoked by sky segment iterator when calculating sky luminance.
Ref: ISO 15469:2004(E) / CIE S 011/E:2003: Spatial Distribution of Daylight - CIE Standard General Sky
NOTE: This callback references the
g_skyParamsproperty, which must be set first by invoking theupdateSkyDistribution()method, and then updates entries in theg_skyDistributionarray.Parameters:
Name Type Description iteratorSkyPatchIterator The SkyPatchIterator object.
paramsCIESkyParams The CIE sky parameters.
-
fastGetShadingArrayIndex(azi_degrees, alt_degrees) <inner>
-
Calculates the sky segment index from a polar angle.
NOTE: This function requires that both the azimuth and altitude angles be in decimal degrees, and that the azimuth is in the range 0 to 360 and the altitude in the range -90 to 90.
Parameters:
Name Type Description azi_degreesnumber The azimuth angle, in decimal degrees (0 - 360).
alt_degreesnumber The altitude angle, in decimal degrees (0 - 90).
Returns:
Returns the shading data array index.
- Type
- number
-
luminanceColorScaleYellowBlue(fraction, result) <inner>
-
Calculates a sky colour based on the luminance scale.
Parameters:
Name Type Description fractionnumber The fractional luminance value.
resultArray The [r,g,b,a] array to receive the colour values.
Returns:
Returns the
resultsarray.- Type
- Array