Article View: comp.lang.logo
Article #229Re: aspect ratio (was: LOGO riddle/task/something to think about)
From: Brian Harvey
Date: Wed, 07 Oct 1992 04:22
Date: Wed, 07 Oct 1992 04:22
35 lines
1939 bytes
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.
Technical Details
Message-ID:
<1atom3INNng6@agate.berkeley.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!agate!anarres.CS.Berkeley.EDU!bhReferences:
<1992Oct7.002753.14062@discus.technion.ac.il>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!agate!anarres.CS.Berkeley.EDU!bh From: bh@anarres.CS.Berkeley.EDU (Brian Harvey) Newsgroups: comp.lang.logo Subject: Re: aspect ratio (was: LOGO riddle/task/something to think about) Date: 7 Oct 1992 04:22:27 GMT Organization: University of California at Berkeley Lines: 35 Message-ID: <1atom3INNng6@agate.berkeley.edu> References: <1992Oct7.002753.14062@discus.technion.ac.il> NNTP-Posting-Host: anarres.cs.berkeley.edu