~toolpart/+junk/pythoncard

« back to all changes in this revision

Viewing changes to samples/turtle/scripts/kochCurves.txt

  • Committer: Bazaar Package Importer
  • Author(s): Mohammed Adnène Trojette
  • Date: 2006-11-12 17:52:13 UTC
  • mfrom: (2.1.5 feisty)
  • Revision ID: james.westby@ubuntu.com-20061112175213-tv8bnl6rtpa2qw1o
Tags: 0.8.1-8.1
* Non-maintainer upload.
* Fix path to findfiles, codeEditor and resourceEditor:
   + patch from Ernest ter Kuile <ernestjw@xs4all.nl>. (Closes: #397018)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# examples derived from
2
 
# Visual Modeling with Logo: A Structural Approach to Seeing
3
 
# by James Clayson
4
 
# p. 146
5
 
# and
6
 
# Turtle Geometry: The Computer as a Medium for Exploring Mathematics
7
 
# by Harold Abelson and Andrea diSessa
8
 
# p. 91
9
 
# see http://physics.hallym.ac.kr/education/chaos/ncsa/Fgeom.html
10
 
# for some more explanation of fractals
11
 
 
12
 
from wxTurtleCurves import turtleCurves
13
 
 
14
 
class turtleWrapper(turtleCurves):
15
 
    pass
16
 
 
17
 
def drawMain(dc_local, w, turtleWrapper=turtleWrapper):
18
 
    t = turtleWrapper(dc_local)
19
 
    t.cls()
20
 
    t.pu()
21
 
    t.lt(90)
22
 
    t.fd(50)
23
 
    t.rt(90)
24
 
    t.pd()
25
 
    
26
 
    # VM p. 146
27
 
    t.fractalgon(3, 200, 4, -1)
28
 
    t.fractalgon(3, 250, 4, 1)
29
 
 
30
 
    # if you turn on the odometer you should see the total distance
31
 
    # the turle has gone, so you can compare a level 1 curve to
32
 
    # level 2, 3, etc.
33
 
    # but you will need to subtract the radius (rad) distance * 2
34
 
    # to compensate for the forward() and back() calls in fractalgon
35
 
    # the same distance measurements can be done with other curves:
36
 
    # cCurves, dragon, hilbert, or any drawing commands
37
 
    # for example as the number of sides increases in a polygon
38
 
    # the distance traveled will approach the 2 * pi * r (the radius)
39
 
    # (circumference) of the circle bounded by the polygon
40
 
    #
41
 
    # odometer commands
42
 
    # t.getOdometer()
43
 
    # t.resumeOdometer()
44
 
    # t.resetOdometer()
45
 
    # t.suspendOdometer()
46