Fix wrong analysis if persistence < 0 and absvalue
This commit is contained in:
parent
e84f99166d
commit
320905826b
15
init.lua
15
init.lua
@ -349,7 +349,15 @@ local analyze_noiseparams = function(noiseparams)
|
||||
-- Calculate the two possible extreme values
|
||||
-- with the octave value being either at 1 or -1.
|
||||
local limit1 = (1 * np.persistence ^ exp)
|
||||
local limit2 = (-1 * np.persistence ^ exp)
|
||||
local limit2
|
||||
if not is_absolute then
|
||||
limit2 = (-1 * np.persistence ^ exp)
|
||||
else
|
||||
-- If absvalue is set, one of the
|
||||
-- limits is always 0 because we
|
||||
-- can't get lower.
|
||||
limit2 = 0
|
||||
end
|
||||
|
||||
-- To add to the maximum, pick the higher value
|
||||
if limit1 > limit2 then
|
||||
@ -357,16 +365,13 @@ local analyze_noiseparams = function(noiseparams)
|
||||
else
|
||||
o_max = o_max + limit2
|
||||
end
|
||||
if not is_absolute then
|
||||
|
||||
-- To add to the minimum, pick the LOWER value
|
||||
if limit1 > limit2 then
|
||||
o_min = o_min + limit2
|
||||
else
|
||||
o_min = o_min + limit1
|
||||
end
|
||||
-- Note: If absvalue flag is set, the sum of the octaves
|
||||
-- is always 0, so we don't need to calculate it
|
||||
end
|
||||
end
|
||||
-- Add offset and scale to min/max value (final step)
|
||||
local min_value = np.offset + np.scale * o_min
|
||||
|
Loading…
x
Reference in New Issue
Block a user