| LoFi version for PDAs |
Help
Search
Members
Calendar
|
| Welcome Guest ( Log In | Register ) | Resend Validation Email |
Add reply · Start new topic · Start new poll |
| albert_redditt |
Posted: Aug 2 2012, 05:40 AM
|
|
Newbie ![]() Group: Power Member Posts: 14 Joined: 2-August 12 Positive Feedback: 0% Feedback Score: 0 |
Hilarious trig formula I accidently discoverd while playing around with trig formulas.
' "!!~~The Bandit~~!!" 'compatable with FreeBASIC / QB64 'easily portable to any compiler that supports trig functions. DIM xres AS INTEGER DIM yres AS INTEGER SCREEN 12 xres = 640 yres = 480 DIM deg1 AS DOUBLE DIM deg2 AS DOUBLE DIM rad AS DOUBLE rad = ATN(1) / 45 'one degree worth of radians DIM c1 as double DIM c2 as double DIM s1 as double Dim s2 as double Dim x1 as double Dim x2 as double Dim y1 As double DIM y2 AS DOUBLE DIM xctr as double DIM yctr as double DIM radius AS DOUBLE xctr = xres / 2 yctr = yres / 2 radius = 125 FOR deg1 = 0 TO 360 c1 = COS(deg1 * rad) s1 = SIN(deg1 * rad) x1 = radius * c1 y1 = radius * s1 FOR deg2 = 0 TO 360 STEP 1 c2 = COS(deg2 * rad) s2 = SIN(deg2 * rad) x2 = radius * c2 * c2 * COS(COS(deg2 * s1 * c2 * rad) * c1) * c2 * c2 / c1 * s1 * COS(deg2 * rad * c1) y2 = radius * s2 * s2 * SIN(COS(deg2 * c1 * s2 * rad) * s1) * s2 * s2 / s1 * s1 * SIN(deg2 * rad * s1) PSET (xctr + x1 + x2, yctr + y1 + y2), 9 NEXT NEXT SLEEP END This post has been edited by albert_redditt on Aug 2 2012, 05:49 AM |
|
Send PM · Send email ·
|
|
Add reply · Start new topic · Start new poll |