Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Made by fatboychummy
- Edit, use, abuse, and program with anything you wish, Open Source is Open Source.
- ]]
- local function displayBresenhamCircle(xc_, yc_, x, y, func)
- func(xc_+x, yc_+y);
- func(xc_-x, yc_+y);
- func(xc_+x, yc_-y);
- func(xc_-x, yc_-y);
- func(xc_+y, yc_+x);
- func(xc_-y, yc_+x);
- func(xc_+y, yc_-x);
- func(xc_-y, yc_-x);
- end
- local function drawBresenhamCircle(radius_, xc, yc, func)
- local x = 0
- local y = radius_
- local decisionParameter = 3 - 2 * radius_
- displayBresenhamCircle(xc, yc, x, y, func)
- while y >= x do
- x = x + 1
- if decisionParameter > 0 then
- y = y - 1
- decisionParameter = decisionParameter + 4 * (x - y) + 10
- else
- decisionParameter = decisionParameter + 4 * x + 6
- end
- displayBresenhamCircle(xc, yc, x, y, func)
- end
- end
- return drawBresenhamCircle
Add Comment
Please, Sign In to add comment