LOGO-L> 3D - Logo For Beginners
Author Message
LOGO-L> 3D - Logo For Beginners

Hello everybody,

What follows is conceptualy rather simple project, which obviously is
a school-level one. It needs improvements and a good "make up", but
I'd like to share it as is, for everyone who is interested could
adjust it to himself.

There are no comments inside the subroutines, for I
think, dialogues and procedures names somewhat clarifies the
situations.

It's a drawing arm, not a robot arm proposed by George Mills yet.
The arm can draw simple and not very simple shapes.
You should describe the shape as a sequence of fragments and after
every fragment call the subroutine   arm.draw  which imitate the
position of the drawing arm in the 3D space. The drawing is placed on
the XZ surface, the arm is perpendicular to it. There are three
turtles - -1, 0 - draws a shape, 1 - is for drawing arm.
You should input several parameters -
arm.size   --  the length of the arm's elbow (it has two equal
elbows). 100, or 150 will be OK.
Three numbers for pen color (RGB palette).
Square side size  -- for drawing a square.
Circle radius size  -- for drawing a circle.

If these values are not suitable for the drawing arm (too large),
you'll get a message and the program should stop (but it
somehow wouldn't).

I'm afraid I've missed many things in the ocean of
information these days, but I faced some unexpected problems there
which I'd like to make clear.  I'm thinking them over
now, may be your comments on the code will remove them before I
formulate them.

Thank you in advance.
Olga.

PS  George, if you are still concerned, I sleep very well, though the
code and the programming style may demonstrate somewhat opposite. :-)

----------------------------------------

to drawing.arm

; main program

cs perspective
setturtle -1
setxyz 0 500 500
messagebox [drawing arm][This arm can draw simple shapes]
messagebox [drawing arm][Input arm size]
make "arm.size rw
setturtle 0 ht downpitch 90 ppt setpensize [2 2]
circle 2*:arm.size
init.pos
messagebox [drawing_arm][ Input three numbers for pencolor (RGB
palette)]
localmake "colorpen readlist messagebox [drawing_arm][Let's
draw a square.   Input side size]
draw.square rw wait 20
messagebox [drawing_arm][Let's draw a circle.  Input radius]
draw.circle rw
messagebox [drawing_arm][Welcome to 3D-space that George built!]
;draw.word
end

to arm.draw :x :z
setturtle 1 ht setpc [0 0 0]
leftroll (arctan :z :x)
pu setxyz :x 0 :z pd
setxyz :x/2 arm.top :z/2
setxyz 0 0 0
wait 20
pu setxyz :x 0 :z pe
setxyz :x/2 arm.top :z/2
setxyz 0 0 0
setturtle 0 ppt pd
end

to arm.top
localmake "arm.size.xz distancexyz (se :x/2 0 :z/2)
if :arm.size.xz>:arm.size [
messagebox [drawing arm][My arm isn't as long! Decreese
parameters!] stop]
op sqrt (sqr :arm.size)-(sqr :arm.size.xz)
end

to draw.circle :a
pe init.pos ppt
setturtle 0
pu setxyz -:a 0 0 pd
arm.draw xcor zcor
repeat 45[setpc :colorpen fd 2*pi*:a/45 rt 8 arm.draw xcor zcor]
init.pos
end

to draw.square :a
pe init.pos ppt
setturtle 0
pu setxyz -:a/2 0 :a/2 pd
arm.draw xcor zcor
repeat 4[repeat 8 [setpc :colorpen fd :a/8 arm.draw xcor zcor]
rt 90]
init.pos
end

to init.pos
setturtle 1 ht setpensize [2 2]
pu home pd
lt 30 fd :arm.size lt 120 fd :arm.size
end

to sqr :a
op :a*:a
end

---------------------------------------------------------------

Sat, 04 Mar 2000 03:00:00 GMT
LOGO-L> 3D - Logo For Beginners

Very nice. You might find QUESTIONBOX much easier and friendlier to use.
Also see "SELECTBOX" where the user could choose among shapes.

For example:

Quote:
>messagebox [drawing_arm][ Input three numbers for pencolor (RGB palette)]
>localmake "colorpen readlist

localmake "colorpen questionbox [drawing_arm] [Input three numbers for
pencolor (RGB palette)]

Also you might experiment with PenReverse instead of PenErase for the
Arm.

--
===============================================================

http://www.softronix.com/
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------

Sat, 04 Mar 2000 03:00:00 GMT

 Page 1 of 1 [ 3 post ]

Relevant Pages

Powered by phpBB® Forum Software