mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
simplify formula to make it more numerically stable
This commit is contained in:
parent
8a963a0c4e
commit
76a538322d
1 changed files with 1 additions and 1 deletions
|
@ -130,7 +130,7 @@ class ImageReader(MeshReader):
|
||||||
|
|
||||||
if use_transparency_model:
|
if use_transparency_model:
|
||||||
p = 1.0 / math.log(transmittance_1mm / 100.0, 2) # base doesn't matter here. use base 2 for fast computation
|
p = 1.0 / math.log(transmittance_1mm / 100.0, 2) # base doesn't matter here. use base 2 for fast computation
|
||||||
min_luminance = 2.0 ** ((peak_height - base_height) / p)
|
min_luminance = (transmittance_1mm / 100.0) ** (peak_height - base_height)
|
||||||
for (y, x) in numpy.ndindex(height_data.shape):
|
for (y, x) in numpy.ndindex(height_data.shape):
|
||||||
mapped_luminance = min_luminance + (1.0 - min_luminance) * height_data[y, x]
|
mapped_luminance = min_luminance + (1.0 - min_luminance) * height_data[y, x]
|
||||||
height_data[y, x] = base_height + p * math.log(mapped_luminance, 2) # use same base as a couple lines above this
|
height_data[y, x] = base_height + p * math.log(mapped_luminance, 2) # use same base as a couple lines above this
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue