[dev-context] incorrect internal mptopdf conversion

Sanjoy Mahajan sanjoy at mrao.cam.ac.uk
Mon Jan 22 13:35:55 CET 2007


> ok, i fixed it; was a bug in the rline to handler in concat mode 

Great, thanks for that.

> btw, your graphic contains 90% junk ps (covered by successive
> draws), maybe some picture magic without picture resets

Indeed, I was surprised by the length of the mps file.  Oh, it just
hit me the reason for all the junk ps.  It is my 'thinko', so thanks
for pointing me to the problem.

I meant to draw the rotated picture of one triangle six times.
Instead I rotated the currentpicture and drew it on the
currentpicture, so I ended up with 2^6 triangles -- with most of the
code overlapping.  It looked right so I didn't think about it enough.

What I had:

  currentpicture := currentpicture shifted (-z1) scaled 0.7;
  for i = 1 upto 6:
    % this line causes the doubling each time
    draw currentpicture rotated (60*i);
  endfor

Instead, what I should do to avoid the overlapping:

  currentpicture := currentpicture shifted (-z1) scaled 0.7;
  tpic := currentpicture
  for i = 1 upto 5:   % i=6 redraws the original one
    draw tpic rotated (60*i);
  endfor

For those curious about the math behind the picture: The picture
solves the problem of "how do you bisect an equilateral triangle [into
two equal areas] using the shortest path?"
<web.mit.edu/18.098/notes/picture-proofs.pdf> has the details in
section 4.5.

-Sanjoy

`Not all those who wander are lost.' (J.R.R. Tolkien)


More information about the dev-context mailing list