;Andrzej Baczynski wrote :- ;>Hello Turtles, ;>I have found an old mail (dated October 23) from Mr. MHELHEFNY, with 4 methods to ;>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). ;>It should be 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) ] end ;>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. ;_________________ ;For the second time hi Andrzej ! ;George Mills told you to look for the code of the sphere in the solar ;example of MSWLogo. ;Here is the code reworked from that example to draw a real sphere of ;radius :r with even less use of trigonometry since a sine was used ;once only;besides we know where its centre is :- to sph1 :r :step make "n 180/ :step repeat :n[make "g repcount* :step-90 make "k :r* sin :g make "rad sqrt(:r* :r- :k* :k) fd :k down 90 circle :rad up 90 bk :k] end ;This is not an attempt to reduce the value of your clever code; but ;we should try to make the code clear for our students.Try sph1 200 20 ;Now Yehuda will critisize my code for these 3 makes let me in advance ;say what is the wrong with make ? what is the wrong with trigonometry ? ;Merry Christmas ! ;Best Regards ! ;Mhelhefny ;---------------- --------------------------------------------------------------- Please post messages to the Logo forum to logo-l@gsn.org. Mail questions about the list administration to logofdn@gsn.org. To unsubscribe send unsubscribe logo-l to majordomo@gsn.org.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home