-
Notifications
You must be signed in to change notification settings - Fork 0
Description
This problems was spotted first when running dub run after pulling 36e4700.
First, source/app.d calls heightmapPerspectiveTest() defined at source/tests/heightmap-perspective.d
heightmapPerspectiveTest(), at line 68, calls fillByHeightFunction(), defined as
viare/source/heightmap/heightmap.d
Lines 40 to 45 in 36e4700
| void fillByHeightFunction(HeightFunction heightFunction) | |
| { | |
| for (uint i; i < m_xlength; i++) | |
| for (uint j; j < m_ylength; j++) | |
| this[i, j] = heightFunction(cast(float) i / m_xlength, cast(float) j / m_ylength); | |
| } |
using QuevHeightFunction() as argument for heightFunction, defined in source/heightmap/quev.d.
QuevHeightFunction() is specified to receive (double x, double y) as arguments.
Line 102 in 36e4700
| double opCall(double x, double y) |
And fillByHeightFunction was sending them.
viare/source/heightmap/heightmap.d
Line 44 in 36e4700
| this[i, j] = heightFunction(cast(float) i / m_xlength, cast(float) j / m_ylength); |
At least theoretically.
At the first iteration, QuevHeightFunction() should be receiving 0, 0, but it was receiving -nan, 0.
My conclusion was that error must have been coming from fillByHeightFunction().
Before calling heightFunction(cast(double) i / m_xlength, cast(double) j / m_ylength);, all i, m_xlength, j, m_ylength were numbers.
And so were the operations i / m_xlength and j / m_ylength.
And so were the casts cast(double) i / m_xlength and cast(double) j / m_ylength).
tl;dr
QuevHeightFunction() is called with two floats (x, y). But it receives (-nan, y).
This suggests that something happens at the moment of the function call.
Possible Solution
The only solution that I've found so far was writing the value of cast(double) i / m_xlength to console before sending it to QuevHeightFunction().
Yes. Only that. Printing.
Steps to Reproduce
(Assuming you've already cloned the repository)
git pull origin mastergit checkout heightmap-perspective-testgit checkout 36e47004629bbe8900da9570c0271c5a18badc57dub run
Environment
- DMD:
v2.081.1 - DUB:
1.10.0 - OS: Windows 10 1803