Any advice? This is due in 3 hours so its super time important
http://pastebin.com/dxg9HyT9
Even if you spot a problem with the math or have some advice please help. Been working on this all night. It almost works, just a few lines out of place.
Printable View
Any advice? This is due in 3 hours so its super time important
http://pastebin.com/dxg9HyT9
Even if you spot a problem with the math or have some advice please help. Been working on this all night. It almost works, just a few lines out of place.
Please, describe your problem instead of posting some strange link address.
Pastebin is a strange link address?
Either way, sorry about that. I am trying to draw a line. My point.draw function places a pixel on the screen. This function is reading two points and drawing every point in between them. It almost works but certain specific angles do not draw correctly. I am guessing there is something wrong with the math. If Anyone who has done something like this before i would greatly appreciate the help.
perhaps, you will show us your code that "almost works but certain specific angles do not draw correctly"?
The problem is i am not sure of the exact angle that does not work. So i cant show a single line. Here is my fill function.
http://www.freemmorpgmaker.com/files...3afbe7f552.png
You notice the dotted lines that appear. It may be a problem with my fill function though i had a similar problem with my lines earlier so i am pretty certain this is the issue. Any help would be great. Thanks.
I didnt post it, becouse i dont believe the problem is there. Also then i would need to include a lot of other classes etc. The actual project is huge.
If this is not enough information to solve the problem i understand.
I haven't ever done that myself (at least not successfully... :rolleyes:), but eventually there never has been a real need to do it anyway, and I'm quite happy about it... :)
At any rate, and since you neither posted code nor the problematic angles are really clear from your screen shot, perhaps the commonly used Bresenham line algorithm is helpful for you, either as a reference to spot what's wrong with your function, or as a basis to re-implement your function from scratch.
Looking at the image you provided, it is clear that the way you are drawing the filled triangles is by drawing a lot of lines radiating from one of the triangle corners. This is not a good way to draw filled triangles for the following reasons:
1) If you don't draw enough lines you get missing pixels - as you are seeing
2) Pixels near the corner you are drawing from are overwritten (drawn more than once) - this is inefficient.
So it is your fill algorithm which is wrong.
To draw filled triangles you should use a scan-line fill algorithm, such as that shown here (http://www-users.mat.uni.torun.pl/~w...i_fillers.html). NB: I just found that on a quick google - I can't vouch for it's correctness.