chiark / gitweb /
arcline honours minradius
authorian <ian>
Wed, 4 Feb 2004 23:14:02 +0000 (23:14 +0000)
committerian <ian>
Wed, 4 Feb 2004 23:14:02 +0000 (23:14 +0000)
layout/layout

index 868216da84d2e8d1624a5461b330db4b88784f6c..e7c265ec5da3ff411453d2e1afd67d36f5e5e2e9 100755 (executable)
@@ -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};