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

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

[Thread Prev] [Thread Next]

Subject: Circle and arc help
From: mwforum@xxxxxxxxxxxxxxxxxx (Daniel Ajoy)
Date: Sun, 20 Feb 2005 14:17:10 -0500

On 20 Feb 2005 at 17:53, David Longman wrote:

> Another circle solution. This one treats the Turtle more like a robot than a 
> graphics pen.
>  
> No trigonometry at all! 
>  
> (Using MSWLogo)
>  
> Here is version 1:
> to crawl                           
> if (distance :c) < :r [lt 1]   ;if too close to centre of object turn away
> if (distance :c) > :r [rt 1]   ;if too far from centre turn towards
> fd 1
> crawl
> end

Thanks David,

And, if you were following the ellipse discussion in the LogoForum
group, here a is yet another way to draw an ellipse: using crawl.
The code is for MicroWorlds (notice how distance receives a 
turtle name as input, not a coordinate) (a MW project is attached ;)

to crawl                           
if composed_distance < :r [lt 1]   ;if too close to centre of object turn away
if composed_distance > :r [rt 1]   ;if too far from centre turn towards
fd 1
crawl
end

to composed_distance
output (distance "t2) + (distance "t3)
end

to ini
cg
make "r 300
t1, pu setpos [-100 0] pd
t2, pu setpos [-50 0] pd
t3, pu setpos [150 0] pd

t1, crawl
end


Daniel
OpenWorld Learning
http://mia.openworldlearning.org


Attachment: ellipse.mw2
Description: Binary data


  • Previous by thread: Circle and arc help
  • Next by thread: -tools-.txt file questions

  • 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 - 2008