new SkyPatchCache(shading, solar, jitter)
Internal class to generate a cached array of illuminance/radiance values for fast random-access or sequentially iterating through sky patches in the current sky.
Parameters:
| Name | Type | Description |
|---|---|---|
shading |
PD.SkyDome | The parent shading object to use. |
solar |
PD.SolarPosition | The solar position calculation object to use. |
jitter |
boolean | Whether or not to pseudo-randomly perturb each patch's center. |
Members
-
:number
diffuseHorizontal
-
The instantaneous direct radiation/illuminance from the Sun.
Type
- number
-
:number
directBeam
-
The instantaneous diffuse horizontal radiation/illuminance from the sky.
Type
- number
-
:SkyPatchIterator
iterator
-
The object used for iterating through sky dome patches.
Type
- SkyPatchIterator
-
:number
patchCount
-
The total number of sky patches in the sky dome.
Type
- number
-
:number
patchTotal
-
The total horizontal illuminance from the entire sky dome.
Type
- number
-
:Array
patches
-
The array of cached sky patch information.
This is a simple object with
vectorandresultproperties.Type
- Array
-
:PD.Utils.VectorObject
sunVector
-
The 3D vector array storing the direction towards the Sun.
Type
- PD.Utils.VectorObject
Methods
-
createFlatArray( [array])
-
Creates a flat array of sky segment data.
The resulting array is a
Float32Arraywith an initial header of 7 entries followed by 7 entries per sky patch. These are described in the table below.| INDEX | DESCRIPTION | |+-----+|-------------| | 0 | Number of sky patches in array. | | 1 | The stored total available. | | 2 | The instantaneous direct radiation/illuminance from the Sun. | | 3 | The instantaneous diffuse horizontal radiation/illuminance from the sky. | | 4 | X-axis component of vector to Sun. | | 5 | Y-axis component of vector to Sun. | | 6 | Z-axis component of vector to Sun. | |+-----+|-------------| | #0 | X-axis component of vector to patch center. | | #1 | Y-axis component of vector to patch center. | | #2 | Z-axis component of vector to patch center. | | #3 | Azimuth of patch center, in degrees. | | #4 | Altitude of patch center, in degrees. | | #5 | The cosine of the sky zenith angle. | | #6 | Unadjusted contribution of patch. |
NOTE: This method returns raw sky patch contributions which are suitable for spherical integration. To calculate surface incidence, you must multiply each segment value by the cosine of the incidence angle. For incidence on a horizontal surface, the cosine of the zenith angle is already calculated and provided in the array, so simply multiply by the 5th entry of each patch.
Parameters:
Name Type Argument Description arrayArray <optional>
An optional array to reuse if the same size.
Returns:
Returns a flat array of sky segment data.
- Type
- Array
-
initialise()
-
Resets and initialises the iterative calculation.
You must call this before iterating over values.
-
jitter( [state])
-
Get/set whether or not to pseudo-randomly perturb each patch's center.
Parameters:
Name Type Argument Description stateboolean <optional>
An optional new state for pseudo-randomly perturbing each patch's center.
Returns:
Returns whether or not each each patch's center is pseudo-randomly perturbed.
- Type
- boolean
-
perezSky()
-
Retrieve the
PD.PerezSkyobject used to generate sky distributions.Returns:
Returns the Perez Sky object used to generate sky distributions.
- Type
- PD.PerezSky
-
shading( [new_shading])
-
Get/set the shading object to use.
Parameters:
Name Type Argument Description new_shadingPD.SkyDome <optional>
An optional new shading object to use.
Returns:
Returns the shading object being used.
- Type
- PD.SkyDome
-
solar( [new_solar])
-
Get/set the solar position calculation object to use.
Parameters:
Name Type Argument Description new_solarPD.SolarPosition <optional>
An optional new solar position calculation object to use.
Returns:
Returns the solar position calculation object being used.
- Type
- PD.SolarPosition
-
update()
-
Updates the cache with sky patch data.
NOTE: This method returns raw sky patch contributions which are suitable for spherical integration. To calculate surface incidence, you must multiple each segment value by the cosine of the incidence angle. For incidence on a horizontal surface, the cosine of the zenith angle is already calculated and provided in the array, so simply multiply by
iterator.cosZen.