🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Eyal Peleg Wed, 07 Oct 1992 00:27
aspect ratio (was: LOGO riddle/task/something to think about)
#228
Author: Eyal Peleg
Date: Wed, 07 Oct 1992 00:27
80 lines
2811 bytes
In article <1992Sep30.231110.27259@discus.technion.ac.il> I wrote:
>hi all,
> 
>Here is a little logo problem to think about,
>I know its not simple to solve using LOGO WRITER in CGA mode,
>I am not sure how hard will it be on other logo implementations.
>Here goes:
> 
>Your mission if you will choose to accept it is:
>  Draw a vertical line that starts from home [0 0] and ends at [0 90],
>  This line should not be a continuous one but should be 4 pixels on and 1 off
>  something like "---- ---- ---- ---- ---- ...."
>When you answer please include the following:
> 1) What logo did you use
>    (what resolution both screen and logo window
>     for example LOGOWRITER 2.0 CGA (640x200) (+-160,+-95) )
> 2) Your solution/s
> 3) How much time it took you to solve reach them
> 4) How many and what kind of other (not working) solutions did you try
> 5) your opinion of this problem
> 
>EASY STREET :
> if its too difficult for you try the same but horizontal (heading 90)
>THOUGH ONES :
> if its too simple for you try the same with heading 45 deg
> GOOD LUCK
> 
>  eyal peleg
>  s2874066@techst02.technion.ac.il

a most common answer was something like

to solve_the_problem
cs
repeat 18 [pendown forward 4 penup forward 1]
end

and it was refered to as trivial

on most LOGO implementation this does not work because of resolution problems
the problem can be summorized by:
1 turtle step  =/= 1 pixel
and normaly they are not even multiples of each other (integer multiples)

trying to solve it myself (i dont have an answer) on the logowriter CGA mode
i wrote something like this:

to drawit :ratio
repeat 9 [pendown forward 4 * :ratio penup forward 1 * :ratio]
end

to goback :ratio
pu back 45 * :ratio 
left 90 forward 2 right 90
end

to test :from :upto :step
if :from > :upto [stop]
drawit :from
goback :from
test sum :from :step :upto :step
end

and tested it with 
 test 0.7 2 0.05

and none of the lines looked as expected

can someone please tell me how big is a pixel in turtle steps ??
(in logowriter CGA mode)

and another question for those who wrote logowriter
why wasnt .setaspect included ?

i would appriciate any information regarding away to draw small drawings
on logo 
i need to draw stuff about the size of 10*10 pixels and i just cant

thanks 
eyal peleg
Re: aspect ratio (was: LOGO riddle/task/something to think about)
#229
Author: Brian Harvey
Date: Wed, 07 Oct 1992 04:22
35 lines
1939 bytes
When I tried [PD FD 4 PU FD 1] the problem I found wasn't about aspect
ratio (although later I had those problems too).  Rather, it was a
fencepost problem.

Suppose that one turtle step equals one pixel.  What happens when you
say FORWARD 1 with the pen down?  Answer: *two* pixels are turned on.
The turtle used to be at, let's say, [0 0].  After moving forward one
step, it's now at [0 1] (supposing it's facing up).  That makes two
pixels that are part of its one step.  If you say FD 100 then the 100
steps include 101 pixels.

(If that seems strange, think about FORWARD 0, which turns on one pixel
in most versions of Logo, namely the one where the turtle is.)

So, if we start at the origin and do PD FD 4 PU FD 1 then the sequence
of events is

1.  No pixels on, turtle at [0 0].
2.  Turtle moves to [0 4], turning on the five pixels at
		[0 0], [0 1], [0 2], [0 3], [0 4]
3.  Pen up.
4.  Turtle moves one step, not changing what's on the screen since
		the pen's up, ending up at [0 5].

Now if we repeat the same steps, five more pixels will be turned
on, from [0 5] to [0 9].  There is no gap!  Every pixel along the
way was turned on.

If there is no aspect ratio problem, the sequence
	REPEAT 18 [PD FD 3 PU FD 2]
should make four-on, one-off dotted lines.

If you *do* have an aspect ratio problem, you'll know it because
the dottedness comes out uneven because of roundoff errors in
convering turtle steps to pixel steps.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads