[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LOGO-L> Secret project revealed ;)



Very nice again. I don't think some folks realize how hard it is to
do what you did. To explain a little, MSWLogo 3D only allows you to
create 3D surfaces. It does not allow you to delete 3D surfaces. In in
order for Tom to do what he did he had to *build* a square with a whole
absent in it. Most CAD systems have a "punch-out" mode that allows you
to delete sub solids. Just as MSWLogo was enhanced from wire frame to
shaded surfaces with the relationship of vectors to form polygons; in
order for a system to *punch-out* solids the system would have to
understand the relation ship between the polygons that forms a solid
(e.g. SOLIDSTART, SOLIDEND).

I suspect the reason for the strange flipping is this. Picture yourself
as the camera focused on the center of a sphere at the equator. Actually
picture the camera as your head and eyes. Now fly to the north pole.
Keep your eyes focused on the center as you fly but keep the axis of your
head along the same north to south pole axis of the sphere. Now continue
flying over the north pole on to the other side. As you pass over the pole
you have to roll your head 180 degrees in order that your eyes stay focused
on the center of the sphere and your head remains on axis with the sphere.

How can you change the orientation of your head?

That's an extra job TURTLE -2 is assigned. Turtle -2's position is the focal point
AND Turtle -2's orientation is the orientation of the camera. You can synchronize
Turtle -2's orientation (and it's position if you like) with Turtle -1's flight.

Draw 3D object and try this:

repeat 72 [ask -2 [rt 5]]

You could create a "flight" program that links Turtle -2's position and orientation
with Turtle -1's orientation during flight such that the camera always looks out
his "belly". Note Turtle -1 is he and Turtle -2 is she (the guy never takes
his eye's of the gal :-)).

I had linked the camera orientation to TURTLE -1 but it was awkward. Because
I wanted the "up" orientation to be a TURTLE orientation (I did not want to
explain "Normal's"), you could not watch the gal and fly at the same time :-)
So since TURTLE -2's orientation was not used and tends to be more stable
I linked it to TURTLE -2.

I'll check out the crash.

