Home Project Folders Resources How Do I? MWForum
Site Map Search Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: Re: MIA, Ask an Expert: poly superprocedure
From: Alain LCSI <alain@xxxxxxx>
Date: Thu, 22 Mar 2007 21:36:15 -0400

Hello,

The cheap solution is to draw a square then draw whatever next polygon you wish to draw, only smaller. If the next polygons have more than 4 sides, and if you maintain the length of a side constant for all polygons, they will only get bigger as the number of sides grow.

Now how much smaller the next polygon has to be? That's a tough question and it is above my willingness to compute geometry at this moment (although it is a great challenge).

But perhaps you meant "centered polygons". Then, the question is something else. In that case, I would make a polygon that "starts from the center"

Here's a procedure by Jacques Mathil, found in the Forum's archive 2005-02-18 (merci Jacques)

to centered_polygon :number_sides :radius
make "alpha 360 / :number_sides
make "side 2 * :radius * sin (:alpha / 2)
pu
fd :radius
rt 90 + :alpha / 2
pd
repeat :number_sides [fd :side rt :alpha]
pu
left 90 + :alpha / 2
bk :radius
end


Alain Tougas alain@xxxxxxx B: (514) 939-8700 poste 237



Le 07-03-22 à 18:46, askanexpert@xxxxxxxxxxxxxxxxxxxxxxxxxxxx a écrit :

This is an automatic message sent from the web form at:
http://mia.openworldlearning.org/howdoi.htm

from: Ashley <ashley.jones512@xxxxxxx>
date: Thu Mar 22 15:46:23 2007
platform: PC
version: MicroWorlds Ex

I wrote a procedure called POLY that inputs the length of the side and
the number of the sides as variables that draw a regular polygon. how
can i write a superprocedure that uses the poly command and the make
command to draw a set of embedded regular polygons with the first
polygon having 4 sides.






  • Previous by thread: MIA, Ask an Expert: poly superprocedure
  • Next by thread: logo vocab/primitives

  • To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.


    © copyright 2001 - 2006