From: ian Date: Wed, 4 Feb 2004 23:14:02 +0000 (+0000) Subject: arcline honours minradius X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=cc3e4236b04b52cb378b1319b2d304ac6dbd50f6;p=trains.git arcline honours minradius --- diff --git a/layout/layout b/layout/layout index 868216d..e7c265e 100755 --- a/layout/layout +++ b/layout/layout @@ -653,11 +653,7 @@ sub joins_arcline ($$$$) { my ($swap,$echoice,$path, $ap,$bp,$av,$bv, $e,$f, $ae,$af,$afae); my ($dak,$ak,$kj,$k,$j,$aja,$jl,$l,$jc,$lc,$c,$rj,$rb); foreach $swap (qw(-1 +1)) { -# { -# $swap=+1; foreach $echoice (qw(0 1)) { -# { -# $echoice=0; $ap= $from; $bp= { %$to }; $bp->{A} += $pi; ($ap,$bp)= ($bp,$ap) if $swap<0; $av= ev_byang({}, $ap->{A}); @@ -665,13 +661,10 @@ sub joins_arcline ($$$$) { $e= ev_byang({}, 0.5 * ($ap->{A} + $bp->{A} + $echoice * $pi)); $f= v_rotateright($e); o("% arcline $swap $echoice e ".loc2dbg($e)."\n"); -# o("% arcline $swap $echoice f ".loc2dbg($f)."\n"); -# o("% arcline $swap $echoice av ".loc2dbg($av)."\n"); $ae= v_dotproduct($av,$e); $af= v_dotproduct($av,$f); o("% arcline $swap $echoice a.e=$ae a.f=$af "); - if (abs($ae) < 1e-6) { o(" singular\n"); next; - o("%");} + if (abs($ae) < 1e-6) { o(" singular\n"); next; } $afae= $af/$ae; o("a.f/a.e=$afae\n"); $dak= v_dotproduct(v_subtract($ap,$bp), $e); @@ -681,8 +674,7 @@ sub joins_arcline ($$$$) { $j= v_add($k, $kj); $aja= v_dotproduct(v_subtract($ap,$j), $av); o("% arcline $swap $echoice d_ak=$dak aj.a=$aja "); - if ($aja < 0) { o(" backwards aj\n"); next; - o("%");} + if ($aja < 0) { o(" backwards aj\n"); next; } $jl= v_scalarmult(0.5, v_subtract($j, $bp)); $lc= v_scalarmult(-v_dotproduct($jl, $f) * $afae, $e); $l= v_add($j, $jl); @@ -690,8 +682,8 @@ sub joins_arcline ($$$$) { $rj= v_dotproduct(v_subtract($j,$c), v_rotateright($av)); $rb= v_dotproduct(v_subtract($c,$bp), v_rotateright($bv)); o("r_j=$rj r_b=$rb "); - if ($rj * $rb < 0) { o(" backwards b\n"); next; - o("%");} + if ($rj * $rb < 0) { o(" backwards b\n"); next; } + if (abs($rj) < $minradius) { o(" too-small\n"); next; } $j->{A}= $ap->{A}; $c->{A}= 0; $path= [{ T => Line, A => $ap, B => $j, L => $aja }, @@ -713,8 +705,8 @@ sub cmd_join { $to= can(\&cva_idex); $minradius= can(\&cva_len); o("% join ".loc2dbg($from)."..".loc2dbg($to)." $minradius\n"); -# joins_twoarcs(\@results, $from,$to,$minradius); -# joins_arcsline(\@results, $from,$to,$minradius); + joins_twoarcs(\@results, $from,$to,$minradius); + joins_arcsline(\@results, $from,$to,$minradius); joins_arcline(\@results, $from,$to,$minradius); foreach $result (@results) { $path= $result->{Path};