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

Re: LOGO-L> RE: 3D Logo source ?



Regarding MSWLogo 3D concerns:

You can choose to say UP or UPPITCH and you can choose to say DOWN or
DOWNPITCH.
I wanted all commands to have mirror functions to be consistent with the
2D stuff.
So PITCH and YAW by itself was not acceptable. I also wanted short
meaningful
abbreviations which is why I allowed UP and DOWN.

I also wanted folks to be able to take their 2D code and place it into
3D space
without having to change it. Which is why I did not choose to change
RIGHT to YAW.
Anyone can certainly add YAW to the library. But again I'd add YAWRIGHT
and YAWLEFT
(YR and YL probably as well). Notice how your SQUARE function below now
looks exactly
like it did in 2D, why shouldn't it, a SQUARE in of itself is 2D.

Like the 2D stuff I also wanted to allow the user to query his
orientation
like he can with 2D (HEADING/SETHEADING -> ROLL/SETROLL and
PITCH/SETPITCH).
HEADING/SETHEADING is still valid in 3D space, this was very important
because
it allows 2D code that saves and restores it's 2D HEADING to still work
in 3D
and was the most complex part of the whole implementation.

So you need 4 consistent commands for each dimension (RIGHT, LEFT,
HEADING, SETHEADING),
(UPPITCH, DOWNPITCH, PITCH, SETPITCH), and (RIGHTROLL, LEFTROLL, ROLL,
SETROLL).

However, SETPITCH and SETROLL are not that useful because of their
interaction
So I introduced ORIENTATION / SETORIENTATION. This command saves and
restores
your ROLL, PITCH and HEADING without having to worry about their
interdependencies.

SETHEADING has no interaction with ROLL and PITCH which is the key to
the whole
implementation and what allows 2D code to run perfectly in any
orientation (it
took me weeks to realize this was needed). 

I had considered leaving ROLL or PITCH out like you said because the
other 2
can achieve the third, but I put it in for completeness (so students can
discover
this on their own) and also ORIENTATION, SETORIENTAION, and TOWARDSXYZ
needed all 3
(it takes all 3 to describe an orientation so all 3 had to be introduced
any way).

I can assure you if a student wishes to learn more about 3D geometry and
understands
Logo 2D geometry they will feel right at home in MSWLogo 3D.

The turtle itself is in perspective and has a mark showing its "right
hand" to
help you not loose your orientation (a RIGHT turn is always towards it's
right
hand regardless of the turtles orientation). There is also analogous 3D
functions to
TOWARDS (TOWARDSXYZ), DISTANCE (DISTANCEXYZ), POS (POSXYZ), SETPOS
(SETPOSXYZ),
SETXY (SETXYZ).

Here is a sample:

Just as you would in 2D do something like this:

SETHEADING TOWARDS [100 100] FORWARD DISTANCE [100 100]

Which will get you to the corner of a square

You can in MSWLogo 3D do something like this:

SETORIENTATION TOWARDSXYZ [100 100 100] FORWARD DISTANCEXYZ [100 100
100]

Which will get you to the corner of a cube.

You can also adjust your view point by choosing a special TURTLE and use
all the commands above to manipulate your position.

By the way I think your right in what the user was looking for.

Here is what your examples look like in MSWLogo 3D:

TO CUBE :L
REPEAT 4 [SQUARE :L RIGHT 90 FORWARD :L RIGHT -90  RIGHTROLL -90]
END

TO CYCLINDER :L
REPEAT 45 [PANEL :L RIGHTROLL -8]
END

TO MOEBIUS :L
LOCAL "ANG
MAKE "ANG 0
REPEAT 45 [UPPITCH :ANG PANEL :L UPPITCH -:ANG RIGHTROLL -8 MAKE "ANG
:ANG + 4]
END

TO PADDLE :L
REPEAT 9 [SQUARE :L RIGHTROLL 40]
END 

