Advertisement
Guest User

Untitled

a guest
Feb 27th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. local function CirclePoly(_x,_y,_w,_h,_angle,_fidelity)
  2. local vertices = {}
  3. local ang = -math.rad(_angle)
  4. local c = math.cos(ang)
  5. local s = math.sin(ang)
  6. for i=0,360,math.floor(360/_fidelity) do
  7. local radd = math.rad(i)
  8. local x = math.cos(radd)
  9. local u = (x+1)/2
  10. local y = math.sin(radd)
  11. local v = (y+1)/2
  12.  
  13. local tempx = x * _w * c - y * _h * s + _x
  14. y = x * _w * s + y * _h * c + _y
  15. x = tempx
  16.  
  17. vertices[#vertices+1] = { x = x, y = y, u = u, v = v }
  18. end
  19.  
  20. return vertices
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement