<div dir="ltr"><div><div><div>Hi Andrew, <br><br></div><div>First of all, i would suggest to use:<br> st:= arctime (laenge+cur/2) of P; instead of<br> st:= arctime (laenge+cur)/2 of P;<br></div><div>for the direction of the last block. Otherwise this will use the direction near the middle of the path, and not at the location of the last block. But I am not sure if this is related to your issue.<br><br></div>I remember having this issue also back then, when generating the AUT symbol-set. Though I don't remember the details anymore, I believe it always had something to do with determining the scale_factor for the last block, or the calculated location for the last block.<br></div>You can check that by adding the line "scale_factor" before "  if scale_factor > 0:", to print out the value of scale factor (when omitting the ';', it will print out the stated value). Then you should see if this value gets <=0 sometimes.<br></div>But note that it is not feasible to do this on a big dataset, as there will be an enormous amount of output then.<br><div><div><br></div><div>hope that helps,<br></div><div>Georg.<br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 21, 2015 at 9:39 AM, Andrew Atkinson <span dir="ltr"><<a href="mailto:andrew@wotcc.org.uk" target="_blank">andrew@wotcc.org.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think this started life at the AUT line symbol for Blocks. My metapost<br>
is at the stage where I can just about edit it to get small changesm but<br>
that is about it.<br>
<br>
With the AUT symbol you got blocks at funny angle when going round a<br>
tight curve, I think this was because it took it angle from the start of<br>
the place that it was drawing the block, so I added the st variable as<br>
well as reducing the randomness of the angle. I also increased the<br>
length of the blocks, plus added an extra point on the block and added a<br>
bit of space between. All well and good, but now occasionally, probably<br>
about 1/4 of the time, the last block in a line is drawn on top of the<br>
second last block in a line then a space the size of the last bock is<br>
left. No idea why this should be controlled by position t which is the<br>
same as the rest of the blocks that work fine.<br>
<br>
If anyone could help solve this I would be most greatful, trying to<br>
print the survey for HE in 5 days time, so printing needs to be sent off<br>
asap<br>
<br>
thanks Andrew<br>
<br>
def l_wall_blocks_CHED (expr P) =<br>
<br>
  T:=identity;<br>
  pickup PenC;<br>
  laenge := arclength P;<br>
<br>
  path block;<br>
  path old_block;<br>
<br>
  cur := 0;<br>
<br>
<br>
  #draw first block<br>
  old_block := punked ((<br>
(.65u,-.15u)--(.72u,0.05u)--(.55u,.15u)--(.23u,.17u)--(.0u,.03u)--(.05u,-.1u))randomized<br>
(0.1u))<br>
             scaled (uniformdeviate(0.3)+.65);<br>
  block_width := (xpart urcorner old_block - xpart ulcorner old_block);<br>
  t:= arctime (cur+block_width/2) of P;<br>
  old_block:=old_block rotated angle( direction t of P) shifted point 0<br>
of P;<br>
  thclean (old_block--cycle);<br>
  thdraw old_block;<br>
<br>
<br>
  cur := cur + block_width + 0.04u;<br>
<br>
  forever:<br>
    # generate random block<br>
    block := punked (<br>
((.65u,-.15u)--(.72u,0.05u)--(.55u,.15u)--(.2u,.17u)--(.0u,.03u)--(.05u,-.1u)<br>
)<br>
          randomized (0.1u) )<br>
           scaled (uniformdeviate(0.3)+.65)<br>
          rotated (uniformdeviate(20)-10);<br>
    # check width of block<br>
    block_width := (xpart urcorner block - xpart ulcorner block);<br>
<br>
    exitif cur > (laenge- 3*block_width/2);<br>
    # find next position where the block fits in without intersecting<br>
the previous one<br>
    forever:<br>
      exitif xpart ( ((block--cycle) rotated angle(direction t of P)<br>
shifted point t of P) intersectiontimes old_block) < 0;<br>
      cur:=cur+0.01u;<br>
      t:= arctime cur of P;<br>
      st:= arctime (cur+block_width/2) of P;<br>
      exitif cur > (laenge- 3*block_width/2);<br>
    endfor;<br>
    exitif cur > (laenge- 3*block_width/2);<br>
<br>
    old_block:= block rotated angle(direction st of P) shifted point t of P;<br>
    thclean (old_block--cycle);<br>
    thdraw old_block;<br>
<br>
  cur := cur + block_width + 0.04u;<br>
<br>
  endfor;<br>
<br>
    # generate last block<br>
<br>
    block :=<br>
(((.65u,-.15u)--(.72u,0.05u)--(.55u,.15u)--(.2u,.17u)--(.0u,.03u)--(.05u,-.1u))<br>
);<br>
    block_width := (xpart urcorner block - xpart ulcorner block);<br>
<br>
    # scale last block to fit in the remaining gap<br>
    scale_factor:=(laenge-cur)/block_width;<br>
      t:= arctime cur of P;<br>
      st:= arctime (laenge+cur)/2 of P;<br>
    forever:<br>
          exitif scale_factor < 0;<br>
      exitif xpart ( ( (block) rotated angle (direction st of P) scaled<br>
scale_factor shifted (point t of P) ) intersectiontimes old_block) < 0;<br>
      scale_factor:=scale_factor-0.001;<br>
    endfor;<br>
    if scale_factor > 0:<br>
      thclean (block--cycle) rotated angle (direction st of P) scaled<br>
scale_factor shifted (point t of P);<br>
      thdraw (block) rotated angle (direction st of P) scaled<br>
scale_factor shifted (point t of P);<br>
    fi;<br>
enddef;<br>
<br>
    initsymbol ("l_wall_blocks_CHED");<br>
_______________________________________________<br>
Therion mailing list<br>
<a href="mailto:Therion@speleo.sk">Therion@speleo.sk</a><br>
<a href="http://mailman.speleo.sk/mailman/listinfo/therion" rel="noreferrer" target="_blank">http://mailman.speleo.sk/mailman/listinfo/therion</a><br>
</blockquote></div><br></div>