LOGO-L> sphere or Christmas bulb 
Author Message
 LOGO-L> sphere or Christmas bulb

Andrzej Baczynski wrote :-

>Hello Turtles,
>I have found an old mail (dated October 23) from Mr. MHELHEFNY, with 4 methods
>draw a sphere in MSWLogo 3D. There are Christmas coming, and I found that one
>more way to produce a sphere (i.e. a bulb for a Christmas Tree) may be useful.
>This is a short and simple, I hope, procedure. It use only rudimentary turtle
>move commands and applies very little trigonometry. (I'm proud of this). The
>result, with appropriate PENCOLOR and PENSIZE, may be as attached. It should
>run in PERSPECTIVE mode, of course.
>This is a procedure itself:

to sph4 :z :w :dx
 localmake "om (180 / :z / :w)
 localmake "fi arctan (1 / :z / 2 )
 repeat (:z * :w) [up :fi fd :dx*sin (repcount * :om ) down :fi rt (360 / :w) ]

>You may run it with :z=18 :w=18 :dx=30 for example and any starting turtle
>There are 3 questions, which a demanding student may ask:
>1-  Is it really a sphere ?
>2-  Where is a centre?
>3-  How to draw only a visible hemisphere?
>I have no students, so I don't need to look for the answer.
>Andrzej B.


;Hi Andrzej !
;Your code for drawing the sphere is actually simple and elegant let me
;praise it. But since on the contrary I have many students I tried to
;study it and here is what I have found.
;1- This code could also be used to draw an ellipsoid as well as a sphere  
;2- The code actually draws some sort of a space poly_speiral selenoid with
;   deminishing radii at both ends
;3- Since it is difficult to figure out the effect of changing :z ,:w and
;   :dx on the resulting shape I have renamed these variables to reflect
;   there meaning . Also I added a fourth argument to the procedure to
;   enable the drawing of an ellipse in addetion to a sphere.
;4- a) The number of turns of the selenoid is :turns, so increasing this
;      number will not change the size of the sphere or ellipsoid
;   b) The number of sides in each selenoid turn is :sides, so increasing
;      this number will make the turn closer to a perfect circle and of
;      course will increase its perimiter  
;   c) The length if each side of the polygon drawing the quasi circular
;      turn is :length, so increasing this length will result in an
;      increase of the sphere radius
;   d) The added input to the procedure :k is a factor which gives a sphere
;      when it is 1 and will elongate the spiral giving an ellipsoid if it
;      is>1 and will contract it giving an ellipsoid if it is <1
;5- the code as shown will shown a solinoid with 12 turns of square shape
;   with the side of the middle turn proportional to 100 and a contraction
;   factor of .3    
;6- You may try sph4 12 60 20 1 ------> a sphere
;   and         sph4 12 60 20 1.5 ----> an ellipsoid.
;   or          sph4 12 60 20 .3 -----> a better ellipsoid
;At the end let me wish you and all the members of logo-l a very happy
;and Merry Christmas
;Best Regards
to go
cs ht turnon3d sph4 12 4 200 1

to sph4 :turns :sides :length :k
 localmake "om (180 / :turns / :sides)
 localmake "fi :k* arctan (1 / :turns / 2 )
 repeat (:turns* :sides)[wait 5 up :fi fd :length*sin (repcount * :om) down :fi
rt (360/ :sides)]

to turnon3d
setturtle -1 setxyz 1000 1000 1000
setturtle 0

Tue, 06 Jun 2000 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. LOGO-L> Sphere or bulb

2. LOGO-L> Bulbs

3. LOGO-L> two bulbs

4. LOGO-L> 4methods to draw a Sphere

5. LOGO-L> Re: Christmas Stars

6. LOGO-L> Christmas Stars

7. LOGO-L> Christmas stars

8. LOGO-L> Re: Half a Christmas Tree

9. LOGO-L> Christmas Presents

10. LOGO-L> Re: LOGO-L> Christmas Presents

11. LOGO-L> Apple logo/MSW Logo

12. LOGO-L> Reseach Machines Logo (RM LOGO)


Powered by phpBB® Forum Software