Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in rivers algorithm #219

Open
ftomassetti opened this issue Jan 31, 2016 · 1 comment
Open

Possible bug in rivers algorithm #219

ftomassetti opened this issue Jan 31, 2016 · 1 comment

Comments

@ftomassetti
Copy link
Member

Lines 385-390 of worldengine/simulations/erosion.py

                    newElevation = world.layers['elevation'].data[y, x] + (
                        diff * curve)
                    if newElevation <= world.layers['elevation'].data[ry, rx]:
                        print('newElevation is <= than river, fix me...')
                        newElevation = world.layers['elevation'].data[r, x]
                    world.layers['elevation'].data[y, x] = newElevation

I think that world.layers['elevation'].data[r, x] is wrong. It should be instead orld.layers['elevation'].data[ry, rx]. Am I missing something?

@psi29a
Copy link
Member

psi29a commented Feb 1, 2016

You can always link to the line of code instead:
https://github.com/Mindwerks/worldengine/blob/master/worldengine/simulations/erosion.py#L390

                   if newElevation <= world.layers['elevation'].data[ry, rx]:
                        print('newElevation is <= than river, fix me...')
                        newElevation = world.layers['elevation'].data[r, x]

^-- I put that in there to catch issues newElevation being lower than current elevation (it mustn't be lower than the river itself) so we reset it back to the original value. However, this could be 'dead' code and is never run. Might have just been lucky.

There are a few things in that code that don't make sense... right now (page miss!). Like line: https://github.com/Mindwerks/worldengine/blob/master/worldengine/simulations/erosion.py#L371
I'll give it an eye-over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants