Created
May 23, 2011 09:05
-
-
Save vijaydev/986436 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pie_to(val, r) | |
rads = (val*3.60) * Math::PI / 180 # 360 deg of val % in radians | |
sr = (r * Math.sin(rads)).to_i | |
cr = (r * Math.cos(rads)).to_i | |
arc = val <= 50 ? 0 : 1 | |
[sr, r-cr, arc] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment