martinohanlon / minecraft-turtle

3d Graphics Turtle for Minecraft
MIT License
17 stars 12 forks source link

Lines have gaps #3

Closed arpruss closed 9 years ago

arpruss commented 9 years ago

I've seen some gaps in a line. See the attached screenshot (which also includes the code that makes for the gappy line). (For the record, that's running on raspberryjammod, but I hope that doesn't make a difference.)

fullscreen capture 5152015 94753 am

martinohanlon commented 9 years ago

Does it leave the gaps in between the lines or in the middle of lines?

arpruss commented 9 years ago

Looks like the middle of the lines to me.

martinohanlon commented 9 years ago

In that case we need a better 3d bresenham line algorithm (its the MinecraftDrawing.getLine function).

arpruss commented 9 years ago

Yeah. I haven't seen the issue (yet) with the one I use in my Turtle class: https://github.com/arpruss/raspberryjammod/blob/master/python2-scripts/mcpipy/turtle.py Feel free to use it. It's just a direct Python translation of some public domain C++ code I found.

martinohanlon commented 9 years ago

The drawLine function uses the same 3d version of the bresenham line algorithm that is in my turtle code. I believe that the algorithm has the potential to leave gaps but this is considered acceptable because it is fast. I'm going to leave it as it is for the time being.