honeybee-radiance 1.66.190__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of honeybee-radiance might be problematic. Click here for more details.
- honeybee_radiance/__init__.py +11 -0
- honeybee_radiance/__main__.py +4 -0
- honeybee_radiance/_extend_honeybee.py +93 -0
- honeybee_radiance/cli/__init__.py +88 -0
- honeybee_radiance/cli/dc.py +400 -0
- honeybee_radiance/cli/edit.py +529 -0
- honeybee_radiance/cli/glare.py +118 -0
- honeybee_radiance/cli/grid.py +859 -0
- honeybee_radiance/cli/lib.py +458 -0
- honeybee_radiance/cli/modifier.py +133 -0
- honeybee_radiance/cli/mtx.py +226 -0
- honeybee_radiance/cli/multiphase.py +1034 -0
- honeybee_radiance/cli/octree.py +640 -0
- honeybee_radiance/cli/postprocess.py +1186 -0
- honeybee_radiance/cli/raytrace.py +219 -0
- honeybee_radiance/cli/rpict.py +125 -0
- honeybee_radiance/cli/schedule.py +56 -0
- honeybee_radiance/cli/setconfig.py +63 -0
- honeybee_radiance/cli/sky.py +545 -0
- honeybee_radiance/cli/study.py +66 -0
- honeybee_radiance/cli/sunpath.py +331 -0
- honeybee_radiance/cli/threephase.py +255 -0
- honeybee_radiance/cli/translate.py +400 -0
- honeybee_radiance/cli/util.py +121 -0
- honeybee_radiance/cli/view.py +261 -0
- honeybee_radiance/cli/viewfactor.py +347 -0
- honeybee_radiance/config.json +6 -0
- honeybee_radiance/config.py +427 -0
- honeybee_radiance/dictutil.py +50 -0
- honeybee_radiance/dynamic/__init__.py +5 -0
- honeybee_radiance/dynamic/group.py +479 -0
- honeybee_radiance/dynamic/multiphase.py +557 -0
- honeybee_radiance/dynamic/state.py +718 -0
- honeybee_radiance/dynamic/stategeo.py +352 -0
- honeybee_radiance/geometry/__init__.py +13 -0
- honeybee_radiance/geometry/bubble.py +42 -0
- honeybee_radiance/geometry/cone.py +215 -0
- honeybee_radiance/geometry/cup.py +54 -0
- honeybee_radiance/geometry/cylinder.py +197 -0
- honeybee_radiance/geometry/geometrybase.py +37 -0
- honeybee_radiance/geometry/instance.py +40 -0
- honeybee_radiance/geometry/mesh.py +38 -0
- honeybee_radiance/geometry/polygon.py +174 -0
- honeybee_radiance/geometry/ring.py +214 -0
- honeybee_radiance/geometry/source.py +182 -0
- honeybee_radiance/geometry/sphere.py +178 -0
- honeybee_radiance/geometry/tube.py +46 -0
- honeybee_radiance/lib/__init__.py +1 -0
- honeybee_radiance/lib/_loadmodifiers.py +72 -0
- honeybee_radiance/lib/_loadmodifiersets.py +69 -0
- honeybee_radiance/lib/modifiers.py +58 -0
- honeybee_radiance/lib/modifiersets.py +63 -0
- honeybee_radiance/lightpath.py +204 -0
- honeybee_radiance/lightsource/__init__.py +1 -0
- honeybee_radiance/lightsource/_gendaylit.py +479 -0
- honeybee_radiance/lightsource/dictutil.py +49 -0
- honeybee_radiance/lightsource/ground.py +160 -0
- honeybee_radiance/lightsource/sky/__init__.py +7 -0
- honeybee_radiance/lightsource/sky/_skybase.py +177 -0
- honeybee_radiance/lightsource/sky/certainirradiance.py +232 -0
- honeybee_radiance/lightsource/sky/cie.py +378 -0
- honeybee_radiance/lightsource/sky/climatebased.py +501 -0
- honeybee_radiance/lightsource/sky/hemisphere.py +160 -0
- honeybee_radiance/lightsource/sky/skydome.py +113 -0
- honeybee_radiance/lightsource/sky/skymatrix.py +163 -0
- honeybee_radiance/lightsource/sky/strutil.py +34 -0
- honeybee_radiance/lightsource/sky/sunmatrix.py +212 -0
- honeybee_radiance/lightsource/sunpath.py +247 -0
- honeybee_radiance/modifier/__init__.py +3 -0
- honeybee_radiance/modifier/material/__init__.py +30 -0
- honeybee_radiance/modifier/material/absdf.py +477 -0
- honeybee_radiance/modifier/material/antimatter.py +54 -0
- honeybee_radiance/modifier/material/ashik2.py +51 -0
- honeybee_radiance/modifier/material/brtdfunc.py +81 -0
- honeybee_radiance/modifier/material/bsdf.py +292 -0
- honeybee_radiance/modifier/material/dielectric.py +53 -0
- honeybee_radiance/modifier/material/glass.py +431 -0
- honeybee_radiance/modifier/material/glow.py +246 -0
- honeybee_radiance/modifier/material/illum.py +51 -0
- honeybee_radiance/modifier/material/interface.py +49 -0
- honeybee_radiance/modifier/material/light.py +206 -0
- honeybee_radiance/modifier/material/materialbase.py +36 -0
- honeybee_radiance/modifier/material/metal.py +167 -0
- honeybee_radiance/modifier/material/metal2.py +41 -0
- honeybee_radiance/modifier/material/metdata.py +41 -0
- honeybee_radiance/modifier/material/metfunc.py +41 -0
- honeybee_radiance/modifier/material/mirror.py +340 -0
- honeybee_radiance/modifier/material/mist.py +86 -0
- honeybee_radiance/modifier/material/plasdata.py +58 -0
- honeybee_radiance/modifier/material/plasfunc.py +59 -0
- honeybee_radiance/modifier/material/plastic.py +354 -0
- honeybee_radiance/modifier/material/plastic2.py +58 -0
- honeybee_radiance/modifier/material/prism1.py +57 -0
- honeybee_radiance/modifier/material/prism2.py +48 -0
- honeybee_radiance/modifier/material/spotlight.py +50 -0
- honeybee_radiance/modifier/material/trans.py +518 -0
- honeybee_radiance/modifier/material/trans2.py +49 -0
- honeybee_radiance/modifier/material/transdata.py +50 -0
- honeybee_radiance/modifier/material/transfunc.py +53 -0
- honeybee_radiance/modifier/mixture/__init__.py +6 -0
- honeybee_radiance/modifier/mixture/mixdata.py +49 -0
- honeybee_radiance/modifier/mixture/mixfunc.py +54 -0
- honeybee_radiance/modifier/mixture/mixpict.py +52 -0
- honeybee_radiance/modifier/mixture/mixtext.py +66 -0
- honeybee_radiance/modifier/mixture/mixturebase.py +28 -0
- honeybee_radiance/modifier/modifierbase.py +40 -0
- honeybee_radiance/modifier/pattern/__init__.py +9 -0
- honeybee_radiance/modifier/pattern/brightdata.py +49 -0
- honeybee_radiance/modifier/pattern/brightfunc.py +47 -0
- honeybee_radiance/modifier/pattern/brighttext.py +81 -0
- honeybee_radiance/modifier/pattern/colordata.py +56 -0
- honeybee_radiance/modifier/pattern/colorfunc.py +47 -0
- honeybee_radiance/modifier/pattern/colorpict.py +54 -0
- honeybee_radiance/modifier/pattern/colortext.py +73 -0
- honeybee_radiance/modifier/pattern/patternbase.py +34 -0
- honeybee_radiance/modifier/texture/__init__.py +4 -0
- honeybee_radiance/modifier/texture/texdata.py +29 -0
- honeybee_radiance/modifier/texture/texfunc.py +26 -0
- honeybee_radiance/modifier/texture/texturebase.py +27 -0
- honeybee_radiance/modifierset.py +1091 -0
- honeybee_radiance/mutil.py +60 -0
- honeybee_radiance/postprocess/__init__.py +1 -0
- honeybee_radiance/postprocess/annual.py +108 -0
- honeybee_radiance/postprocess/annualdaylight.py +425 -0
- honeybee_radiance/postprocess/annualglare.py +201 -0
- honeybee_radiance/postprocess/annualirradiance.py +187 -0
- honeybee_radiance/postprocess/electriclight.py +119 -0
- honeybee_radiance/postprocess/en17037.py +261 -0
- honeybee_radiance/postprocess/leed.py +304 -0
- honeybee_radiance/postprocess/solartracking.py +90 -0
- honeybee_radiance/primitive.py +554 -0
- honeybee_radiance/properties/__init__.py +1 -0
- honeybee_radiance/properties/_base.py +390 -0
- honeybee_radiance/properties/aperture.py +197 -0
- honeybee_radiance/properties/door.py +198 -0
- honeybee_radiance/properties/face.py +123 -0
- honeybee_radiance/properties/model.py +1291 -0
- honeybee_radiance/properties/room.py +490 -0
- honeybee_radiance/properties/shade.py +186 -0
- honeybee_radiance/properties/shademesh.py +116 -0
- honeybee_radiance/putil.py +44 -0
- honeybee_radiance/reader.py +214 -0
- honeybee_radiance/sensor.py +166 -0
- honeybee_radiance/sensorgrid.py +1008 -0
- honeybee_radiance/view.py +1101 -0
- honeybee_radiance/writer.py +951 -0
- honeybee_radiance-1.66.190.dist-info/METADATA +89 -0
- honeybee_radiance-1.66.190.dist-info/RECORD +152 -0
- honeybee_radiance-1.66.190.dist-info/WHEEL +5 -0
- honeybee_radiance-1.66.190.dist-info/entry_points.txt +2 -0
- honeybee_radiance-1.66.190.dist-info/licenses/LICENSE +661 -0
- honeybee_radiance-1.66.190.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
"""Radiance Mirror Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Mirror
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import division
|
|
6
|
+
from .materialbase import Material
|
|
7
|
+
import honeybee.typing as typing
|
|
8
|
+
from ...primitive import Void
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
VOID = Void()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Mirror(Material):
|
|
15
|
+
"""Radiance mirror material.
|
|
16
|
+
|
|
17
|
+
Mirror is used for planar surfaces that produce virtual source reflections. This
|
|
18
|
+
material should be used sparingly, as it may cause the light source calculation to
|
|
19
|
+
blow up if it is applied to many small surfaces. This material is only supported for
|
|
20
|
+
flat surfaces such as polygons and rings. The arguments are simply the
|
|
21
|
+
RGB reflectance values, which should be between 0 and 1.
|
|
22
|
+
|
|
23
|
+
An optional string argument may be used (like the illum type) to specify a different
|
|
24
|
+
material to be used for shading non-source rays. If this alternate material is given
|
|
25
|
+
as "void", then the mirror surface will be invisible. Using "void" is only
|
|
26
|
+
appropriate if the surface hides other (more detailed) geometry with the same
|
|
27
|
+
overall reflectance.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
31
|
+
or special characters. This will be used to identify the object across
|
|
32
|
+
a model and in the exported Radiance files.
|
|
33
|
+
r_reflectance: Reflectance for red. The value should be between 0 and 1
|
|
34
|
+
(Default: 1).
|
|
35
|
+
g_reflectance: Reflectance for green. The value should be between 0 and 1
|
|
36
|
+
(Default: 1).
|
|
37
|
+
b_reflectance: Reflectance for blue. The value should be between 0 and 1
|
|
38
|
+
(Default: 1).
|
|
39
|
+
modifier: Material modifier (Default: None).
|
|
40
|
+
alternate_material: An optional material (like the illum type) used to
|
|
41
|
+
specify a different material to be used for shading non-source rays.
|
|
42
|
+
If None, this will keep the alternat_material as mirror. If this alternate
|
|
43
|
+
material is given as "void", then the mirror surface will be invisible.
|
|
44
|
+
Using "void" is only appropriate if the surface hides other (more
|
|
45
|
+
detailed) geometry with the same overall reflectance (Default: None).
|
|
46
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
47
|
+
argument is only useful for defining advanced primitives where the
|
|
48
|
+
primitive is defined based on other primitives (Default: []).
|
|
49
|
+
|
|
50
|
+
Properties:
|
|
51
|
+
* identifier
|
|
52
|
+
* display_name
|
|
53
|
+
* r_reflectance
|
|
54
|
+
* g_reflectance
|
|
55
|
+
* b_reflectance
|
|
56
|
+
* average_reflectance
|
|
57
|
+
* values
|
|
58
|
+
* modifier
|
|
59
|
+
* alternate_material
|
|
60
|
+
* dependencies
|
|
61
|
+
* is_modifier
|
|
62
|
+
* is_material
|
|
63
|
+
|
|
64
|
+
Usage:
|
|
65
|
+
|
|
66
|
+
.. code-block:: python
|
|
67
|
+
|
|
68
|
+
mirror_material = Mirror("mirror_material", 0.95, .95, .95)
|
|
69
|
+
print(mirror_material)
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
__slots__ = ('_r_reflectance', '_g_reflectance', '_b_reflectance',
|
|
73
|
+
'_alternate_material',)
|
|
74
|
+
|
|
75
|
+
def __init__(
|
|
76
|
+
self, identifier, r_reflectance=1.0, g_reflectance=1.0, b_reflectance=1.0,
|
|
77
|
+
modifier=None, alternate_material=None, dependencies=None):
|
|
78
|
+
"""Create mirror material."""
|
|
79
|
+
# add alternate material as a dependency if provided
|
|
80
|
+
self._alternate_material = None # placeholder for alternate material
|
|
81
|
+
Material.__init__(self, identifier, modifier=modifier, dependencies=dependencies)
|
|
82
|
+
self.r_reflectance = r_reflectance
|
|
83
|
+
self.g_reflectance = g_reflectance
|
|
84
|
+
self.b_reflectance = b_reflectance
|
|
85
|
+
self.alternate_material = alternate_material
|
|
86
|
+
self._update_values()
|
|
87
|
+
|
|
88
|
+
def _update_values(self):
|
|
89
|
+
"update value dictionaries."
|
|
90
|
+
if self.alternate_material is not None:
|
|
91
|
+
self._values[0] = [self.alternate_material.identifier]
|
|
92
|
+
self._values[2] = [
|
|
93
|
+
self.r_reflectance, self.g_reflectance, self.b_reflectance,
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def r_reflectance(self):
|
|
98
|
+
"""Get or set the reflectance for red channel.
|
|
99
|
+
|
|
100
|
+
The value should be between 0 and 1 (Default: 0).
|
|
101
|
+
"""
|
|
102
|
+
return self._r_reflectance
|
|
103
|
+
|
|
104
|
+
@r_reflectance.setter
|
|
105
|
+
def r_reflectance(self, reflectance):
|
|
106
|
+
self._r_reflectance = \
|
|
107
|
+
typing.float_in_range(reflectance, 0, 1, 'red reflectance')
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def g_reflectance(self):
|
|
111
|
+
"""Get or set the reflectance for green channel.
|
|
112
|
+
|
|
113
|
+
The value should be between 0 and 1 (Default: 0).
|
|
114
|
+
"""
|
|
115
|
+
return self._g_reflectance
|
|
116
|
+
|
|
117
|
+
@g_reflectance.setter
|
|
118
|
+
def g_reflectance(self, reflectance):
|
|
119
|
+
self._g_reflectance = \
|
|
120
|
+
typing.float_in_range(reflectance, 0, 1, 'green reflectance')
|
|
121
|
+
|
|
122
|
+
@property
|
|
123
|
+
def b_reflectance(self):
|
|
124
|
+
"""Get or set the reflectance for blue channel.
|
|
125
|
+
|
|
126
|
+
The value should be between 0 and 1 (Default: 0).
|
|
127
|
+
"""
|
|
128
|
+
return self._b_reflectance
|
|
129
|
+
|
|
130
|
+
@b_reflectance.setter
|
|
131
|
+
def b_reflectance(self, reflectance):
|
|
132
|
+
self._b_reflectance = \
|
|
133
|
+
typing.float_in_range(reflectance, 0, 1, 'blue reflectance')
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
def alternate_material(self):
|
|
137
|
+
"""Get or set an optional material for shading non-source rays.
|
|
138
|
+
|
|
139
|
+
If None, this will keep the alternat_material as mirror. If this alternate
|
|
140
|
+
material is given as "void", then the mirror surface will be invisible.
|
|
141
|
+
Using "void" is only appropriate if the surface hides other (more
|
|
142
|
+
detailed) geometry with the same overall reflectance.
|
|
143
|
+
"""
|
|
144
|
+
return self._alternate_material
|
|
145
|
+
|
|
146
|
+
@alternate_material.setter
|
|
147
|
+
def alternate_material(self, material):
|
|
148
|
+
if material is not None:
|
|
149
|
+
assert isinstance(material, (Material, Void)), \
|
|
150
|
+
'alternate material must be from type Material not {}'.format(
|
|
151
|
+
type(material))
|
|
152
|
+
|
|
153
|
+
self._alternate_material = material
|
|
154
|
+
|
|
155
|
+
@property
|
|
156
|
+
def dependencies(self):
|
|
157
|
+
"""Get list of dependencies for this primitive.
|
|
158
|
+
|
|
159
|
+
Additional dependencies can be added with the add_dependent method.
|
|
160
|
+
"""
|
|
161
|
+
return self._dependencies if not self.alternate_material \
|
|
162
|
+
else self._dependencies + [self.alternate_material]
|
|
163
|
+
|
|
164
|
+
@classmethod
|
|
165
|
+
def from_single_reflectance(
|
|
166
|
+
cls, identifier, rgb_reflectance=0.0, modifier=None, alternate_material=None,
|
|
167
|
+
dependencies=None):
|
|
168
|
+
"""Create mirror material with single reflectance value.
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
172
|
+
or special characters. This will be used to identify the object across
|
|
173
|
+
a model and in the exported Radiance files.
|
|
174
|
+
rgb_reflectance: Reflectance for red, green and blue. The value should be
|
|
175
|
+
between 0 and 1 (Default: 0).
|
|
176
|
+
modifier: Material modifier (Default: None).
|
|
177
|
+
alternate_material: An optional material may be used like the illum type to
|
|
178
|
+
specify a different material to be used for shading non-source rays.
|
|
179
|
+
If None, this will keep the alternat_material as mirror. If this alternate
|
|
180
|
+
material is given as "void", then the mirror surface will be invisible.
|
|
181
|
+
Using "void" is only appropriate if the surface hides other (more
|
|
182
|
+
detailed) geometry with the same overall reflectance (Default: None).
|
|
183
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
184
|
+
argument is only useful for defining advanced primitives where the
|
|
185
|
+
primitive is defined based on other primitives. (Default: [])
|
|
186
|
+
|
|
187
|
+
Usage:
|
|
188
|
+
|
|
189
|
+
.. code-block:: python
|
|
190
|
+
|
|
191
|
+
wall_material = Mirror.by_single_reflect_value("mirror", 1.0)
|
|
192
|
+
"""
|
|
193
|
+
return cls(
|
|
194
|
+
identifier, rgb_reflectance, rgb_reflectance, rgb_reflectance,
|
|
195
|
+
modifier, alternate_material, dependencies
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
@classmethod
|
|
199
|
+
def from_primitive_dict(cls, primitive_dict):
|
|
200
|
+
"""Initialize mirror from a primitive dict.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
data: A dictionary in the format below.
|
|
204
|
+
|
|
205
|
+
.. code-block:: python
|
|
206
|
+
|
|
207
|
+
{
|
|
208
|
+
"modifier": {}, # primitive modifier (Default: None)
|
|
209
|
+
"type": "mirror", # primitive type
|
|
210
|
+
"identifier": "", # primitive identifier
|
|
211
|
+
"display_name": "", # primitive display name
|
|
212
|
+
"values": [], # values
|
|
213
|
+
"dependencies": []
|
|
214
|
+
}
|
|
215
|
+
"""
|
|
216
|
+
cls._dict_type_check(cls.__name__, primitive_dict)
|
|
217
|
+
modifier, dependencies = cls.filter_dict_input(primitive_dict)
|
|
218
|
+
if len(primitive_dict['values'][0]) == 1:
|
|
219
|
+
# find name
|
|
220
|
+
alt_id = primitive_dict['values'][0][0]
|
|
221
|
+
if alt_id == 'void':
|
|
222
|
+
alternate_material = VOID
|
|
223
|
+
elif isinstance(alt_id, dict):
|
|
224
|
+
try: # see if the mutil module has already been imported
|
|
225
|
+
mutil
|
|
226
|
+
except NameError:
|
|
227
|
+
# import the module here to avoid a circular import
|
|
228
|
+
import honeybee_radiance.mutil as mutil
|
|
229
|
+
alternate_material = mutil.dict_to_modifier(alt_id)
|
|
230
|
+
else:
|
|
231
|
+
alt_mats = [d for d in dependencies if d.identifier == alt_id]
|
|
232
|
+
|
|
233
|
+
assert len(alt_mats) == 1, \
|
|
234
|
+
'Failed to find alternate material for mirror: "{}" in ' \
|
|
235
|
+
'dependencies.'.format(alt_id)
|
|
236
|
+
|
|
237
|
+
# remove it from dependencies
|
|
238
|
+
alternate_material = alt_mats[0]
|
|
239
|
+
dependencies.remove(alternate_material)
|
|
240
|
+
else:
|
|
241
|
+
alternate_material = None
|
|
242
|
+
|
|
243
|
+
values = primitive_dict['values'][2]
|
|
244
|
+
cls_ = cls(
|
|
245
|
+
identifier=primitive_dict["identifier"],
|
|
246
|
+
r_reflectance=values[0],
|
|
247
|
+
g_reflectance=values[1],
|
|
248
|
+
b_reflectance=values[2],
|
|
249
|
+
modifier=modifier,
|
|
250
|
+
alternate_material=alternate_material,
|
|
251
|
+
dependencies=dependencies
|
|
252
|
+
)
|
|
253
|
+
if 'display_name' in primitive_dict \
|
|
254
|
+
and primitive_dict['display_name'] is not None:
|
|
255
|
+
cls_.display_name = primitive_dict['display_name']
|
|
256
|
+
|
|
257
|
+
# this might look redundant but it is NOT. see glass for explanation.
|
|
258
|
+
cls_.values = primitive_dict['values']
|
|
259
|
+
return cls_
|
|
260
|
+
|
|
261
|
+
@classmethod
|
|
262
|
+
def from_dict(cls, data):
|
|
263
|
+
"""Initialize Mirror from a dictionary.
|
|
264
|
+
|
|
265
|
+
Args:
|
|
266
|
+
data: A dictionary in the format below.
|
|
267
|
+
|
|
268
|
+
.. code-block:: python
|
|
269
|
+
|
|
270
|
+
{
|
|
271
|
+
"type": "Mirror", # Material type
|
|
272
|
+
"identifier": "", # Material identifier
|
|
273
|
+
"display_name": "", # Material display name
|
|
274
|
+
"r_reflectance": float, # Reflectance for red
|
|
275
|
+
"g_reflectance": float, # Reflectance for green
|
|
276
|
+
"b_reflectance": float, # Reflectance for blue
|
|
277
|
+
"modifier": {}, # Material modifier (Default: None)
|
|
278
|
+
"alternate_material": {}, # optional alternate material
|
|
279
|
+
"dependencies": []
|
|
280
|
+
}
|
|
281
|
+
"""
|
|
282
|
+
cls._dict_type_check(cls.__name__, data)
|
|
283
|
+
modifier, dependencies = cls.filter_dict_input(data)
|
|
284
|
+
if 'alternate_material' in data and data['alternate_material']:
|
|
285
|
+
# alternate material
|
|
286
|
+
if data['alternate_material'] == 'void':
|
|
287
|
+
alternate_material = VOID
|
|
288
|
+
else:
|
|
289
|
+
try: # see if the mutil module has already been imported
|
|
290
|
+
mutil
|
|
291
|
+
except NameError:
|
|
292
|
+
# import the module here to avoid a circular import
|
|
293
|
+
import honeybee_radiance.mutil as mutil
|
|
294
|
+
alternate_material = mutil.dict_to_modifier(data['alternate_material'])
|
|
295
|
+
else:
|
|
296
|
+
alternate_material = None
|
|
297
|
+
|
|
298
|
+
new_obj = cls(identifier=data["identifier"],
|
|
299
|
+
r_reflectance=data["r_reflectance"],
|
|
300
|
+
g_reflectance=data["g_reflectance"],
|
|
301
|
+
b_reflectance=data["b_reflectance"],
|
|
302
|
+
modifier=modifier,
|
|
303
|
+
alternate_material=alternate_material,
|
|
304
|
+
dependencies=dependencies)
|
|
305
|
+
if 'display_name' in data and data['display_name'] is not None:
|
|
306
|
+
new_obj.display_name = data['display_name']
|
|
307
|
+
return new_obj
|
|
308
|
+
|
|
309
|
+
def to_dict(self):
|
|
310
|
+
"""Translate this object to a dictionary."""
|
|
311
|
+
base = {
|
|
312
|
+
'modifier': self.modifier.to_dict(),
|
|
313
|
+
'type': 'Mirror',
|
|
314
|
+
'identifier': self.identifier,
|
|
315
|
+
'r_reflectance': self.r_reflectance,
|
|
316
|
+
'g_reflectance': self.g_reflectance,
|
|
317
|
+
'b_reflectance': self.b_reflectance,
|
|
318
|
+
# dependencies without alternate material
|
|
319
|
+
'dependencies': [dp.to_dict() for dp in self._dependencies]
|
|
320
|
+
}
|
|
321
|
+
if self.alternate_material:
|
|
322
|
+
if isinstance(self.alternate_material, Void):
|
|
323
|
+
base['alternate_material'] = {'type': 'void'}
|
|
324
|
+
else:
|
|
325
|
+
base['alternate_material'] = self.alternate_material.to_dict()
|
|
326
|
+
else:
|
|
327
|
+
base['alternate_material'] = None
|
|
328
|
+
if self._display_name is not None:
|
|
329
|
+
base['display_name'] = self.display_name
|
|
330
|
+
return base
|
|
331
|
+
|
|
332
|
+
def __copy__(self):
|
|
333
|
+
mod, depend = self._dup_mod_and_depend()
|
|
334
|
+
alt_mat = None if not self.alternate_material \
|
|
335
|
+
else self.alternate_material.duplicate()
|
|
336
|
+
new_obj = self.__class__(
|
|
337
|
+
self.identifier, self.r_reflectance, self.g_reflectance, self.b_reflectance,
|
|
338
|
+
mod, alt_mat, depend)
|
|
339
|
+
new_obj._display_name = self._display_name
|
|
340
|
+
return new_obj
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""Radiance Mist Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Mist
|
|
4
|
+
"""
|
|
5
|
+
from .materialbase import Material
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TODO: Implement the class. It's currently only a generic Radiance Primitive
|
|
9
|
+
class Mist(Material):
|
|
10
|
+
"""Radiance Mist Material.
|
|
11
|
+
|
|
12
|
+
Mist is a virtual material used to delineate a volume of participating atmosphere. A
|
|
13
|
+
list of important light sources may be given, along with an extinction coefficient,
|
|
14
|
+
scattering albedo and scattering eccentricity parameter. The light sources named by
|
|
15
|
+
the string argument list will be tested for scattering within the volume. Sources are
|
|
16
|
+
identified by name, and virtual light sources may be indicated by giving the relaying
|
|
17
|
+
object followed by '>' followed by the source, i.e::
|
|
18
|
+
|
|
19
|
+
3 source1 mirror1>source10 mirror2>mirror1>source3
|
|
20
|
+
|
|
21
|
+
Normally, only one source is given per mist material, and there is an upper limit of
|
|
22
|
+
32 to the total number of active scattering sources. The extinction coefficient, if
|
|
23
|
+
given, is added the the global coefficient set on the command line. Extinction is in
|
|
24
|
+
units of 1/distance (distance based on the world coordinates), and indicates the
|
|
25
|
+
proportional loss of radiance over one unit distance. The scattering albedo, if
|
|
26
|
+
present, will override the global setting within the volume. An albedo of 0 0 0 means
|
|
27
|
+
a perfectly absorbing medium, and an albedo of 1 1 1 means a perfectly scattering
|
|
28
|
+
medium (no absorption). The scattering eccentricity parameter will likewise override
|
|
29
|
+
the global setting if it is present. Scattering eccentricity indicates how much
|
|
30
|
+
scattered light favors the forward direction, as fit by the Henyey-Greenstein
|
|
31
|
+
function::
|
|
32
|
+
|
|
33
|
+
P(theta) = (1 - g*g) / (1 + g*g - 2*g*cos(theta))^1.5
|
|
34
|
+
|
|
35
|
+
A perfectly isotropic scattering medium has a g parameter of 0, and a highly
|
|
36
|
+
directional material has a g parameter close to 1. Fits to the g parameter may be
|
|
37
|
+
found along with typical extinction coefficients and scattering albedos for various
|
|
38
|
+
atmospheres and cloud types in USGS meteorological tables. (A pattern will be applied
|
|
39
|
+
to the extinction values.)::
|
|
40
|
+
|
|
41
|
+
mod mist id
|
|
42
|
+
N src1 src2 .. srcN
|
|
43
|
+
0
|
|
44
|
+
0|3|6|7 [ rext gext bext [ ralb galb balb [ g ] ] ]
|
|
45
|
+
|
|
46
|
+
There are two usual uses of the mist type. One is to surround a beam from a spotlight
|
|
47
|
+
or laser so that it is visible during rendering. For this application, it is
|
|
48
|
+
important to use a cone (or cylinder) that is long enough and wide enough to contain
|
|
49
|
+
the important visible portion. Light source photometry and intervening objects will
|
|
50
|
+
have the desired effect, and crossing beams will result in additive scattering. For
|
|
51
|
+
this application, it is best to leave off the real arguments, and use the global
|
|
52
|
+
rendering parameters to control the atmosphere. The second application is to model
|
|
53
|
+
clouds or other localized media. Complex boundary geometry may be used to give shape
|
|
54
|
+
to a uniform medium, so long as the boundary encloses a proper volume. Alternatively,
|
|
55
|
+
a pattern may be used to set the line integral value through the cloud for a ray
|
|
56
|
+
entering or exiting a point in a given direction. For this application, it is best if
|
|
57
|
+
cloud volumes do not overlap each other, and opaque objects contained within them may
|
|
58
|
+
not be illuminated correctly unless the line integrals consider enclosed geometry.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
62
|
+
or special characters. This will be used to identify the object across
|
|
63
|
+
a model and in the exported Radiance files.
|
|
64
|
+
modifier: Modifier. It can be primitive, mixture, texture or pattern.
|
|
65
|
+
(Default: None).
|
|
66
|
+
values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
|
|
67
|
+
refer to a line number in the radiance primitive definitions and the
|
|
68
|
+
values in each array correspond to values occurring within each line.
|
|
69
|
+
is_opaque: A boolean to indicate whether this primitive is opaque.
|
|
70
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
71
|
+
argument is only useful for defining advanced primitives that are
|
|
72
|
+
defined based on other primitives. (Default: []).
|
|
73
|
+
|
|
74
|
+
Properties:
|
|
75
|
+
* identifier
|
|
76
|
+
* display_name
|
|
77
|
+
* values
|
|
78
|
+
* modifier
|
|
79
|
+
* dependencies
|
|
80
|
+
* is_modifier
|
|
81
|
+
* is_material
|
|
82
|
+
* is_opaque
|
|
83
|
+
"""
|
|
84
|
+
__slots__ = ()
|
|
85
|
+
|
|
86
|
+
pass
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Radiance Plasdata Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Plasdata
|
|
4
|
+
"""
|
|
5
|
+
from .materialbase import Material
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TODO: Implement the class. It's currently only a generic Radiance Primitive
|
|
9
|
+
class Plasdata(Material):
|
|
10
|
+
"""Radiance Plasdata Material.
|
|
11
|
+
|
|
12
|
+
Plasdata is used for arbitrary BRDF's that are most conveniently given as
|
|
13
|
+
interpolated data. The arguments to this material are the data file and coordinate
|
|
14
|
+
index functions, as well as a function to optionally modify the data values.
|
|
15
|
+
|
|
16
|
+
.. code-block:: shell
|
|
17
|
+
|
|
18
|
+
mod plasdata id
|
|
19
|
+
3+n+
|
|
20
|
+
func datafile
|
|
21
|
+
funcfile x1 x2 .. xn transform
|
|
22
|
+
0
|
|
23
|
+
4+ red green blue spec A5 ..
|
|
24
|
+
|
|
25
|
+
The coordinate indices (x1, x2, etc.) are themselves functions of the x, y and z
|
|
26
|
+
direction to the incident light, plus the solid angle subtended by the light source
|
|
27
|
+
(usually ignored). The data function (func) takes five variables, the interpolated
|
|
28
|
+
value from the n-dimensional data file, followed by the x, y and z direction to the
|
|
29
|
+
incident light and the solid angle of the source. The light source direction and
|
|
30
|
+
size may of course be ignored by the function.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
34
|
+
or special characters. This will be used to identify the object across
|
|
35
|
+
a model and in the exported Radiance files.
|
|
36
|
+
modifier: Modifier. It can be primitive, mixture, texture or pattern.
|
|
37
|
+
(Default: None).
|
|
38
|
+
values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
|
|
39
|
+
refer to a line number in the radiance primitive definitions and the
|
|
40
|
+
values in each array correspond to values occurring within each line.
|
|
41
|
+
is_opaque: A boolean to indicate whether this primitive is opaque.
|
|
42
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
43
|
+
argument is only useful for defining advanced primitives that are
|
|
44
|
+
defined based on other primitives. (Default: []).
|
|
45
|
+
|
|
46
|
+
Properties:
|
|
47
|
+
* identifier
|
|
48
|
+
* display_name
|
|
49
|
+
* values
|
|
50
|
+
* modifier
|
|
51
|
+
* dependencies
|
|
52
|
+
* is_modifier
|
|
53
|
+
* is_material
|
|
54
|
+
* is_opaque
|
|
55
|
+
"""
|
|
56
|
+
__slots__ = ()
|
|
57
|
+
|
|
58
|
+
pass
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""Radiance Plasfunc Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Plasfunc
|
|
4
|
+
"""
|
|
5
|
+
from .materialbase import Material
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TODO: Implement the class. It's currently only a generic Radiance Primitive
|
|
9
|
+
class Plasfunc(Material):
|
|
10
|
+
"""Radiance Plasfunc Material.
|
|
11
|
+
|
|
12
|
+
Plasfunc in used for the procedural definition of plastic-like materials with
|
|
13
|
+
arbitrary bidirectional reflectance distribution functions (BRDF's). The arguments
|
|
14
|
+
to this material include the color and specularity, as well as the function defining
|
|
15
|
+
the specular distribution and the auxiliary file where it may be found.
|
|
16
|
+
|
|
17
|
+
.. code-block:: shell
|
|
18
|
+
|
|
19
|
+
mod plasfunc id
|
|
20
|
+
2+ refl funcfile transform
|
|
21
|
+
0
|
|
22
|
+
4+ red green blue spec A5 ..
|
|
23
|
+
|
|
24
|
+
The function refl takes four arguments, the x, y and z direction towards the incident
|
|
25
|
+
light, and the solid angle subtended by the source. The solid angle is provided to
|
|
26
|
+
facilitate averaging, and is usually ignored. The refl function should integrate to
|
|
27
|
+
1 over the projected hemisphere to maintain energy balance. At least four real
|
|
28
|
+
arguments must be given, and these are made available along with any additional
|
|
29
|
+
values to the reflectance function. Currently, only the contribution from direct
|
|
30
|
+
light sources is considered in the specular calculation. As in most material types,
|
|
31
|
+
the surface normal is always altered to face the incoming ray.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
35
|
+
or special characters. This will be used to identify the object across
|
|
36
|
+
a model and in the exported Radiance files.
|
|
37
|
+
modifier: Modifier. It can be primitive, mixture, texture or pattern.
|
|
38
|
+
(Default: None).
|
|
39
|
+
values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
|
|
40
|
+
refer to a line number in the radiance primitive definitions and the
|
|
41
|
+
values in each array correspond to values occurring within each line.
|
|
42
|
+
is_opaque: A boolean to indicate whether this primitive is opaque.
|
|
43
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
44
|
+
argument is only useful for defining advanced primitives that are
|
|
45
|
+
defined based on other primitives. (Default: []).
|
|
46
|
+
|
|
47
|
+
Properties:
|
|
48
|
+
* identifier
|
|
49
|
+
* display_name
|
|
50
|
+
* values
|
|
51
|
+
* modifier
|
|
52
|
+
* dependencies
|
|
53
|
+
* is_modifier
|
|
54
|
+
* is_material
|
|
55
|
+
* is_opaque
|
|
56
|
+
"""
|
|
57
|
+
__slots__ = ()
|
|
58
|
+
|
|
59
|
+
pass
|