Last active
August 19, 2024 17:39
-
-
Save imaginamundo/5093bc88eb4d78e3241fa6f0fa5d3a68 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
function _init() | |
offsetx=240 | |
offsety=135 | |
x=0+offsetx | |
y=0+offsety | |
radius=50 | |
theta=0 | |
end | |
function _update() | |
--theta=t()/5 | |
if btn(0) then theta-=0.005 end | |
if btn(1) then theta+=0.005 end | |
if btn(2) then radius+=1 end | |
if btn(3) then radius-=1 end | |
end | |
function _draw() | |
--background | |
cls(1) | |
line(offsetx,0,offsetx,offsety*2,16) | |
line(0,offsety,offsetx*2,offsety,16) | |
circ(x,y,radius,7) | |
--hypotenuse | |
hx=x+cos(theta)*radius | |
hy=y+sin(theta)*radius | |
line(x,y,hx,hy,31) | |
--sine | |
line(hx,y,hx,hy, 10) | |
line(x,y,x,hy, 10) | |
--cosine | |
line(x,hy,hx,hy,12) | |
line(x,y,hx,y,12) | |
--tangent | |
secant=x+1/cos(theta)*radius | |
line(hx,hy,secant,y,23) | |
--cotangent | |
cosecant=y+1/sin(theta)*radius | |
line(hx,hy,x,cosecant,24) | |
print("Press \139 or \145 to change theta",10,10, 16) | |
print("Press \148 or \131 to change radius") | |
color(7) print("radius: "..radius) | |
color(7) print("theta: "..theta) | |
color(31) print("\134hypotenuse") | |
color(10) print("\134sine") | |
color(12) print("\134cosine") | |
color(23) print("\134tangent") | |
color(24) print("\134cotangent") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment