|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| MWForum Message | [Date Index] [Threads] [Authors] [Attachments] [Subscribe] | ||||||||
On June 10th Andrea asked: So how was this done Jeff? A lot of the students at OWL really get excited Hmmm.... "advanced" is a relative term. The Lineweaver program does it by making a list of the vertices of the user-supplied figure (regular or free-form), and uses that list to compute a new list of vertices of a concentric version of that figure, with a given offset. I'd be happy to get into how to do that. But I suspect it would be a little overwhelming for all but very advanced secondary students. It requires familiarity with list-processing and tail-recursion, subjects that should be approached slowly and in a step-by-step way. To do the job you describe (making concentric stars), there is a far simpler way. And this way has the nice feature of introducing some useful triginometry. Please follow this text while referring to the attached images. The simplest way I know to draw a star is probably this: to STAR :leg pd seth -18 repeat 5 [fd :leg lt 144 fd :leg rt 72] end This works by first getting oriented (seth -18), and then 5 times drawing one point of the star and turning to be ready to draw the next point. (See the top pair of figures in the first attached image.) Because the "origin" of the figure is one of its vertices, when you draw a bigger one with the same origin it is not concentric. So what's required to make them concentric is to start (and finish) in the true "center" of the star. This requires computing the ratio of the distance from the center to the "start" point to the length of one leg. How to do that computation is shown in the second attached figure. to STAR2 :sz ;;; allows drawing concentric stars make "here pos make "leg (:sz * sin 36) / sin 18 pu seth 36 fd :sz seth -18 pd repeat 5 [fd :leg lt 144 fd :leg rt 72] pu setpos :here end --Jeff Attachment:
stars_gif.gif Attachment:
startrig.gif 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. | |||||||||