Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function CirclePoly(_x,_y,_w,_h,_angle,_fidelity)
- local vertices = {}
- local ang = -math.rad(_angle)
- local c = math.cos(ang)
- local s = math.sin(ang)
- for i=0,360,math.floor(360/_fidelity) do
- local radd = math.rad(i)
- local x = math.cos(radd)
- local u = (x+1)/2
- local y = math.sin(radd)
- local v = (y+1)/2
- local tempx = x * _w * c - y * _h * s + _x
- y = x * _w * s + y * _h * c + _y
- x = tempx
- vertices[#vertices+1] = { x = x, y = y, u = u, v = v }
- end
- return vertices
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement