Line wall AUT crashes and a fix
I have been using some of Georg Pacher's very clever (I think) AUT symbols in their standard form, allocated from within a layout with . symbol-assign area debris AUT symbol-assign line wall:debris AUT symbol-assign point debris AUT etc All has been going quite well for sometime, but tonight Therion 5.3.8 gets into an endless loop, repeating the following text. l_wall_debris->...factor:=scale_factor-0.01;endfor ;thdraw.block.rotated.angl. l.6513 )) ; ! Value is too large (-4104.55951). <forever> ...k)<0;scale_factor:=scale_factor-0.01; ENDFOR I tend to use a scale of 1:1000, but this time I was using 1:5000, so I'm guessing that has overloaded one of the functions in the final loop below. Not sure which variable or function is causing the crash but the value is always the same for any particular scale at each loop cycle. At these scales the length of each line is often going to be much less than the size of the symbol so I expect we need a more cunning exitif criteria. I have made a stab at fixing it below (the exitif in grey), but it is probably not the best solution. It works now however at 1:1000, 1:5000 and 1:10,000. Someone who knows what they are doing might be able to propose a better fix and Martin/Stacho could include it in the next snapshot. I am perplexed by two other somewhat unrelated things. The debris symbols as they turn out in the output are all filled except the first or last one (not sure which) and yet I cannot find a fill command in the code. Having one not filled gives nice quirky random effect, but they are perhaps better filled? Line blocks AUT works perfectly, and yet the code seems to have the same general type of loop and test as the line debris AUT that gives this problem. Cheers, Bruce def l_wall_debris_AUT (expr P) = T:=identity; pickup PenC; laenge := arclength P; path block; path old_block; cur := 0; t:= arctime cur of P; % draw first block old_block := (((-.0u,-.0u)--(.25u,-.15u)--(.45u,0.01u)--(.2u,.25u)--(.05u,.15u)--cycle)); block_width := (xpart urcorner old_block - xpart ulcorner old_block); old_block:=old_block rotated angle(thdir(P,0)) shifted point t of P; thclean old_block; thdraw old_block; cur := cur + 0.9*block_width; t:= arctime cur of P; % proceed with path forever: % generate random block block := punked (((-.25u,-.25u)--(0.25.u,-.25u)--(0.50u,0.01u)--(0.25u,.25u)--(-.25u,.25u)-- cycle) randomized (u/4)) scaled (uniformdeviate(0.3)+.4) rotated uniformdeviate(360); % check width of block block_width := (xpart urcorner block - xpart ulcorner block); exitif cur > (laenge- 2.5*block_width/2); % find next position where the block fits in without intersecting the previous one forever: exitif xpart ( (block rotated angle(-direction t of P) shifted point t of P) intersectiontimes old_block) < 0; cur:=cur+0.01u; t:= arctime cur of P; exitif cur > (laenge- 2.5*block_width/2); endfor; exitif cur > (laenge- 2.5*block_width/2); old_block:= block rotated angle(-direction t of P) shifted point t of P; thclean old_block; thdraw old_block; cur := cur + block_width/2; t:= arctime cur of P; endfor; t:= arctime laenge-eps of P; % generate last block block := (((-.0u,-.0u)--(.25u,-.15u)--(.45u,0.01u)--(.2u,.25u)--(.1u,.15u)--cycle)); block_width := (xpart urcorner block - xpart ulcorner block); % scale last block to fit in the remaining gap scale_factor:=1.5*(laenge-cur)/block_width; forever: exitif scale_factor < 0; % bruces stab at preventing endless loop at large scales exitif xpart ( (block rotated angle(-direction t of P) scaled scale_factor shifted (point t of P)) intersectiontimes old_block) < 0; scale_factor:=scale_factor-0.01; endfor; thdraw block rotated angle(-direction t of P) scaled scale_factor shifted (point t of P); enddef;
On 02.07.2011 11:31, Bruce wrote:
I have been using some of Georg Pacher's very clever (I think) AUT symbols in their standard form, allocated from within a layout with ...
symbol-assign area debris AUT
symbol-assign line wall:debris AUT
symbol-assign point debris AUT
etc
All has been going quite well for sometime, but tonight Therion 5.3.8 gets into an endless loop, repeating the following text...
l_wall_debris->...factor:=scale_factor-0.01;endfor
;thdraw.block.rotated.angl.
l.6513 ))
;
! Value is too large (-4104.55951).
<forever> ...k)<0;scale_factor:=scale_factor-0.01;
ENDFOR
I tend to use a scale of 1:1000, but this time I was using 1:5000, so I'm guessing that has overloaded one of the functions in the final loop below. Not sure which variable or function is causing the crash but the value is always the same for any particular scale at each loop cycle.
At these scales the length of each line is often going to be much less than the size of the symbol so I expect we need a more cunning exitif criteria. I have made a stab at fixing it below (the exitif in grey), but it is probably not the best solution. It works now however at 1:1000, 1:5000 and 1:10,000.
Someone who knows what they are doing might be able to propose a better fix and Martin/Stacho could include it in the next snapshot.
I am perplexed by two other somewhat unrelated things.
The debris symbols as they turn out in the output are all filled except the first or last one (not sure which) and yet I cannot find a fill command in the code. Having one not filled gives nice quirky random effect, but they are perhaps better filled?
Line blocks AUT works perfectly, and yet the code seems to have the same general type of loop and test as the line debris AUT that gives this problem.
Cheers, Bruce
[...] Hi! Thanks for your feedback Bruce, it's good to know that the symbols are also used somewhere else, outside of Austria ;-) When I checked the problems, I found another one in the symbol "line wall:pit", so I simply attach the newest version of the Austrian symbol set, so Martin can include it. The changes regard the following symbols: line wall:pit line wall:debris point debris It includes the fix (as suggested by Martin) for point debris, your fix for the scale problem with wall:debris, an additional thclean for the 'filling' of the first debris in the line and a fix for wall:pit in large scales. Thanks for pointing out these issues, Georg.
participants (2)
-
Bruce -
Georg Pacher