TO PANEL :L
PENUP FORWARD -:L/2 PENDOWN
REPEAT 2 [FORWARD :L RIGHT 90 FORWARD :L/8 RIGHT 90]
PENUP FORWARD :L/2 RIGHT 90 FORWARD :L/8 RIGHT -90 PENDOWN
END

TO PRINTANDRUN :LIST
PRINT :LIST
RUN :LIST
END

TO SQUARE :L
REPEAT 4 [FORWARD :L RIGHT 90]
END

TO TAKEOFF
PERSPECTIVE
PRINTANDRUN [CS DOWNPITCH 70 RIGHT 30 RIGHTROLL 12 CUBE 100]
MESSAGEBOX [] []
PRINTANDRUN [CS UPPITCH 30 RIGHTROLL 12 PADDLE 100]
MESSAGEBOX [] []
PRINTANDRUN [CS UPPITCH 12 CYCLINDER 128]
MESSAGEBOX [] []
PRINTANDRUN [CS UPPITCH 12 MOEBIUS 128]
PRINT [Try by yourself modifying the starting angles. Enjoy!]
END


Tommaso Russo wrote:
> 
> Jean-Paul Roy wrote:
> >
> > A friend of mine [physicist] wants for his son the source of a 3D
> > package for Logo. He uses a Logo with only 2D commands, and would
> > like to pilot a turtle in 3D-space with plane-like commands : yaw,
> > pitch, and roll to draw a line solid.
> > Does anybody have a pointer on *portable* pure Logo source for that ?
> > Thanks a lot,
> >                      Jean-Paul Roy
> 
> I think the attachment is, more or less, what Jean-Paul is searching
> for.
> 
> A notice: I' ve seen some posting talking of a 3-D logo in which PITCH
> and PULLUP are substituted by UP :degrees and DOWN :degrees. As has been
> noted, this can cause confusion with PENUP and PENDOWN. The airplane
> metaphore saves the virtual meaning of the latter commands. YAW could be
> obtained modifying the meaning of RT and LT, but IMHO I think it is
> better to use different commands when working in 3-D. Again IMHO, i
> think that ROLL, though obtainable wint combitations of UP, DOWN, RT and
> LT, is far more intuitive.
> 
> Ciao
> ----------------------
> Tommaso RUSSO
> Abitazione:
>   Strada per Longera 4/1 I-34128 Trieste
>   +39(40)568.777
>   trusso@tin.it
> Ufficio:
>   Responsabile Progetto Reti - AREA Science Park
>   Padriciano 99 I-34012 Trieste
>   +39(40)375.5259
>   Tommaso.Russo@Area.Trieste.It
> 
>   ------------------------------------------------------------------------
> TO AAAREADME
> ; Copyright (C) 1993 Tommaso RUSSO,  AREA Science Park, Trieste, Italy
> ; This program is free software: you can redistribute it and/or modify
> ; it under the terms of the GNU General Public License as published by
> ; the Free Software Foundation Inc., 675 Mass Ave, Cambridge, MA 02139
> ; USA - current version.
> ;
> ; WARNING: this version works with ucblogo and mswlogo.
> ;          For LCSI logo, modify CABRA and VIRA and strip out comments.
> ;
> ; This software was written to implement an idea of Horacio C. Reggini read in
> ; "Computadores: Creativitad o automatismo?",
> ; Ediciones Galapago, Buenos Aires, 1988.
> ;
> ; The basic idea is that "any solid body can be described showing, starting
> ; from a point, all the movements needed to run on all its edges". To do so,
> ; the classical turtle is modified so that it can takeoff, i.e. pullup, and
> ; then yaw, pitch and roll.
> ;
> ; As far I know, Reggini implemented the same or similar commands as primitives
> ; and left to a graphic workstation the task of projecting the obtained
> ; solids onto a plane by variuos perspectives.
> ;
> ; This version is written in LOGO (ucb/mswlogo: LCSI logo requires a minor
> ; change) and the projection is pure axonometry from the z-axis.
> ;
> ; The command needed to initialize the three versors that individuate the
> ; flying turtle in the space is HANGAR. HANGAR can be used also as a 3-d
> ; HOME command. The other commands are GO (equivalent to forward, but in the
> ; 3d space), YAW, PITCH,(PULLUP) and ROLL (whose input is an angle in degrees).
> ; Yaw with a positive argument turns clockwise (compass convention, as RIGHT),
> ; Roll also turns clockwise.
> ; All the commands accept negative arguments.
> ;
> ; HOME, FD, BK, RT and LT can still be used, but carefully.
> ;
> ; Reggini wrote its commands in spanish: I did it first in italian. The
> ; equivalences between the commands are:
> ;
> ;      Espanol              Italiano               English
> ;
> ;        ?                  hangar                 hangar
> ;      andar                vai                    go
> ;      cabecear             picchia                pitch
> ;        ?                  cabra                  pullup
> ;      virar                vira                   yaw
> ;      rolar                rolla                  roll
> ;
> ; Only one out of PITCH and PULLUP is needed. The reason why both are
> ; defined is that Reggini finds natural to use CABECEAR (probably thinking
> ; of the movements of an hand), while CABRA seems more natural to me (thinking
> ; to an airplane).
> ;
> ; Try it: load this file and type TAKEOFF.
> ;
> ; This text written on nov. 24, 1993
> ;
> EDIT "AAAREADME
> END
> 
> TO HANGAR
> IF NOT NAMEP "PRX [FSFLICENSE]
> ; PR stands for PRUA (bow)
> ; AD stands for ALA DESTRA (rigth wing)
> ; SU stands for SU (up; zenith)
> MAKE "PRX 0  MAKE "PRY 1 MAKE "PRZ 0
> MAKE "ADX 1  MAKE "ADY 0 MAKE "ADZ 0
> MAKE "SUX 0  MAKE "SUY 0 MAKE "SUZ 1
> HOME
> END
> 
> TO FSFLICENSE
> PRINT [Copyright (C) 1993 Tommaso RUSSO, AREA Science Park, Trieste, Italy]
> PRINT [This program is free software\; you can redistribute it and/or modify]
> PRINT [it under the terms of the GNU General Public License as published by]
> PRINT [the Free Software Foundation Inc., 675 Mass Ave, Cambridge, MA 02139]
> PRINT [USA - current version.]
> PRINT [This version for ucblogo/mswlogo. For LCSI logo, modify CABRA and VIRA]
> WAITAKEY
> END
> 
> TO WAITAKEY
> PRINT [\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  Press any key to continue]
> IGNORE READCHAR
> CLEARTEXT
> END
> 
> TO CABRA :FI
> MAKE "COSFI COS :FI
> MAKE "SINFI SIN :FI
> MAKE "SUNEWX :SUX * :COSFI - :PRX * :SINFI
> MAKE "SUNEWY :SUY * :COSFI - :PRY * :SINFI
> MAKE "SUNEWZ :SUZ * :COSFI - :PRZ * :SINFI
> MAKE "PRX :PRX * :COSFI + :SUX * :SINFI
> MAKE "PRY :PRY * :COSFI + :SUY * :SINFI
> MAKE "PRZ :PRZ * :COSFI + :SUZ * :SINFI
> MAKE "SUX :SUNEWX
> MAKE "SUY :SUNEWY
> MAKE "SUZ :SUNEWZ
> ; please note: ucblogo and mswlogo use (arctan x y), while LCSI logo
> ; uses (arctan y x).
> ; the following line works with ucblogo (x and y are exchanged because
> ; setheading counts starting from y axis clockwise), but
> ; should be modified for lcsi logo.
> IF NOT AND EQUALP :PRX 0 EQUALP :PRY 0 [SETHEADING (ARCTAN :PRY :PRX)]
> END
> 
> TO PICCHIA :FI
> CABRA -:FI
> END
> 
> TO ROLLA :FI
> MAKE "COSFI COS :FI
> MAKE "SINFI SIN :FI
> MAKE "SUNEWX :SUX * :COSFI + :ADX * :SINFI
> MAKE "SUNEWY :SUY * :COSFI + :ADY * :SINFI
> MAKE "SUNEWZ :SUZ * :COSFI + :ADZ * :SINFI
> MAKE "ADX :ADX * :COSFI - :SUX * :SINFI
> MAKE "ADY :ADY * :COSFI - :SUY * :SINFI
> MAKE "ADZ :ADZ * :COSFI - :SUZ * :SINFI
> MAKE "SUX :SUNEWX
> MAKE "SUY :SUNEWY
> MAKE "SUZ :SUNEWZ
> END
> 
> TO VIRA :FI
> MAKE "COSFI COS :FI
> MAKE "SINFI SIN :FI
> MAKE "PRNEWX :PRX * :COSFI + :ADX * :SINFI
> MAKE "PRNEWY :PRY * :COSFI + :ADY * :SINFI
> MAKE "PRNEWZ :PRZ * :COSFI + :ADZ * :SINFI
> MAKE "ADX :ADX * :COSFI - :PRX * :SINFI
> MAKE "ADY :ADY * :COSFI - :PRY * :SINFI
> MAKE "ADZ :ADZ * :COSFI - :PRZ * :SINFI
> MAKE "PRX :PRNEWX
> MAKE "PRY :PRNEWY
> MAKE "PRZ :PRNEWZ
> ; please note: ucblogo and mswlogo use (arctan x y), while LCSI logo
> ; uses (arctan y x).
> ; the following line works with ucblogo (x and y are exchanged because
> ; setheading counts starting from y axis clockwise), but
> ; should be modified for lcsi logo.
> IF NOT AND EQUALP :PRX 0 EQUALP :PRY 0 [SETHEADING (ARCTAN :PRY :PRX)]
> END
> 
> TO VAI :DIST
> FD :DIST * SQRT(:PRX*:PRX +:PRY*:PRY)
> END
> 
> TO YAW :ANG
> VIRA :ANG
> END
> 
> TO ROLL :ANG
> ROLLA :ANG
> END
> 
> TO PITCH :ANG
> CABRA -:ANG
> END
> 
> TO PULLUP :ANG
> CABRA :ANG
> END
> 
> TO GO :DIST
> VAI :DIST
> END
> 
> TO SQ :L
> REPEAT 4 [VAI :L VIRA 90]
> END
> 
> TO CUBE :L
> REPEAT 4 [SQ :L YAW 90 GO :L YAW -90  ROLL -90]
> END
> 
> TO PALETAS :L
> REPEAT 9 [SQ :L ROLL 40]
> END
> 
> TO FRANJA :L
> PENUP GO -:L/2 PENDOWN
> REPEAT 2 [GO :L VIRA 90 GO :L/8 VIRA 90]
> PENUP GO :L/2 VIRA 90 GO :L/8 VIRA -90 PENDOWN
> END
> 
> TO ANILLO :L
> REPEAT 45 [FRANJA :L ROLL -8]
> END
> 
> TO MOEBIUS :L
> LOCAL "ANG
> MAKE "ANG 0
> REPEAT 45 [PITCH :ANG FRANJA :L PITCH -:ANG ROLL -8 MAKE "ANG :ANG + 4]
> END
> 
> TO TAKEOFF
> HANGAR
> PRINTANDRUN [HANGAR CS PICCHIA 70 VIRA 30 ROLLA 12 CUBE 100]
> WAITAKEY
> PRINTANDRUN [HANGAR CS CABRA 30 ROLLA 12 PALETAS 100]
> WAITAKEY
> PRINTANDRUN [HANGAR CS CABRA 12 ANILLO 128]
> WAITAKEY
> PRINTANDRUN [HANGAR CS CABRA 12 MOEBIUS 128]
> WAITAKEY
> PRINT [Try by yourself modifying the starting angles. Enjoy!]
> END
> 
> TO PRINTANDRUN :LIST
> PRINT :LIST
> RUN :LIST
> END
> 
> 
-- 
===============================================================
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