You are viewing our Forum Archives. To view or take place in current topics click here.
Please Help! Python Program!
Posted:
Please Help! Python Program!Posted:
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 37
Reputation Power: 2
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 37
Reputation Power: 2
Please Help!!!! Add me on skype if needed! keane-eastwood
okay so i need to make a spirogram (this one [ Register or Signin to view external links. ] )
and basically i have this code
import turtle
import math
def formulaX(R, r, p, t):
x = (R-r)*cos(t) - (r+p)*cos((R-r)/r*t)
def formulaY(R, r, p, t):
y = (R-r)*sin(t) - (r+p)*sin((R-r)/r*t)
def t_iterating(R, r, p):
t = 0 # It seems odd to me to start from 2*pi rather than 0.
down()
while t < 20*pi: # This loops while t goes from 2*pi to 20*pi
t = t+0.01
goto(formulaX(R, r, p, t), formulaY(R, r, p, t))
up()
def main():
R = int(input("The radius of the fixed circle: "))
r = int(input("The radius of the moving circle: "))
p = int(input("The offset of the pen point, between <10 - 100>: "))
if p < 10 or p > 100:
input("Incorrect value for p!")
t_iterating(R, r, p)
input("Hit enter to close...")
main()
how would i fix it ? heres a link to the website where i found this if you can make more sense of it! Thanks!!!!!! [ Register or Signin to view external links. ]
okay so i need to make a spirogram (this one [ Register or Signin to view external links. ] )
and basically i have this code
import turtle
import math
def formulaX(R, r, p, t):
x = (R-r)*cos(t) - (r+p)*cos((R-r)/r*t)
def formulaY(R, r, p, t):
y = (R-r)*sin(t) - (r+p)*sin((R-r)/r*t)
def t_iterating(R, r, p):
t = 0 # It seems odd to me to start from 2*pi rather than 0.
down()
while t < 20*pi: # This loops while t goes from 2*pi to 20*pi
t = t+0.01
goto(formulaX(R, r, p, t), formulaY(R, r, p, t))
up()
def main():
R = int(input("The radius of the fixed circle: "))
r = int(input("The radius of the moving circle: "))
p = int(input("The offset of the pen point, between <10 - 100>: "))
if p < 10 or p > 100:
input("Incorrect value for p!")
t_iterating(R, r, p)
input("Hit enter to close...")
main()
how would i fix it ? heres a link to the website where i found this if you can make more sense of it! Thanks!!!!!! [ Register or Signin to view external links. ]
#2. Posted:
Status: Offline
Joined: Sep 20, 200915Year Member
Posts: 721
Reputation Power: 32
Status: Offline
Joined: Sep 20, 200915Year Member
Posts: 721
Reputation Power: 32
You should probably ask this in a dedicated programming site
- 0useful
- 0not useful
#3. Posted:
Status: Offline
Joined: Mar 21, 201212Year Member
Posts: 4
Reputation Power: 0
SergeantSmurfs wrote Please Help!!!! Add me on skype if needed! keane-eastwood
okay so i need to make a spirogram (this one [ Register or Signin to view external links. ] )
and basically i have this code
import turtle
import math
def formulaX(R, r, p, t):
x = (R-r)*cos(t) - (r+p)*cos((R-r)/r*t)
def formulaY(R, r, p, t):
y = (R-r)*sin(t) - (r+p)*sin((R-r)/r*t)
def t_iterating(R, r, p):
t = 0 # It seems odd to me to start from 2*pi rather than 0.
down()
while t < 20*pi: # This loops while t goes from 2*pi to 20*pi
t = t+0.01
goto(formulaX(R, r, p, t), formulaY(R, r, p, t))
up()
def main():
R = int(input("The radius of the fixed circle: "))
r = int(input("The radius of the moving circle: "))
p = int(input("The offset of the pen point, between <10 - 100>: "))
if p < 10 or p > 100:
input("Incorrect value for p!")
t_iterating(R, r, p)
input("Hit enter to close...")
main()
how would i fix it ? heres a link to the website where i found this if you can make more sense of it! Thanks!!!!!! [ Register or Signin to view external links. ]
what errors are you receiving when you try to do this code?
- 0useful
- 0not useful
You are viewing our Forum Archives. To view or take place in current topics click here.