Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65850 > unrolled thread
| Started by | geniusrko@gmail.com |
|---|---|
| First post | 2014-02-10 15:44 -0800 |
| Last post | 2014-02-11 08:17 -0500 |
| Articles | 16 — 5 participants |
Back to article view | Back to comp.lang.python
Drawing polygons in python turtle geniusrko@gmail.com - 2014-02-10 15:44 -0800
Re:Drawing polygons in python turtle Dave Angel <davea@davea.name> - 2014-02-10 19:00 -0500
Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 16:23 -0800
Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 16:34 -0800
Re: Drawing polygons in python turtle geniusrko@gmail.com - 2014-02-10 18:13 -0800
Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 18:49 -0800
Re: Drawing polygons in python turtle geniusrko@gmail.com - 2014-02-10 18:51 -0800
Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 18:59 -0800
Re: Drawing polygons in python turtle geniusrko@gmail.com - 2014-02-10 19:01 -0800
Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 19:03 -0800
Re: Drawing polygons in python turtle geniusrko@gmail.com - 2014-02-10 19:06 -0800
Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 19:17 -0800
Re: Drawing polygons in python turtle geniusrko@gmail.com - 2014-02-10 19:19 -0800
Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 19:23 -0800
Re: Drawing polygons in python turtle Terry Reedy <tjreedy@udel.edu> - 2014-02-11 04:35 -0500
Re: Drawing polygons in python turtle Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-11 08:17 -0500
| From | geniusrko@gmail.com |
|---|---|
| Date | 2014-02-10 15:44 -0800 |
| Subject | Drawing polygons in python turtle |
| Message-ID | <4fa08222-582c-4585-b945-e67468c66f6d@googlegroups.com> |
Hi
can anyone help finding the angle to draw different polygons shapes
in this example
import turtle
wm = turtle.Screen()
alex = turtle.Turtle()
for i in range(5):
alex.left(216)
alex.forward(50)
wm.exitonclick()
Why do we use 216
[toc] | [next] | [standalone]
| From | Dave Angel <davea@davea.name> |
|---|---|
| Date | 2014-02-10 19:00 -0500 |
| Message-ID | <mailman.6642.1392076659.18130.python-list@python.org> |
| In reply to | #65850 |
geniusrko@gmail.com Wrote in message: > Hi > can anyone help finding the angle to draw different polygons shapes > > in this example > > import turtle > wm = turtle.Screen() > alex = turtle.Turtle() > for i in range(5): > alex.left(216) > alex.forward(50) > wm.exitonclick() > > Why do we use 216 > 216 degrees doesn't seem to me that it would make a polygon, but rather a star. I can tell you what I remember about geometry, however. To make a regular polygon, you need to turn by a fixed amount and go a fixed distance each time. For an equilateral triangle, you turn 120 degrees. For a square, 90. For a pentagon, 108. 180 - (360/n) degrees. -- DaveA
[toc] | [prev] | [next] | [standalone]
| From | Asaf Las <roegltd@gmail.com> |
|---|---|
| Date | 2014-02-10 16:23 -0800 |
| Message-ID | <0c7e98b6-b3db-472e-ac6b-73a8010a7892@googlegroups.com> |
| In reply to | #65850 |
On Tuesday, February 11, 2014 1:44:28 AM UTC+2, geni...@gmail.com wrote: > Hi > > can anyone help finding the angle to draw different polygons shapes > in this example > import turtle > wm = turtle.Screen() > alex = turtle.Turtle() > for i in range(5): > alex.left(216) > alex.forward(50) > wm.exitonclick() > Why do we use 216 because of every for every turn we need to make angle between edges equal to 36. If you will have a look to pentagon definition: http://en.wikipedia.org/wiki/Pentagon inner angle is equal to 108. from that you can easily calculate the angle between edges of star. there is no difference between these 2: alex.left(216) alex.right(144) change left() to right() and see. /Asaf
[toc] | [prev] | [next] | [standalone]
| From | Asaf Las <roegltd@gmail.com> |
|---|---|
| Date | 2014-02-10 16:34 -0800 |
| Message-ID | <c91407c6-6bef-401b-b4ad-cd6be139def7@googlegroups.com> |
| In reply to | #65853 |
On Tuesday, February 11, 2014 2:23:11 AM UTC+2, Asaf Las wrote: > On Tuesday, February 11, 2014 1:44:28 AM UTC+2, geni...@gmail.com wrote: > > Hi > > > > can anyone help finding the angle to draw different polygons shapes > > in this example > > import turtle > > wm = turtle.Screen() > > alex = turtle.Turtle() > > for i in range(5): > > alex.left(216) > > alex.forward(50) > > wm.exitonclick() > > > Why do we use 216 > because of every for every turn we need to make angle between edges > equal to 36. If you will have a look to pentagon definition: > http://en.wikipedia.org/wiki/Pentagon > inner angle is equal to 108. from that you can easily calculate > the angle between edges of star. > there is no difference between these 2: > alex.left(216) > alex.right(144) > > change left() to right() and see. > /Asaf just a bit add - confusing things here is the reference of 0 degree turtle takes to make turn from. i was also confused when so that (never tried turtle before). the 0 degree is the virtual line which is continuation of direction from point where forward(50) ends. so when left executes it should turn more than 180 to achieve 36 degrees and when right - less. p.s. i am not good in explaining things.
[toc] | [prev] | [next] | [standalone]
| From | geniusrko@gmail.com |
|---|---|
| Date | 2014-02-10 18:13 -0800 |
| Message-ID | <97ec9cf6-ec3c-4bdc-9b9b-23e4a0025eb0@googlegroups.com> |
| In reply to | #65854 |
Well how about the star of david what are the angles
[toc] | [prev] | [next] | [standalone]
| From | Asaf Las <roegltd@gmail.com> |
|---|---|
| Date | 2014-02-10 18:49 -0800 |
| Message-ID | <f9a247a3-17f0-444a-b690-bfcc171fd682@googlegroups.com> |
| In reply to | #65856 |
On Tuesday, February 11, 2014 4:13:16 AM UTC+2, geni...@gmail.com wrote: > Well how about the star of david what are the angles hexagon is not constructed similar to your program for pentagon because crossing path can't jump from one triangle to another. you have 60 degrees turn after 2 turns edges will be concatenated. /Asaf
[toc] | [prev] | [next] | [standalone]
| From | geniusrko@gmail.com |
|---|---|
| Date | 2014-02-10 18:51 -0800 |
| Message-ID | <9ada3f87-6e4f-4b4e-8dc0-b954af46284e@googlegroups.com> |
| In reply to | #65859 |
so does that mean i have to draw two separate triangles
[toc] | [prev] | [next] | [standalone]
| From | Asaf Las <roegltd@gmail.com> |
|---|---|
| Date | 2014-02-10 18:59 -0800 |
| Message-ID | <a7fedbe6-9087-4951-8da4-dfbb34be2776@googlegroups.com> |
| In reply to | #65861 |
On Tuesday, February 11, 2014 4:51:56 AM UTC+2, geni...@gmail.com wrote: > so does that mean i have to draw two separate triangles If you need view of crossing triangles - yes, this is the simplest recipe.
[toc] | [prev] | [next] | [standalone]
| From | geniusrko@gmail.com |
|---|---|
| Date | 2014-02-10 19:01 -0800 |
| Message-ID | <ec8782d1-2475-4fd4-a375-7bee69d3f5f7@googlegroups.com> |
| In reply to | #65864 |
Is there a better way of drawing such as another modules
[toc] | [prev] | [next] | [standalone]
| From | Asaf Las <roegltd@gmail.com> |
|---|---|
| Date | 2014-02-10 19:03 -0800 |
| Message-ID | <4f29e644-f63a-4b78-9d81-eabb1554dc44@googlegroups.com> |
| In reply to | #65865 |
On Tuesday, February 11, 2014 5:01:33 AM UTC+2, geni...@gmail.com wrote: > Is there a better way of drawing such as another modules Could you please elaborate with question? What do you mean?
[toc] | [prev] | [next] | [standalone]
| From | geniusrko@gmail.com |
|---|---|
| Date | 2014-02-10 19:06 -0800 |
| Message-ID | <97f0a5e2-4ac4-4810-921b-edcfc06feee1@googlegroups.com> |
| In reply to | #65867 |
A better way to draw stuff on screen
[toc] | [prev] | [next] | [standalone]
| From | Asaf Las <roegltd@gmail.com> |
|---|---|
| Date | 2014-02-10 19:17 -0800 |
| Message-ID | <d4545b3a-b8f5-414e-b475-c5eea991d9db@googlegroups.com> |
| In reply to | #65868 |
On Tuesday, February 11, 2014 5:06:11 AM UTC+2, geni...@gmail.com wrote: > A better way to draw stuff on screen It depends on particular case/figure you wish to draw. Drawing is separate knowledge field with its own set of algorithms. Geometry is field of wonders. i never dealt with this stuff actually.
[toc] | [prev] | [next] | [standalone]
| From | geniusrko@gmail.com |
|---|---|
| Date | 2014-02-10 19:19 -0800 |
| Message-ID | <cabf7053-5e8a-4d88-b92c-43c9f35369f4@googlegroups.com> |
| In reply to | #65869 |
Going off-topic Which resource do you recommend for learning this wonderful language
[toc] | [prev] | [next] | [standalone]
| From | Asaf Las <roegltd@gmail.com> |
|---|---|
| Date | 2014-02-10 19:23 -0800 |
| Message-ID | <ba2e1e17-e900-4bc5-a396-cce56910fc81@googlegroups.com> |
| In reply to | #65871 |
On Tuesday, February 11, 2014 5:19:52 AM UTC+2, geni...@gmail.com wrote: > Going off-topic Which resource do you recommend for learning this > wonderful language My advice won't be good as mentioned before i never dealt with it. You have chance to discover that country yourself or wait for advice of others or do both at same time.
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2014-02-11 04:35 -0500 |
| Message-ID | <mailman.6655.1392111385.18130.python-list@python.org> |
| In reply to | #65865 |
On 2/10/2014 10:01 PM, geniusrko@gmail.com wrote: > Is there a better way of drawing such as another modules Logo is a drawing language designed for kids who do not know geometry but can imagine walking around on a dirt field and occasionally turning while dragging a stick or dripping paint. Part of the charm is discovering the patterns that emerge when simple actions are repeated. The Python version, turtle, is built on top of tkinter and its Canvas widget. Since I *do* know coordinate geometry and don't care about the moving animal metaphor, I find it easier to use Canvas directly. This avoids the bugs and limitations (including speed) introduced by the turtle module. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2014-02-11 08:17 -0500 |
| Message-ID | <mailman.6664.1392124649.18130.python-list@python.org> |
| In reply to | #65856 |
On Mon, 10 Feb 2014 18:13:16 -0800 (PST), geniusrko@gmail.com declaimed the
following:
>Well how about the star of david what are the angles
The Star of David is not single polygon... It is two equilateral
triangles overlayed. You can not draw one using a single pen stroke and
fixed turn angle.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web