Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In the pseudo code in the readme just calculate the (square) distance between pleft and p and don't draw the line if the distance is larger than a given threshold. But this is not very efficient. When you switch the loops this will be easier because this check can be done in the outer loop. But I would suggest to experiment with some fog effect first.


Turns out it can be made quite efficient with a little effort put into arithmetic power reduction. In the outer loop, it is possible to calculate a `dr` value from the existing `dx` and `dy`. Then you just increment the radius traveled at the same time as `px` and `py`, and replace the inner loop condition that puts a bound on `z` with a new condition that puts a bound on the radius.

That fixes the rotation artifacts, and then makes it really easy to add a distance-based fog effect to hide the cut-off where new terrain comes into view as well.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: