Optimising...

Started by
10 comments, last by Sailorstick 20 years, 9 months ago
MMX? Won''t I have to use assembly for that?
Advertisement
quote:Original post by stew
Still check out bresenham''s algorithm. You can easily fill the ellipse using a standard scan line fill algorithm. Work out the coordinates for each side of the ellipse using B''s ellipse algorithm and then draw a line between them. You can run B''s alg. in two directions at the same time (i.e. draw two half ellipses/spheres) so you can get the two end points for each line while the sphere itself is being calculated.

It is ahelluva lot faster than using the ellipse equation. The fact it uses integers should really make much difference nowadays though because floats are faster on a pentium than ints anyway. Check out this link for a comparison in CPU cycles on int vs float and sin caching speed advantage

http://aulos.calarts.edu/pipermail/music-dsp/1998-July/020377.html



How can Bresenham''s algorithm be faster than using the ellipse equation, when they are the same? Bresenham''s algorithm is derived from the ellipse equation, and you would probably come up with a very similar thing if you tried to make an algorithm from that.

And yes, you only need to change the original Bresenham''s algorithm a little bit to fill the ellipse

This topic is closed to new replies.

Advertisement