Tom Lynn wrote:
> 
> The secret is out.  The truth is out there.  Using weird alien technology,
> I can now reveal that they do exist...
> 
>   Cubes with holes!
> 
> Our top people in white coats have revealed these facts about these
> deceptively simple devices:
> 
> Due to the reflex angles around the holes, the faces of the cubes must be
> made from triangles as concave polygons can't be rendered.
> 
> The angleto procedure returns the angle that a turtle must turn right
> through to get to another point in its plane.  This technology may have
> applications in other projects...
> 
> There are strange and as yet unexplained energy fields flowing through the
> tube.  Attempting to fly the camera into the tube results in a Windows
> GPF...
> 
> Moving the camera in a vertical circle around these objects (as shown in
> the demonstration) results in a strange flipping of the viewpoint as the
> camera crosses the X and Y axes.  This flipping has been negated in the
> demonstration, but commenting out the "ask -2" lines in the flyaround
> procedure will demonstrate the effect.
> 
> Cubes with spherical indentations are not beyond the bounds of
> possibility.
> 
> Investigations continue.  Trust no-one.
> 
> Tom Lynn
> 
>   ------------------------------------------------------------------------------------------------------------------------------------
> to aaa
> ; Cubes with holes.
> 
>   cs perspective setsc [0 0 0] setlight [0 0.3] ask -3 [setposxyz [-1000 -1000 400]]
>   ht
>   setcam [150 150 850]
>   ask -2 [setposxyz [150 150 -150]]
> 
>   (holeycube 300 100 [95 127 95] [63 95 63] 4)
>   setposxyz [100 100 -500] setorientation [0 0 0]
>   (holeycube 100 50 [95 127 191] [95 127 191] 4)
>   polyview
>   flyaround [150 150 -150] 1000 10
> end
> 
> to angleto :pxyz
> ; Returns the angle to turn right by in order to point towards :pxyz,
> ; (assuming that :pxyz is in the same plane).
> 
>   localmake "startpos posxyz
>   if :startpos = :pxyz [output 0]
>   localmake "hvec vecsub :pxyz :startpos
>   localmake "penstate pendownp
> 
>   pu fd 1 localmake "fdvec vecsub posxyz :startpos bk 1
>   rt 90 fd 1 localmake "rtvec vecsub posxyz :startpos bk 1 lt 90
>   local "theta
>   localmake "costheta (dotprod :hvec :fdvec) / (veclen :hvec)
>   if 1 < (abs :costheta) [
>     ifelse :costheta < 0 [make "costheta -1][make "costheta 1]
>   ]
>   make "theta arccos :costheta
>   if (dotprod :hvec :rtvec) < 0 [make "theta 360-:theta]
> 
>   ifelse :penstate [pd][pu]
>   output :theta
> end
> 
> to dotprod :p :q
>   output apply "sum (map "product :p :q)
> end
> 
> to flyaround :centre :radius :spq
>   localmake "a 90/:spq
>   localmake "step :radius*(sin :a)
> 
>   ; spq = slices per quarter
>   ;   a = slice angle
> 
>   setturtle -1
> 
>   ; Should really go down :a/2 to centre properly,
>   ; but this causes problems with the view-flipping.
> 
>   ; The "ask -2"s are needed to cope with a view-flipping
>   ; effect which I don't really understand.  Comment them
>   ; out to see what I mean.
> 
>   repeat :spq [fd :step down :a]
>   ask -2 [up 90 rt 180]
>   repeat :spq [fd :step down :a]
>   ask -2 [down 90 rt 180]
>   repeat :spq [fd :step down :a]
>   ask -2 [up 90 rt 180]
>   repeat :spq [fd :step down :a]
> end
> 
> to hole :size [:slices 8]
> ; Makes a square with a circular hole of same diameter as square
> ; side length, :size.  This can be used together with holeface and
> ; tube to create a 3d object with a cylindrical hole.  Circle is
> ; represented as a regular polygon with 4*:slices sides.
> 
>   localmake "sliceangle 90/:slices
>   localmake "holeside :size*sin (:sliceangle/2)
>   local [k orient corner lastpos]
> 
>   repeat 4 [
>     make "corner posxyz
>     pu fd :size/2 make "lastpos posxyz bk :size/2
>     repeat :slices [
>       pu make "orient orientation
>       pd polystart
>         make "k (angleto :lastpos)
>         rt :k fd distancexyz :lastpos lt :k
>         make "k 180-(repcount-0.5)*:sliceangle
>         rt :k fd :holeside make "lastpos posxyz lt :k
>         make "k (angleto :corner)
>         rt :k fd distancexyz :corner lt :k
>       polyend
>     ]
>     pu setposxyz :corner setorientation :orient
>     fd :size rt 90
>   ]
> end
> 
> to holeface :side :diameter [:slices 8]
> ; Creates a square of sidelength :side with a central circular hole
> ; of diameter :diameter.  In fact, the circle is a :slices sided polygon.
> 
>   localmake "diag (0.5*sqrt 2)*(:side-:diameter)
> 
>   repeat 4 [
>     pd polystart
>       fd :side
>       rt 135 fd :diag
>       rt 45 fd :diameter
>       rt 45 fd :diag
>       rt 135
>     polyend
>     pu fd :side rt 90
>   ]
>   pu rt 45 fd :diag lt 45
>   (hole :diameter :slices)
>   pu rt 45 bk :diag lt 45
> end
> 
> to holeycube :squareside :holediam :cubecol :tubecol [:slices 8]
>   repeat 2 [
>     setpc :cubecol (holeface :squareside :holediam :slices)
>     pu rt 45 fd 0.5*:squareside*sqrt 2 lt 45
>     setpc :tubecol (tube :holediam :squareside :slices)
>     pu rt 45 bk 0.5*:squareside*sqrt 2 lt 45
>     fd :squareside down 90
>     setpc :cubecol pd polystart repeat 4 [fd :squareside rt 90] polyend
>     pu fd :squareside down 90
>   ]
>   pu lt 90 down 90
>   repeat 2 [
>     pd polystart repeat 4 [fd :squareside rt 90] polyend
>     pu repeat 2 [fd :squareside down 90]
>   ]
> end
> 
> to reorient :rpy
> ; Restores an orientation returned by orientation.
> 
>   setorientation [0 0 0]
>   rr (first :rpy)
>   up (first butfirst :rpy)
>   rt (first butfirst butfirst :rpy)
> end
> 
> to setcam :pxyz
>   ask -1 [setposxyz :pxyz]
> end
> 
> to test_angleto
> ; Tests that angleto is working by moving to a random plane,
> ; looking in a random direction and checking that it gives the correct angle.
> 
>   pu
>   repeat 20 [
>     setposxyz (list (100 - random 200) (100 - random 200) (100 - random 200))
>     setorientation (list (random 360) (random 360) (random 360))
>     make "testangle (random 360)
>     rt :testangle fd 100 make "testpos posxyz bk 100 lt :testangle
>     show abs ((angleto :testpos) - :testangle)
>   ]
> end
> 
> to tube :d :h [:slices 8]
> ; Draws an open-ended cylindrical tube, diameter :d, height :h
> ; with the centre of the top around the current turtle position
> ; and the tube perpendicular below it.  Circular cross-section
> ; is modelled by a regular polygon with 4*:slices sides.
> 
>   localmake "r :d/2
>   localmake "halfsliceangle 45/:slices
>   localmake "side :d*sin (:halfsliceangle)
>   repeat 4*:slices [
>     pu fd :r rt :halfsliceangle down 90
>     pd polystart
>       repeat 2 [fd :h rt 90 fd :side rt 90]
>     polyend
>     pu up 90 lt :halfsliceangle bk :r
>     rt 2*:halfsliceangle
>   ]
> end
> 
> to vecadd :a :b
> ; Adds vectors :a and :b
>   output (map [?1 + ?2] :a :b)
> end
> 
> to veclen :v
>   localmake "a first :v
>   localmake "b first butfirst :v
>   localmake "c first butfirst butfirst :v
>   output sqrt (:a*:a + :b*:b +:c*:c)
> end
> 
> to vecscale :s :v
> ; Multiplies vector :v by scalar :s
>   output map (list "? "* :s) :v
> end
> 
> to vecsub :p :q
>   output (map [?1 - ?2] :p :q)
> end
> 
>   ------------------------------------------------------------------------------------------------------------------------------------
> The following section of this message contains a file attachment
> prepared for transmission using the Internet MIME message format.
> If you are using Pegasus Mail, or any another MIME-compliant system,
> you should be able to save it or view it from within your mailer.
> If you cannot, please ask your system administrator for assistance.
> 
>    ---- File information -----------
>      File:  holeycubes.gif
>      Date:  2 Aug 1998, 15:17
>      Size:  3269 bytes.
>      Type:  GIF-image
> 
>   ------------------------------------------------------------------------------------------------------------------------------------
> 
>                         Name: holeycubes.gif
>    holeycubes.gif       Type: GIF Image (Image/GIF)
>                     Encoding: BASE64

--
===============================================================
George Mills (mills@softronix.com)
http://www.softronix.com/
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------
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