How can i generate coordinates of curves using turtle module in python? I am a beginner in python.
Coordinates of curves with turtle module in python
Collapse
X
-
Tags: None
-
you can see "The 50+ demo applications of the turtle module of Python are intended as examples for using Python and turtlegraphics in an educational setting." on this page - http://code.google.com/p/python-turtle-demo/. It`s interesting :) -
To generate the coordinates of a curve, you need an equation. Then you substitute values in the equation. Here's an example:
Code:from time import sleep from turtle import * def parabolaY(x, a=0.250, b=-10, c=0): return a*x**2 + b*x + c pen = Pen() pen.tracer(True) pen.color('red') pen.width(3) pen.goto(0,0) pen.down() for x in range(0,51): pen.goto(x, parabolaY(x)) pen.up() pen.goto(-100,-100) pen.color('green') pen.write("DONE!") sleep(2) pen._destroy()Comment
Comment