Index: trunk/src/libgrbs/regression/cvx_2_cnc.ref =================================================================== --- trunk/src/libgrbs/regression/cvx_2_cnc.ref (revision 1333) +++ trunk/src/libgrbs/regression/cvx_2_cnc.ref (nonexistent) @@ -1,25 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:3.333583 -> 2.757612 [3.333583 6.091195] - arc use=1 6.000000:6.091195 -> -2.757612 [3.333583 6.091195] tn=8 - seg concave 0: - arc use=0 2.000000:-2.677945 -> 0.643501 [-2.677945 -2.034444] - arc use=1 11.000000:-2.677945 -> 0.643501 [-2.677945 -2.034444] tn=13 - seg concave 1: - arc use=0 2.000000:-1.107149 -> 0.643501 [-1.107149 -0.463648] - arc use=1 11.000000:-1.107149 -> 0.643501 [-1.107149 -0.463648] tn=18 - pt 40.000000;70.000000 cop;clr=2.000000;2.000000 - pt 60.000000;70.000000 cop;clr=2.000000;2.000000 - pt 30.000000;40.000000 cop;clr=2.000000;2.000000 - pt 40.000000;30.000000 cop;clr=2.000000;2.000000 - pt 70.000000;40.000000 cop;clr=2.000000;2.000000 - pt 60.000000;30.000000 cop;clr=2.000000;2.000000 - arc use=1 center=60.000000;70.000000 r=0.000000 a=-1.762787;0.000000 - arc use=1 center=50.000000;50.000000 r=6.000000 a=6.091195;-2.757612 - arc use=1 center=40.000000;70.000000 r=0.000000 a=-1.378806;0.000000 - arc use=1 center=30.000000;40.000000 r=0.000000 a=0.463648;0.000000 - arc use=1 center=50.000000;50.000000 r=11.000000 a=-2.677945;0.643501 - arc use=1 center=40.000000;30.000000 r=0.000000 a=1.107149;0.000000 - arc use=1 center=60.000000;30.000000 r=0.000000 a=2.034444;0.000000 - arc use=1 center=50.000000;50.000000 r=11.000000 a=-1.107149;0.643501 - arc use=1 center=70.000000;40.000000 r=0.000000 a=2.677945;0.000000 Index: trunk/src/libgrbs/regression/concave6.ref =================================================================== --- trunk/src/libgrbs/regression/concave6.ref (revision 1333) +++ trunk/src/libgrbs/regression/concave6.ref (nonexistent) @@ -1,22 +0,0 @@ - pt 100.000000;100.000000 cop;clr=4.000000;4.000000 - seg concave 0: - arc use=0 4.000000:0.815606 -> 1.427956 [0.815606 2.243562] - arc use=1 12.000000:0.815606 -> 1.427956 [0.815606 2.243562] tn=7 - arc use=1 22.000000:2.034444 -> -1.106800 [0.927644 2.034444] tn=14 - pt 60.000000;160.000000 cop;clr=4.000000;4.000000 - pt 70.000000;160.000000 cop;clr=4.000000;4.000000 - pt 140.000000;160.000000 cop;clr=4.000000;4.000000 - seg convex 0: - arc use=0 4.000000:-1.078988 -> 1.722489 [-1.078988 0.643501] - arc use=1 12.000000:-1.078988 -> 1.722489 [-1.078988 0.643501] tn=14 - arc use=1 22.000000:0.677028 -> -1.575058 [-0.898030 0.677028] tn=7 - pt 120.000000;220.000000 cop;clr=4.000000;4.000000 - pt 110.000000;220.000000 cop;clr=4.000000;4.000000 - arc use=1 center=120.000000;220.000000 r=0.000000 a=-0.893768;0.000000 - arc use=1 center=140.000000;160.000000 r=22.000000 a=0.677028;-1.575058 - arc use=1 center=100.000000;100.000000 r=12.000000 a=0.815606;1.427956 - arc use=1 center=60.000000;160.000000 r=0.000000 a=-0.982794;0.000000 - arc use=1 center=70.000000;160.000000 r=0.000000 a=-1.107149;0.000000 - arc use=1 center=100.000000;100.000000 r=22.000000 a=2.034444;-1.106800 - arc use=1 center=140.000000;160.000000 r=12.000000 a=-1.078988;1.722489 - arc use=1 center=110.000000;220.000000 r=0.000000 a=-0.927295;0.000000 Index: trunk/src/libgrbs/regression/both_sides.grbs =================================================================== --- trunk/src/libgrbs/regression/both_sides.grbs (revision 1333) +++ trunk/src/libgrbs/regression/both_sides.grbs (nonexistent) @@ -1,6 +0,0 @@ - point_new P1 50 10 2 1 - point_new Pm 50 30 2 1 - point_new P2 50 60 2 1 - - 2net_new n2 1 1 from P1 cw Pm to P2 - 2net_new n3 1 1 from P1 ccw Pm to P2 Index: trunk/src/libgrbs/regression/concave7.ref =================================================================== --- trunk/src/libgrbs/regression/concave7.ref (revision 1333) +++ trunk/src/libgrbs/regression/concave7.ref (nonexistent) @@ -1,22 +0,0 @@ - pt 100.000000;100.000000 cop;clr=4.000000;4.000000 - seg concave 0: - arc use=0 4.000000:0.815606 -> 1.343193 [0.815606 2.158799] - arc use=1 12.000000:0.815606 -> 1.343193 [0.815606 2.158799] tn=14 - arc use=1 22.000000:2.034444 -> -1.218838 [0.815606 2.034444] tn=7 - pt 60.000000;160.000000 cop;clr=4.000000;4.000000 - pt 70.000000;160.000000 cop;clr=4.000000;4.000000 - pt 140.000000;160.000000 cop;clr=4.000000;4.000000 - seg convex 0: - arc use=0 4.000000:-0.755190 -> 1.398692 [-0.755190 0.643501] - arc use=1 12.000000:-0.755190 -> 1.398692 [-0.755190 0.643501] tn=7 - arc use=1 22.000000:6.960213 -> -1.756016 [5.204197 6.960213] tn=14 - pt 120.000000;220.000000 cop;clr=4.000000;4.000000 - pt 110.000000;220.000000 cop;clr=4.000000;4.000000 - arc use=1 center=70.000000;160.000000 r=0.000000 a=-1.107149;0.000000 - arc use=1 center=100.000000;100.000000 r=22.000000 a=2.034444;-1.218838 - arc use=1 center=140.000000;160.000000 r=12.000000 a=-0.755190;1.398692 - arc use=1 center=110.000000;220.000000 r=0.000000 a=-0.927295;0.000000 - arc use=1 center=120.000000;220.000000 r=0.000000 a=-0.893768;0.000000 - arc use=1 center=140.000000;160.000000 r=22.000000 a=6.960213;-1.756016 - arc use=1 center=100.000000;100.000000 r=12.000000 a=0.815606;1.343193 - arc use=1 center=60.000000;160.000000 r=0.000000 a=-0.982794;0.000000 Index: trunk/src/libgrbs/regression/concave8.ref =================================================================== --- trunk/src/libgrbs/regression/concave8.ref (revision 1333) +++ trunk/src/libgrbs/regression/concave8.ref (nonexistent) @@ -1,22 +0,0 @@ - pt 100.000000;100.000000 cop;clr=4.000000;4.000000 - seg concave 0: - arc use=0 4.000000:0.815606 -> 1.427956 [0.815606 2.243562] - arc use=1 12.000000:0.815606 -> 1.427956 [0.815606 2.243562] tn=7 - arc use=1 22.000000:0.815606 -> 1.218838 [0.815606 2.034444] tn=14 - pt 60.000000;160.000000 cop;clr=4.000000;4.000000 - pt 70.000000;160.000000 cop;clr=4.000000;4.000000 - pt 140.000000;160.000000 cop;clr=4.000000;4.000000 - seg convex 0: - arc use=0 4.000000:5.204197 -> 1.722489 [5.204197 6.926686] - arc use=1 12.000000:6.926686 -> -1.722489 [5.204197 6.926686] tn=14 - arc use=1 22.000000:0.677028 -> -1.575058 [-0.898030 0.677028] tn=7 - pt 120.000000;220.000000 cop;clr=4.000000;4.000000 - pt 110.000000;220.000000 cop;clr=4.000000;4.000000 - arc use=1 center=120.000000;220.000000 r=0.000000 a=-0.893768;0.000000 - arc use=1 center=140.000000;160.000000 r=22.000000 a=0.677028;-1.575058 - arc use=1 center=100.000000;100.000000 r=12.000000 a=0.815606;1.427956 - arc use=1 center=60.000000;160.000000 r=0.000000 a=-0.982794;0.000000 - arc use=1 center=110.000000;220.000000 r=0.000000 a=-0.927295;0.000000 - arc use=1 center=140.000000;160.000000 r=12.000000 a=6.926686;-1.722489 - arc use=1 center=100.000000;100.000000 r=22.000000 a=0.815606;1.218838 - arc use=1 center=70.000000;160.000000 r=0.000000 a=-1.107149;0.000000 Index: trunk/src/libgrbs/regression/debug_draw.sgrbs =================================================================== --- trunk/src/libgrbs/regression/debug_draw.sgrbs (revision 1333) +++ trunk/src/libgrbs/regression/debug_draw.sgrbs (nonexistent) @@ -1,42 +0,0 @@ -# svg test drawing primitives - -svg_begin svg1 debug_draw.svg - -fill_circle svg1 5 5 2 red -wf_circle svg1 5 5 3 blue - -fill_line svg1 50 50 30 71 1 red -wf_line svg1 50 50 30 71 2 blue - -fill_arc svg1 60 60 5 0 0.5 1 red -fill_arc svg1 60 80 5 0 0.8 1 red -fill_arc svg1 60 100 5 0 2 1 red -fill_arc svg1 60 120 5 0 5 1 red - -fill_arc svg1 30 60 5 0 -0.5 1 red -fill_arc svg1 30 80 5 0 -0.8 1 red -fill_arc svg1 30 100 5 0 -2 1 red -fill_arc svg1 30 120 5 0 -5 1 red - -fill_arc svg1 90 60 5 4 -0.5 1 red -fill_arc svg1 90 80 5 4 -0.8 1 red -fill_arc svg1 90 100 5 4 -2 1 red -fill_arc svg1 90 120 5 4 -5 1 red - - -wf_arc svg1 60 60 5 0 0.5 2 blue -wf_arc svg1 60 80 5 0 0.8 2 blue -wf_arc svg1 60 100 5 0 2 2 blue -wf_arc svg1 60 120 5 0 5 2 blue - -wf_arc svg1 30 60 5 0 -0.5 2 blue -wf_arc svg1 30 80 5 0 -0.8 2 blue -wf_arc svg1 30 100 5 0 -2 2 blue -wf_arc svg1 30 120 5 0 -5 2 blue - -wf_arc svg1 90 60 5 4 -0.5 2 blue -wf_arc svg1 90 80 5 4 -0.8 2 blue -wf_arc svg1 90 100 5 4 -2 2 blue -wf_arc svg1 90 120 5 4 -5 2 blue - -svg_end svg1 Index: trunk/src/libgrbs/regression/concave9.ref =================================================================== --- trunk/src/libgrbs/regression/concave9.ref (revision 1333) +++ trunk/src/libgrbs/regression/concave9.ref (nonexistent) @@ -1,22 +0,0 @@ - pt 100.000000;100.000000 cop;clr=4.000000;4.000000 - seg concave 0: - arc use=0 4.000000:0.815606 -> 1.343193 [0.815606 2.158799] - arc use=1 12.000000:0.815606 -> 1.343193 [0.815606 2.158799] tn=14 - arc use=1 22.000000:0.815606 -> 1.218838 [0.815606 2.034444] tn=7 - pt 60.000000;160.000000 cop;clr=4.000000;4.000000 - pt 70.000000;160.000000 cop;clr=4.000000;4.000000 - pt 140.000000;160.000000 cop;clr=4.000000;4.000000 - seg convex 0: - arc use=0 4.000000:5.527995 -> 1.398692 [5.527995 6.926686] - arc use=1 12.000000:6.926686 -> -1.398692 [5.527995 6.926686] tn=7 - arc use=1 22.000000:6.960213 -> -1.756016 [5.204197 6.960213] tn=14 - pt 120.000000;220.000000 cop;clr=4.000000;4.000000 - pt 110.000000;220.000000 cop;clr=4.000000;4.000000 - arc use=1 center=110.000000;220.000000 r=0.000000 a=-0.927295;0.000000 - arc use=1 center=140.000000;160.000000 r=12.000000 a=6.926686;-1.398692 - arc use=1 center=100.000000;100.000000 r=22.000000 a=0.815606;1.218838 - arc use=1 center=70.000000;160.000000 r=0.000000 a=-1.107149;0.000000 - arc use=1 center=120.000000;220.000000 r=0.000000 a=-0.893768;0.000000 - arc use=1 center=140.000000;160.000000 r=22.000000 a=6.960213;-1.756016 - arc use=1 center=100.000000;100.000000 r=12.000000 a=0.815606;1.343193 - arc use=1 center=60.000000;160.000000 r=0.000000 a=-0.982794;0.000000 Index: trunk/src/libgrbs/regression/cross_arc_inc1.grbs =================================================================== --- trunk/src/libgrbs/regression/cross_arc_inc1.grbs (revision 1333) +++ trunk/src/libgrbs/regression/cross_arc_inc1.grbs (nonexistent) @@ -1,22 +0,0 @@ - -# center point -point_new pc 50 50 2 5 - -# abow and below point -point_new pa 50 30 2 5 -point_new pb 50 70 2 5 - -# for the arc -point_new p1 30 70 2 5 -point_new p2 70 70 2 5 - -# draw the arc as n1 -2net_new n1 1 1 from p1 cw pc to p2 - -# these two shall fail, crossing the arc from each direction -fail 2net_new n2 1 1 from pa to pc -fail 2net_new n3 1 1 from pc to pa - -# this one should work as it is going in the opposite direction (not crossing) -2net_new n4 1 1 from pb to pc - Index: trunk/src/libgrbs/regression/spiral.grbs =================================================================== --- trunk/src/libgrbs/regression/spiral.grbs (revision 1333) +++ trunk/src/libgrbs/regression/spiral.grbs (nonexistent) @@ -1,8 +0,0 @@ -point_new P1 10 10 2 1 -point_new P2 30 10 2 1 -point_new P3 50 10 2 1 -point_new P4 20 50 2 1 - -# fails because of spiraling (shorter path exists) -fail 2net_new n1 1 1 from P1 cw P2 cw P3 cw P4 cw P1 cw P2 - Index: trunk/src/libgrbs/regression/two_orbits1.ref =================================================================== --- trunk/src/libgrbs/regression/two_orbits1.ref (revision 1333) +++ trunk/src/libgrbs/regression/two_orbits1.ref (nonexistent) @@ -1,15 +0,0 @@ - pt 30.000000;20.000000 cop;clr=2.000000;1.000000 - seg convex 0: - arc use=0 2.000000:3.425387 -> 2.574004 [3.425387 5.999391] - arc use=1 4.000000:5.999391 -> -2.574004 [3.425387 5.999391] tn=6 - arc use=1 7.000000:5.923478 -> -2.422179 [3.501300 5.923478] tn=11 - pt 20.000000;40.000000 cop;clr=2.000000;1.000000 - pt 40.000000;40.000000 cop;clr=2.000000;1.000000 - pt 15.000000;40.000000 cop;clr=2.000000;1.000000 - pt 45.000000;40.000000 cop;clr=2.000000;1.000000 - arc use=1 center=40.000000;40.000000 r=0.000000 a=-1.854590;0.000000 - arc use=1 center=30.000000;20.000000 r=4.000000 a=5.999391;-2.574004 - arc use=1 center=20.000000;40.000000 r=0.000000 a=-1.287002;0.000000 - arc use=1 center=45.000000;40.000000 r=0.000000 a=-1.930503;0.000000 - arc use=1 center=30.000000;20.000000 r=7.000000 a=5.923478;-2.422179 - arc use=1 center=15.000000;40.000000 r=0.000000 a=-1.211089;0.000000 Index: trunk/src/libgrbs/regression/two_orbits2.ref =================================================================== --- trunk/src/libgrbs/regression/two_orbits2.ref (revision 1333) +++ trunk/src/libgrbs/regression/two_orbits2.ref (nonexistent) @@ -1,15 +0,0 @@ - pt 30.000000;20.000000 cop;clr=2.000000;1.000000 - seg convex 0: - arc use=0 2.000000:3.425387 -> 2.574004 [3.425387 5.999391] - arc use=1 4.000000:5.999391 -> -2.574004 [3.425387 5.999391] tn=11 - arc use=1 7.000000:5.923478 -> -2.422179 [3.501300 5.923478] tn=6 - pt 20.000000;40.000000 cop;clr=2.000000;1.000000 - pt 40.000000;40.000000 cop;clr=2.000000;1.000000 - pt 15.000000;40.000000 cop;clr=2.000000;1.000000 - pt 45.000000;40.000000 cop;clr=2.000000;1.000000 - arc use=1 center=45.000000;40.000000 r=0.000000 a=-1.930503;0.000000 - arc use=1 center=30.000000;20.000000 r=7.000000 a=5.923478;-2.422179 - arc use=1 center=15.000000;40.000000 r=0.000000 a=-1.211089;0.000000 - arc use=1 center=40.000000;40.000000 r=0.000000 a=-1.854590;0.000000 - arc use=1 center=30.000000;20.000000 r=4.000000 a=5.999391;-2.574004 - arc use=1 center=20.000000;40.000000 r=0.000000 a=-1.287002;0.000000 Index: trunk/src/libgrbs/regression/convex_cross2.grbs =================================================================== --- trunk/src/libgrbs/regression/convex_cross2.grbs (revision 1333) +++ trunk/src/libgrbs/regression/convex_cross2.grbs (nonexistent) @@ -1,16 +0,0 @@ -# refuse to route convex CCW with crossing exit lines - -point_new P0b 20 40 2 2 - -point_new P3a 5 60 2 2 -point_new P3b 40 60 2 2 - - -echo "---GOOD:" -2net_new n3 1 3 from P3a cw P0b to P3b - -echo "---BAD:" -fail 2net_new n3 1 3 from P3a ccw P0b to P3b - - - Index: trunk/src/libgrbs/regression/straight-ccw.grbs =================================================================== --- trunk/src/libgrbs/regression/straight-ccw.grbs (revision 1333) +++ trunk/src/libgrbs/regression/straight-ccw.grbs (nonexistent) @@ -1,15 +0,0 @@ -# straight tangential (0 degree arc) go-arounds and a 180 degree go-around - -point_new P1a 50 50 2 2 -point_new P1b 50 100 2 2 - -point_new P2a 50 20 2 2 -point_new P2b 50 30 2 2 - - -# indifferent blocker -2net_new n1 1 3 from P1a to P1b - -#ccw -2net_new n2 1 3 from P2a ccw P2b ccw P1a ccw P1b ccw P1a ccw P2b - Index: trunk/src/libgrbs/regression/paral1.ref =================================================================== --- trunk/src/libgrbs/regression/paral1.ref (revision 1333) +++ trunk/src/libgrbs/regression/paral1.ref (nonexistent) @@ -1,22 +0,0 @@ - pt 20.000000;55.000000 cop;clr=2.000000;2.000000 - pt 20.000000;45.000000 cop;clr=2.000000;2.000000 - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:4.348659 -> 1.934526 [4.348659 6.283185] - arc use=1 6.000000:6.283185 -> -1.934526 [4.348659 6.283185] tn=7 - arc use=1 11.000000:6.283185 -> -1.775715 [4.507471 6.283185] tn=14 - pt 50.000000;70.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:0.000000 -> 1.934526 [0.000000 1.934526] - arc use=1 6.000000:1.934526 -> -1.934526 [0.000000 1.934526] tn=7 - arc use=1 11.000000:1.775715 -> -1.775715 [0.000000 1.775715] tn=14 - pt 20.000000;65.000000 cop;clr=2.000000;2.000000 - pt 20.000000;75.000000 cop;clr=2.000000;2.000000 - arc use=1 center=20.000000;65.000000 r=0.000000 a=0.363730;0.000000 - arc use=1 center=50.000000;70.000000 r=6.000000 a=1.934526;-1.934526 - arc use=1 center=50.000000;50.000000 r=6.000000 a=6.283185;-1.934526 - arc use=1 center=20.000000;55.000000 r=0.000000 a=-0.363730;0.000000 - arc use=1 center=20.000000;75.000000 r=0.000000 a=0.204918;0.000000 - arc use=1 center=50.000000;70.000000 r=11.000000 a=1.775715;-1.775715 - arc use=1 center=50.000000;50.000000 r=11.000000 a=6.283185;-1.775715 - arc use=1 center=20.000000;45.000000 r=0.000000 a=-0.204918;0.000000 Index: trunk/src/libgrbs/regression/concave2.grbs =================================================================== --- trunk/src/libgrbs/regression/concave2.grbs (revision 1333) +++ trunk/src/libgrbs/regression/concave2.grbs (nonexistent) @@ -1,17 +0,0 @@ -# The radius of n2 is going to be updated because of n1 insertion. Angles -# won't change (concave test case) - -point_new P0 50 50 2 2 - -point_new P1a 30 80 2 2 -point_new P1b 70 80 2 2 - -point_new P2a 40 110 2 2 -point_new P2b 60 110 2 2 - - - -# original concave tests -2net_new n2 1 3 from P2a concave ccw P0 to P2b -2net_new n1 1 3 from P1a concave ccw P0 to P1b - Index: trunk/src/libgrbs/regression/paral2.ref =================================================================== --- trunk/src/libgrbs/regression/paral2.ref (revision 1333) +++ trunk/src/libgrbs/regression/paral2.ref (nonexistent) @@ -1,22 +0,0 @@ - pt 20.000000;55.000000 cop;clr=2.000000;2.000000 - pt 20.000000;45.000000 cop;clr=2.000000;2.000000 - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:4.348659 -> 1.934526 [4.348659 6.283185] - arc use=1 6.000000:6.283185 -> -1.934526 [4.348659 6.283185] tn=14 - arc use=1 11.000000:0.000000 -> -1.775715 [-1.775715 0.000000] tn=7 - pt 50.000000;70.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:0.000000 -> 1.934526 [0.000000 1.934526] - arc use=1 6.000000:1.934526 -> -1.934526 [0.000000 1.934526] tn=14 - arc use=1 11.000000:1.775715 -> -1.775715 [0.000000 1.775715] tn=7 - pt 20.000000;65.000000 cop;clr=2.000000;2.000000 - pt 20.000000;75.000000 cop;clr=2.000000;2.000000 - arc use=1 center=20.000000;75.000000 r=0.000000 a=0.204918;0.000000 - arc use=1 center=50.000000;70.000000 r=11.000000 a=1.775715;-1.775715 - arc use=1 center=50.000000;50.000000 r=11.000000 a=0.000000;-1.775715 - arc use=1 center=20.000000;45.000000 r=0.000000 a=-0.204918;0.000000 - arc use=1 center=20.000000;65.000000 r=0.000000 a=0.363730;0.000000 - arc use=1 center=50.000000;70.000000 r=6.000000 a=1.934526;-1.934526 - arc use=1 center=50.000000;50.000000 r=6.000000 a=6.283185;-1.934526 - arc use=1 center=20.000000;55.000000 r=0.000000 a=-0.363730;0.000000 Index: trunk/src/libgrbs/regression/paral3.ref =================================================================== --- trunk/src/libgrbs/regression/paral3.ref (revision 1333) +++ trunk/src/libgrbs/regression/paral3.ref (nonexistent) @@ -1,30 +0,0 @@ - pt 20.000000;58.000000 cop;clr=2.000000;2.000000 - pt 20.000000;42.000000 cop;clr=2.000000;2.000000 - pt 20.000000;50.000000 cop;clr=2.000000;2.000000 - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:4.257316 -> 2.025869 [4.257316 6.283185] - arc use=1 6.000000:6.283185 -> -2.025869 [4.257316 6.283185] tn=16 - arc use=1 11.000000:6.283185 -> -1.946220 [4.336965 6.283185] tn=21 - arc use=1 16.000000:0.000000 -> -1.851581 [-1.851581 0.000000] tn=9 - pt 50.000000;70.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:0.000000 -> 2.025869 [0.000000 2.025869] - arc use=1 6.000000:2.025869 -> -2.025869 [0.000000 2.025869] tn=16 - arc use=1 11.000000:1.946220 -> -1.946220 [0.000000 1.946220] tn=21 - arc use=1 16.000000:1.851581 -> -1.851581 [0.000000 1.851581] tn=9 - pt 20.000000;62.000000 cop;clr=2.000000;2.000000 - pt 20.000000;78.000000 cop;clr=2.000000;2.000000 - pt 20.000000;70.000000 cop;clr=2.000000;2.000000 - arc use=1 center=20.000000;78.000000 r=0.000000 a=0.280785;0.000000 - arc use=1 center=50.000000;70.000000 r=16.000000 a=1.851581;-1.851581 - arc use=1 center=50.000000;50.000000 r=16.000000 a=0.000000;-1.851581 - arc use=1 center=20.000000;42.000000 r=0.000000 a=-0.280785;0.000000 - arc use=1 center=20.000000;62.000000 r=0.000000 a=0.455073;0.000000 - arc use=1 center=50.000000;70.000000 r=6.000000 a=2.025869;-2.025869 - arc use=1 center=50.000000;50.000000 r=6.000000 a=6.283185;-2.025869 - arc use=1 center=20.000000;58.000000 r=0.000000 a=-0.455073;0.000000 - arc use=1 center=20.000000;70.000000 r=0.000000 a=0.375424;0.000000 - arc use=1 center=50.000000;70.000000 r=11.000000 a=1.946220;-1.946220 - arc use=1 center=50.000000;50.000000 r=11.000000 a=6.283185;-1.946220 - arc use=1 center=20.000000;50.000000 r=0.000000 a=-0.375424;0.000000 Index: trunk/src/libgrbs/regression/both_sides.ref =================================================================== --- trunk/src/libgrbs/regression/both_sides.ref (revision 1333) +++ trunk/src/libgrbs/regression/both_sides.ref (nonexistent) @@ -1,15 +0,0 @@ - pt 50.000000;10.000000 cop;clr=2.000000;1.000000 - pt 50.000000;30.000000 cop;clr=2.000000;1.000000 - seg convex 0: - arc use=0 2.000000:6.081827 -> 0.335090 [6.081827 6.416917] - arc use=1 4.000000:6.416917 -> -0.335090 [6.081827 6.416917] tn=4 - seg convex 1: - arc use=0 2.000000:3.007861 -> 0.335090 [3.007861 3.342951] - arc use=1 4.000000:3.007861 -> 0.335090 [3.007861 3.342951] tn=9 - pt 50.000000;60.000000 cop;clr=2.000000;1.000000 - arc use=1 center=50.000000;60.000000 r=0.000000 a=-1.437065;0.000000 - arc use=1 center=50.000000;30.000000 r=4.000000 a=6.416917;-0.335090 - arc use=1 center=50.000000;10.000000 r=0.000000 a=1.369438;0.000000 - arc use=1 center=50.000000;60.000000 r=0.000000 a=-1.704528;0.000000 - arc use=1 center=50.000000;30.000000 r=4.000000 a=3.007861;0.335090 - arc use=1 center=50.000000;10.000000 r=0.000000 a=1.772154;0.000000 Index: trunk/src/libgrbs/regression/pp_cnv_inc4.grbs =================================================================== --- trunk/src/libgrbs/regression/pp_cnv_inc4.grbs (revision 1333) +++ trunk/src/libgrbs/regression/pp_cnv_inc4.grbs (nonexistent) @@ -1,18 +0,0 @@ - -# point_new -point_new P0 100 -100 4 4 - -point_new P1a 20 -160 4 4 -point_new P2a 70 -160 4 4 -point_new P3a 70 -200 4 4 -point_new P2b 160 -160 4 4 -point_new P3b 160 -200 4 4 -point_new P1b 170 -160 4 4 - - -# original ordering -2net_new ninc 0.6 3 from P2a to P0 -2net_new nconc 2.6 6 from P1a cw P2a concave cw P0 to P2b -#2net_new nconc 2.6 6 from P2b concave cw P0 concave cw P2a to P3a -pp_concave - Index: trunk/src/libgrbs/regression/cvx_2_cnc.grbs =================================================================== --- trunk/src/libgrbs/regression/cvx_2_cnc.grbs (revision 1333) +++ trunk/src/libgrbs/regression/cvx_2_cnc.grbs (nonexistent) @@ -1,18 +0,0 @@ -# The incident angle of n1 is going to be updated because of n2 bumping -# the radius of n1's arc around P0b - -point_new P0 50 50 2 2 - -point_new P1a 40 70 2 2 -point_new P1b 60 70 2 2 - -point_new P2a 30 40 2 2 -point_new P2b 40 30 2 2 - -point_new P2c 70 40 2 2 -point_new P2d 60 30 2 2 - -2net_new n_convex 1 3 from P1a cw P0 to P1b -2net_new n_concave1 1 3 from P2b concave ccw P0 to P2a -2net_new n_concave2 1 3 from P2c concave ccw P0 to P2d - Index: trunk/src/libgrbs/regression/concave6.grbs =================================================================== --- trunk/src/libgrbs/regression/concave6.grbs (revision 1333) +++ trunk/src/libgrbs/regression/concave6.grbs (nonexistent) @@ -1,14 +0,0 @@ - -# point_new -point_new P0 100 100 4 4 - -point_new P1a 60 160 4 4 -point_new P3a 70 160 4 4 -point_new P1b 140 160 4 4 - -point_new P2 120 220 4 4 -point_new P2c 110 220 4 4 - -######## -2net_new n1 2 6 from P1a concave ccw P0 cw P1b to P2 -2net_new n2 2 6 from P2c ccw P1b concave cw P0 to P3a Index: trunk/src/libgrbs/regression/guide_cross.grbs =================================================================== --- trunk/src/libgrbs/regression/guide_cross.grbs (revision 1333) +++ trunk/src/libgrbs/regression/guide_cross.grbs (nonexistent) @@ -1,13 +0,0 @@ -# parallel routes, second route is topo-guided, but with a CW -> CCW change - -point_new Ps1 20 55 2 2 -point_new Ps2 20 45 2 2 - -point_new Pm1 50 50 2 2 -point_new Pm2 50 70 2 2 - -point_new Pt2 80 65 2 2 -point_new Pt1 80 75 2 2 - -2net_new Ninner 1 3 from Ps1 cw Pm1 ccw Pm2 to Pt1 -2net_new Nouter 1 3 from Ps2 cw Pm1 ccw Pm2 to Pt2 Index: trunk/src/libgrbs/regression/topo-inc.ref =================================================================== --- trunk/src/libgrbs/regression/topo-inc.ref (revision 1333) +++ trunk/src/libgrbs/regression/topo-inc.ref (nonexistent) @@ -1,19 +0,0 @@ - pt 20.000000;100.000000 cop;clr=5.000000;2.000000 - pt 50.000000;100.000000 cop;clr=5.000000;2.000000 - seg convex 0: - arc use=0 5.000000:3.900644 -> 2.708271 [3.900644 6.608915] - arc use=1 8.000000:6.608915 -> -2.708271 [3.900644 6.608915] tn=11 - arc use=1 11.000000:0.221814 -> -2.168034 [-1.946220 0.221814] tn=6 - pt 50.000000;150.000000 cop;clr=5.000000;2.000000 - seg convex 0: - arc use=0 5.000000:1.300864 -> 2.166459 [1.300864 3.467322] - arc use=1 8.000000:1.300864 -> 2.166459 [1.300864 3.467322] tn=11 - pt 20.000000;120.000000 cop;clr=5.000000;2.000000 - pt 80.000000;150.000000 cop;clr=5.000000;2.000000 - arc use=1 center=50.000000;150.000000 r=0.000000 a=-1.348982;0.000000 - arc use=1 center=50.000000;100.000000 r=11.000000 a=0.221814;-2.168034 - arc use=1 center=20.000000;100.000000 r=0.000000 a=-0.375424;0.000000 - arc use=1 center=80.000000;150.000000 r=0.000000 a=2.871660;0.000000 - arc use=1 center=50.000000;150.000000 r=8.000000 a=1.300864;2.166459 - arc use=1 center=50.000000;100.000000 r=8.000000 a=6.608915;-2.708271 - arc use=1 center=20.000000;120.000000 r=0.000000 a=-0.811745;0.000000 Index: trunk/src/libgrbs/regression/around1.grbs =================================================================== --- trunk/src/libgrbs/regression/around1.grbs (revision 1333) +++ trunk/src/libgrbs/regression/around1.grbs (nonexistent) @@ -1,7 +0,0 @@ -point_new P1 10 10 2 1 -point_new P2 30 10 2 1 -point_new P3 50 10 2 1 -point_new P4 20 50 2 1 - -2net_new n1 1 1 from P1 cw P2 to P4 -2net_new n2 1 1 from P2 ccw P4 to P3 Index: trunk/src/libgrbs/regression/conc_around1.grbs =================================================================== --- trunk/src/libgrbs/regression/conc_around1.grbs (revision 1333) +++ trunk/src/libgrbs/regression/conc_around1.grbs (nonexistent) @@ -1,18 +0,0 @@ -# concave -> convex arc-to-arc cases - -point_new P0 50 50 2 2 - -point_new P1a 30 80 2 2 -point_new P1b 70 80 2 2 - -point_new P2a 40 75 2 2 -point_new P2b 70 80 2 2 - -point_new P2 60 110 2 2 - - - -# arc2arc -2net_new n1 1 3 from P1a concave ccw P0 cw P1b to P2 -2net_new n2 1 3 from P2a concave ccw P0 concave ccw P2b ccw P2 ccw P1b ccw P0 ccw P1a - Index: trunk/src/libgrbs/regression/straight-cw.ref =================================================================== --- trunk/src/libgrbs/regression/straight-cw.ref (revision 1333) +++ trunk/src/libgrbs/regression/straight-cw.ref (nonexistent) @@ -1,27 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:0.000000 -> -0.000000 [0.000000 0.000000] - arc use=1 6.000000:0.000000 -> -0.000000 [0.000000 0.000000] tn=8 - seg convex 1: - arc use=0 2.000000:3.141593 -> -0.000000 [3.141593 3.141593] - arc use=1 6.000000:3.141593 -> -0.000000 [3.141593 3.141593] tn=8 - pt 50.000000;100.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:0.000000 -> 3.141593 [0.000000 3.141593] - arc use=1 6.000000:3.141593 -> -3.141593 [0.000000 3.141593] tn=8 - pt 50.000000;20.000000 cop;clr=2.000000;2.000000 - pt 50.000000;30.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:5.639684 -> 0.643501 [5.639684 6.283185] - arc use=1 6.000000:6.283185 -> -0.643501 [5.639684 6.283185] tn=8 - seg convex 1: - arc use=0 2.000000:3.141593 -> -0.000000 [3.141593 3.141593] - arc use=1 6.000000:3.141593 -> -0.000000 [3.141593 3.141593] tn=8 - arc use=1 center=50.000000;100.000000 r=0.000000 a=-1.570796;0.000000 - arc use=1 center=50.000000;50.000000 r=0.000000 a=1.570796;0.000000 - arc use=1 center=50.000000;30.000000 r=6.000000 a=3.141593;-0.000000 - arc use=1 center=50.000000;50.000000 r=6.000000 a=3.141593;-0.000000 - arc use=1 center=50.000000;100.000000 r=6.000000 a=3.141593;-3.141593 - arc use=1 center=50.000000;50.000000 r=6.000000 a=0.000000;-0.000000 - arc use=1 center=50.000000;30.000000 r=6.000000 a=6.283185;-0.643501 - arc use=1 center=50.000000;20.000000 r=0.000000 a=0.927295;0.000000 Index: trunk/src/libgrbs/regression/two_orbits1.grbs =================================================================== --- trunk/src/libgrbs/regression/two_orbits1.grbs (revision 1333) +++ trunk/src/libgrbs/regression/two_orbits1.grbs (nonexistent) @@ -1,8 +0,0 @@ -point_new P0 30 20 2 1 -point_new P1a 20 40 2 1 -point_new P1b 40 40 2 1 -point_new P2a 15 40 2 1 -point_new P2b 45 40 2 1 - -2net_new n1 1 1 from P1a cw P0 to P1b -2net_new n2 1 1 from P2a cw P0 to P2b Index: trunk/src/libgrbs/regression/straight-ccw.ref =================================================================== --- trunk/src/libgrbs/regression/straight-ccw.ref (revision 1333) +++ trunk/src/libgrbs/regression/straight-ccw.ref (nonexistent) @@ -1,27 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:3.141593 -> 0.000000 [3.141593 3.141593] - arc use=1 6.000000:3.141593 -> 0.000000 [3.141593 3.141593] tn=8 - seg convex 1: - arc use=0 2.000000:0.000000 -> 0.000000 [0.000000 0.000000] - arc use=1 6.000000:0.000000 -> 0.000000 [0.000000 0.000000] tn=8 - pt 50.000000;100.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:0.000000 -> 3.141593 [0.000000 3.141593] - arc use=1 6.000000:0.000000 -> 3.141593 [0.000000 3.141593] tn=8 - pt 50.000000;20.000000 cop;clr=2.000000;2.000000 - pt 50.000000;30.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:3.141593 -> 0.643501 [3.141593 3.785094] - arc use=1 6.000000:3.141593 -> 0.643501 [3.141593 3.785094] tn=8 - seg convex 1: - arc use=0 2.000000:0.000000 -> -0.000000 [0.000000 0.000000] - arc use=1 6.000000:0.000000 -> -0.000000 [0.000000 0.000000] tn=8 - arc use=1 center=50.000000;100.000000 r=0.000000 a=-1.570796;0.000000 - arc use=1 center=50.000000;50.000000 r=0.000000 a=1.570796;0.000000 - arc use=1 center=50.000000;30.000000 r=6.000000 a=0.000000;-0.000000 - arc use=1 center=50.000000;50.000000 r=6.000000 a=0.000000;0.000000 - arc use=1 center=50.000000;100.000000 r=6.000000 a=0.000000;3.141593 - arc use=1 center=50.000000;50.000000 r=6.000000 a=3.141593;0.000000 - arc use=1 center=50.000000;30.000000 r=6.000000 a=3.141593;0.643501 - arc use=1 center=50.000000;20.000000 r=0.000000 a=2.214297;0.000000 Index: trunk/src/libgrbs/regression/paral1.grbs =================================================================== --- trunk/src/libgrbs/regression/paral1.grbs (revision 1333) +++ trunk/src/libgrbs/regression/paral1.grbs (nonexistent) @@ -1,17 +0,0 @@ -# parallel routes (second route is topo-guided by the first on its Pm1->Pm2) - -point_new Ps1 20 55 2 2 -point_new Ps2 20 45 2 2 - -point_new Pm1 50 50 2 2 -point_new Pm2 50 70 2 2 - -point_new Pt1 20 65 2 2 -point_new Pt2 20 75 2 2 - - -#point_new Px 45 60 2 2 - - -2net_new Ninner 1 3 from Ps1 cw Pm1 cw Pm2 to Pt1 -2net_new Nouter 1 3 from Ps2 cw Pm1 cw Pm2 to Pt2 Index: trunk/src/libgrbs/regression/long_convex.grbs =================================================================== --- trunk/src/libgrbs/regression/long_convex.grbs (revision 1333) +++ trunk/src/libgrbs/regression/long_convex.grbs (nonexistent) @@ -1,9 +0,0 @@ -point_new P0 50 50 2 2 - -point_new P1a 46 55 2 2 -point_new P1b 50 60 2 2 - - -# arc2arc -2net_new n1 1 3 from P1a cw P0 to P1b - Index: trunk/src/libgrbs/regression/topo-inc.grbs =================================================================== --- trunk/src/libgrbs/regression/topo-inc.grbs (revision 1333) +++ trunk/src/libgrbs/regression/topo-inc.grbs (nonexistent) @@ -1,13 +0,0 @@ -# 'new' is going under 'above', but 'above' is suddenly going incident at P3 -# This means at P3 'new' is not topo-guided. - -point_new P1 20 100 5 2 -point_new P2 50 100 5 2 -point_new P3 50 150 5 2 - -point_new P4 20 120 5 2 -point_new P5 80 150 5 2 - -2net_new above 1 1 from P1 cw P2 to P3 -2net_new new 1 1 from P4 cw P2 ccw P3 to P5 - Index: trunk/src/libgrbs/regression/detach1.ref =================================================================== --- trunk/src/libgrbs/regression/detach1.ref (revision 1333) +++ trunk/src/libgrbs/regression/detach1.ref (nonexistent) @@ -1,8 +0,0 @@ - pt 100.000000;100.000000 cop;clr=4.000000;4.000000 - seg convex 0: - arc use=0 4.000000:4.107162 -> 1.210455 [4.107162 5.317616] - arc use=1 12.000000:5.317616 -> -1.210455 [4.107162 5.317616] tn=6 - pt 50.000000;120.000000 cop;clr=4.000000;4.000000 - pt 150.000000;120.000000 cop;clr=4.000000;4.000000 - arc use=1 center=150.000000;120.000000 r=0.000000 a=-2.536365;0.000000 - arc use=1 center=100.000000;100.000000 r=12.000000 a=5.317616;-1.210455 Index: trunk/src/libgrbs/regression/detach2.ref =================================================================== --- trunk/src/libgrbs/regression/detach2.ref (revision 1333) +++ trunk/src/libgrbs/regression/detach2.ref (nonexistent) @@ -1,6 +0,0 @@ - pt 100.000000;100.000000 cop;clr=4.000000;4.000000 - pt 50.000000;120.000000 cop;clr=4.000000;4.000000 - pt 150.000000;120.000000 cop;clr=4.000000;4.000000 - pt 100.000000;60.000000 cop;clr=4.000000;4.000000 - arc use=1 center=100.000000;60.000000 r=0.000000 a=1.570796;0.000000 - arc use=1 center=100.000000;100.000000 r=0.000000 a=-1.570796;0.000000 Index: trunk/src/libgrbs/regression/cross_arc_inc2.grbs =================================================================== --- trunk/src/libgrbs/regression/cross_arc_inc2.grbs (revision 1333) +++ trunk/src/libgrbs/regression/cross_arc_inc2.grbs (nonexistent) @@ -1,21 +0,0 @@ - -# center point -point_new pc 50 50 2 5 - -# abow and below point -point_new pa 50 30 2 5 -point_new pb 50 70 2 5 - -# for the arc -point_new p1 30 70 2 5 -point_new p2 70 70 2 5 - -# draw the arc as n1 -2net_new n1 1 1 from p1 cw pc to p2 - -# these two shall fail, crossing the arc from each direction -fail 2net_new n2 1 1 from pa to pc -fail 2net_new n3 1 1 from pc to pa - -# this one should work as it is going in the opposite direction (not crossing) -2net_new n4 1 1 from pc to pb Index: trunk/src/libgrbs/regression/conc_around1.ref =================================================================== --- trunk/src/libgrbs/regression/conc_around1.ref (revision 1333) +++ trunk/src/libgrbs/regression/conc_around1.ref (nonexistent) @@ -1,37 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:3.729595 -> 1.826464 [3.729595 5.556059] - arc use=1 6.000000:3.729595 -> 1.826464 [3.729595 5.556059] tn=14 - seg concave 0: - arc use=0 2.000000:0.815606 -> 1.343193 [0.815606 2.158799] - arc use=1 6.000000:0.815606 -> 1.343193 [0.815606 2.158799] tn=7 - arc use=1 11.000000:0.982794 -> 0.968509 [0.982794 1.951303] tn=14 - pt 30.000000;80.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:3.729595 -> -0.000000 [3.729595 3.729595] - arc use=1 6.000000:3.729595 -> -0.000000 [3.729595 3.729595] tn=14 - pt 70.000000;80.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:5.527995 -> 1.267835 [5.527995 6.795830] - arc use=1 6.000000:6.795830 -> -1.267835 [5.527995 6.795830] tn=7 - arc use=1 11.000000:-0.727126 -> 1.207657 [-0.727126 0.480531] tn=14 - pt 40.000000;75.000000 cop;clr=2.000000;2.000000 - pt 70.000000;80.000000 cop;clr=2.000000;2.000000 - seg concave 0: - arc use=0 2.000000:-4.199744 -> 2.040946 [-4.199744 -2.158799] - arc use=1 6.000000:-4.199744 -> 2.040946 [-4.199744 -2.158799] tn=14 - pt 60.000000;110.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:0.480531 -> 3.173706 [0.480531 3.654237] - arc use=1 6.000000:0.480531 -> 3.173706 [0.480531 3.654237] tn=14 - arc use=1 center=60.000000;110.000000 r=0.000000 a=-1.058152;0.000000 - arc use=1 center=70.000000;80.000000 r=6.000000 a=6.795830;-1.267835 - arc use=1 center=50.000000;50.000000 r=6.000000 a=0.815606;1.343193 - arc use=1 center=30.000000;80.000000 r=0.000000 a=-0.982794;0.000000 - arc use=1 center=30.000000;80.000000 r=6.000000 a=3.729595;-0.000000 - arc use=1 center=50.000000;50.000000 r=6.000000 a=3.729595;1.826464 - arc use=1 center=70.000000;80.000000 r=11.000000 a=-0.727126;1.207657 - arc use=1 center=60.000000;110.000000 r=6.000000 a=0.480531;3.173706 - arc use=1 center=70.000000;80.000000 r=6.000000 a=-4.199744;2.040946 - arc use=1 center=50.000000;50.000000 r=11.000000 a=0.982794;0.968509 - arc use=1 center=40.000000;75.000000 r=0.000000 a=-1.190290;0.000000 Index: trunk/src/libgrbs/regression/straight-cw.grbs =================================================================== --- trunk/src/libgrbs/regression/straight-cw.grbs (revision 1333) +++ trunk/src/libgrbs/regression/straight-cw.grbs (nonexistent) @@ -1,15 +0,0 @@ -# straight tangential (0 degree arc) go-arounds and a 180 degree go-around - -point_new P1a 50 50 2 2 -point_new P1b 50 100 2 2 - -point_new P2a 50 20 2 2 -point_new P2b 50 30 2 2 - - -# indifferent blocker -2net_new n1 1 3 from P1a to P1b - -#cw -2net_new n2 1 3 from P2a cw P2b cw P1a cw P1b cw P1a cw P2b - Index: trunk/src/libgrbs/regression/Test.sh =================================================================== --- trunk/src/libgrbs/regression/Test.sh (revision 1333) +++ trunk/src/libgrbs/regression/Test.sh (nonexistent) @@ -1,40 +0,0 @@ -#!/bin/sh - -RETVAL=0 -TESTER=../tester -extra=-s - -test_file() -{ - local fn="$1" - local bn=${fn%%.grbs} - $TESTER -f $fn -d $extra >$bn.log 2>&1 - if test "$?" = 0 - then - diff -u $bn.ref $bn.dump && rm $bn.dump $bn.log - if test "$?" != 0 - then - RETVAL=1 - fi - else - echo "Test exec error in $fn" - RETVAL=1 - fi -} - -if test $# -gt 0 -then -# test files specified on CLI - for n in "$@" - do - test_file $n - done -else -# test all - for n in *.grbs - do - test_file $n - done -fi - -exit $RETVAL Property changes on: trunk/src/libgrbs/regression/Test.sh ___________________________________________________________________ Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: trunk/src/libgrbs/regression/pp_cnv_inc1.grbs =================================================================== --- trunk/src/libgrbs/regression/pp_cnv_inc1.grbs (revision 1333) +++ trunk/src/libgrbs/regression/pp_cnv_inc1.grbs (nonexistent) @@ -1,19 +0,0 @@ -# concave-concave net traces the same path as an incident-incident net -# the postprocessor should move he concave corners - -# point_new -point_new P0 100 100 4 4 - -point_new P1a 30 160 4 4 -point_new P2a 70 160 4 4 -point_new P3a 70 200 4 4 -point_new P2b 160 160 4 4 -point_new P3b 160 200 4 4 -point_new P1b 170 160 4 4 - - -2net_new ninc 0.6 3 from P2a to P0 -2net_new nconc 2.6 6 from P3a concave ccw P2a concave ccw P0 to P2b - -pp_concave - Index: trunk/src/libgrbs/regression/incang_update.grbs =================================================================== --- trunk/src/libgrbs/regression/incang_update.grbs (revision 1333) +++ trunk/src/libgrbs/regression/incang_update.grbs (nonexistent) @@ -1,18 +0,0 @@ -# The incident angle of n1 is going to be updated because of n2 bumping -# the radius of n1's arc around P0b - -point_new P0b 20 40 2 2 - -point_new P1a -5 40 2 2 -point_new P1b 60 40 2 2 - -point_new P2a 0 50 2 2 -point_new P2b 50 50 2 2 - -point_new P3a 5 60 2 2 -point_new P3b 40 60 2 2 - - -2net_new n1 1 3 from P1a cw P0b to P1b -2net_new n3 1 3 from P3a cw P0b to P3b -2net_new n2 0.5 3.4 from P2a cw P0b to P2b Index: trunk/src/libgrbs/regression/cc_order1.grbs =================================================================== --- trunk/src/libgrbs/regression/cc_order1.grbs (revision 1333) +++ trunk/src/libgrbs/regression/cc_order1.grbs (nonexistent) @@ -1,12 +0,0 @@ -# draw a concave segment above an existing convex segment - -point_new P0 50 50 2 2 - -point_new P1a 30 20 2 2 -point_new P1b 70 20 2 2 - -point_new P2a 30 70 2 2 -point_new P2b 70 70 2 2 - -2net_new n_convex 1 3 from P2a cw P0 to P2b -2net_new n_concave 1 3 from P1a concave cw P0 to P1b Index: trunk/src/libgrbs/regression/concave3.grbs =================================================================== --- trunk/src/libgrbs/regression/concave3.grbs (revision 1333) +++ trunk/src/libgrbs/regression/concave3.grbs (nonexistent) @@ -1,13 +0,0 @@ -# concave -> concave arc-to-arc cases - -point_new P0 50 50 2 2 - -point_new P1a 30 80 2 2 -point_new P1b 70 80 2 2 - -point_new P2 60 110 2 2 - - - -# arc2arc -2net_new n1 1 3 from P1a concave ccw P0 concave ccw P1b to P2 Index: trunk/src/libgrbs/regression/concave7.grbs =================================================================== --- trunk/src/libgrbs/regression/concave7.grbs (revision 1333) +++ trunk/src/libgrbs/regression/concave7.grbs (nonexistent) @@ -1,14 +0,0 @@ - -# point_new -point_new P0 100 100 4 4 - -point_new P1a 60 160 4 4 -point_new P3a 70 160 4 4 -point_new P1b 140 160 4 4 - -point_new P2 120 220 4 4 -point_new P2c 110 220 4 4 - -######## -2net_new n2 2 6 from P2c ccw P1b concave cw P0 to P3a -2net_new n1 2 6 from P1a concave ccw P0 cw P1b to P2 Index: trunk/src/libgrbs/regression/spiral.ref =================================================================== --- trunk/src/libgrbs/regression/spiral.ref (revision 1333) +++ trunk/src/libgrbs/regression/spiral.ref (nonexistent) @@ -1,4 +0,0 @@ - pt 10.000000;10.000000 cop;clr=2.000000;1.000000 - pt 30.000000;10.000000 cop;clr=2.000000;1.000000 - pt 50.000000;10.000000 cop;clr=2.000000;1.000000 - pt 20.000000;50.000000 cop;clr=2.000000;1.000000 Index: trunk/src/libgrbs/regression/around2.grbs =================================================================== --- trunk/src/libgrbs/regression/around2.grbs (revision 1333) +++ trunk/src/libgrbs/regression/around2.grbs (nonexistent) @@ -1,9 +0,0 @@ -point_new P1 10 10 2 1 -point_new P2 30 10 2 1 -point_new P3 50 10 2 1 -point_new P4 20 50 2 1 - - -# new -2net_new n1 1 1 from P1 cw P2 ccw P4 to P3 - Index: trunk/src/libgrbs/regression/rollback1.grbs =================================================================== --- trunk/src/libgrbs/regression/rollback1.grbs (revision 1333) +++ trunk/src/libgrbs/regression/rollback1.grbs (nonexistent) @@ -1,18 +0,0 @@ -# draw a net in two steps - -# point_new -point_new P0 100 100 4 4 - -point_new P1a 60 160 4 4 -point_new P3a 70 160 4 4 -point_new P1b 140 160 4 4 - -point_new P2 120 220 4 4 -point_new P2c 110 220 4 4 - -######## - -2net_new n2 2 6 from P2c ccw P1b concave cw P0 pause -2net_append n2 to P3a - -pp_concave Index: trunk/src/libgrbs/regression/two_orbits2.grbs =================================================================== --- trunk/src/libgrbs/regression/two_orbits2.grbs (revision 1333) +++ trunk/src/libgrbs/regression/two_orbits2.grbs (nonexistent) @@ -1,8 +0,0 @@ -point_new P0 30 20 2 1 -point_new P1a 20 40 2 1 -point_new P1b 40 40 2 1 -point_new P2a 15 40 2 1 -point_new P2b 45 40 2 1 - -2net_new n1 1 1 from P2a cw P0 to P2b -2net_new n2 1 1 from P1a cw P0 to P1b Index: trunk/src/libgrbs/regression/pp_cnv_inc1.ref =================================================================== --- trunk/src/libgrbs/regression/pp_cnv_inc1.ref (revision 1333) +++ trunk/src/libgrbs/regression/pp_cnv_inc1.ref (nonexistent) @@ -1,19 +0,0 @@ - pt 100.000000;100.000000 cop;clr=4.000000;4.000000 - seg concave 0: - arc use=0 4.000000:0.785398 -> 0.430492 [0.785398 1.215890] - arc use=1 12.600000:0.785398 -> 0.430492 [0.785398 1.215890] tn=11 - pt 30.000000;160.000000 cop;clr=4.000000;4.000000 - pt 70.000000;160.000000 cop;clr=4.000000;4.000000 - seg concave 0: - arc use=0 4.000000:0.405199 -> 1.165597 [0.405199 1.570796] - arc use=1 12.600000:0.405199 -> 1.165597 [0.405199 1.570796] tn=11 - pt 70.000000;200.000000 cop;clr=4.000000;4.000000 - pt 160.000000;160.000000 cop;clr=4.000000;4.000000 - pt 160.000000;200.000000 cop;clr=4.000000;4.000000 - pt 170.000000;160.000000 cop;clr=4.000000;4.000000 - arc use=1 center=100.000000;100.000000 r=0.000000 a=2.034444;0.000000 - arc use=1 center=70.000000;160.000000 r=0.000000 a=-1.107149;0.000000 - arc use=1 center=160.000000;160.000000 r=0.000000 a=-2.356194;0.000000 - arc use=1 center=100.000000;100.000000 r=12.600000 a=0.785398;0.430492 - arc use=1 center=70.000000;160.000000 r=12.600000 a=0.405199;1.165597 - arc use=1 center=70.000000;200.000000 r=0.000000 a=-1.570796;0.000000 Index: trunk/src/libgrbs/regression/pp_cnv_inc2.ref =================================================================== --- trunk/src/libgrbs/regression/pp_cnv_inc2.ref (revision 1333) +++ trunk/src/libgrbs/regression/pp_cnv_inc2.ref (nonexistent) @@ -1,19 +0,0 @@ - pt 100.000000;100.000000 cop;clr=4.000000;4.000000 - seg concave 0: - arc use=0 4.000000:0.785398 -> 0.430492 [0.785398 1.215890] - arc use=1 12.600000:0.785398 -> 0.430492 [0.785398 1.215890] tn=11 - pt 30.000000;160.000000 cop;clr=4.000000;4.000000 - pt 70.000000;160.000000 cop;clr=4.000000;4.000000 - seg concave 0: - arc use=0 4.000000:-4.712389 -> 2.405010 [-4.712389 -2.307379] - arc use=1 12.600000:-2.307379 -> -2.405010 [-4.712389 -2.307379] tn=11 - pt 70.000000;200.000000 cop;clr=4.000000;4.000000 - pt 160.000000;160.000000 cop;clr=4.000000;4.000000 - pt 160.000000;200.000000 cop;clr=4.000000;4.000000 - pt 170.000000;160.000000 cop;clr=4.000000;4.000000 - arc use=1 center=100.000000;100.000000 r=0.000000 a=2.034444;0.000000 - arc use=1 center=70.000000;160.000000 r=0.000000 a=-1.107149;0.000000 - arc use=1 center=160.000000;160.000000 r=0.000000 a=-2.356194;0.000000 - arc use=1 center=100.000000;100.000000 r=12.600000 a=0.785398;0.430492 - arc use=1 center=70.000000;160.000000 r=12.600000 a=-2.307379;-2.405010 - arc use=1 center=70.000000;200.000000 r=0.000000 a=-1.570796;0.000000 Index: trunk/src/libgrbs/regression/pp_cnv_inc3.ref =================================================================== --- trunk/src/libgrbs/regression/pp_cnv_inc3.ref (revision 1333) +++ trunk/src/libgrbs/regression/pp_cnv_inc3.ref (nonexistent) @@ -1,19 +0,0 @@ - pt 100.000000;100.000000 cop;clr=4.000000;4.000000 - seg concave 0: - arc use=0 4.000000:0.785398 -> 0.430492 [0.785398 1.215890] - arc use=1 12.600000:0.785398 -> 0.430492 [0.785398 1.215890] tn=11 - pt 30.000000;160.000000 cop;clr=4.000000;4.000000 - pt 70.000000;160.000000 cop;clr=4.000000;4.000000 - seg convex 0: - arc use=0 4.000000:0.405199 -> 1.486054 [0.405199 1.891253] - arc use=1 12.600000:0.405199 -> 1.486054 [0.405199 1.891253] tn=11 - pt 70.000000;200.000000 cop;clr=4.000000;4.000000 - pt 160.000000;160.000000 cop;clr=4.000000;4.000000 - pt 160.000000;200.000000 cop;clr=4.000000;4.000000 - pt 170.000000;160.000000 cop;clr=4.000000;4.000000 - arc use=1 center=100.000000;100.000000 r=0.000000 a=2.034444;0.000000 - arc use=1 center=70.000000;160.000000 r=0.000000 a=-1.107149;0.000000 - arc use=1 center=160.000000;160.000000 r=0.000000 a=-2.356194;0.000000 - arc use=1 center=100.000000;100.000000 r=12.600000 a=0.785398;0.430492 - arc use=1 center=70.000000;160.000000 r=12.600000 a=0.405199;1.486054 - arc use=1 center=30.000000;160.000000 r=0.000000 a=0.320457;0.000000 Index: trunk/src/libgrbs/regression/paral2.grbs =================================================================== --- trunk/src/libgrbs/regression/paral2.grbs (revision 1333) +++ trunk/src/libgrbs/regression/paral2.grbs (nonexistent) @@ -1,16 +0,0 @@ -# parallel routes (second route is topo-guided by the first on its Pm1->Pm2) - -point_new Ps1 20 55 2 2 -point_new Ps2 20 45 2 2 - -point_new Pm1 50 50 2 2 -point_new Pm2 50 70 2 2 - -point_new Pt1 20 65 2 2 -point_new Pt2 20 75 2 2 - - -#point_new Px 45 60 2 2 - -2net_new Nouter 1 3 from Ps2 cw Pm1 cw Pm2 to Pt2 -2net_new Ninner 1 3 from Ps1 cw Pm1 cw Pm2 to Pt1 Index: trunk/src/libgrbs/regression/pp_cnv_inc4.ref =================================================================== --- trunk/src/libgrbs/regression/pp_cnv_inc4.ref (revision 1333) +++ trunk/src/libgrbs/regression/pp_cnv_inc4.ref (nonexistent) @@ -1,19 +0,0 @@ - pt 100.000000;-100.000000 cop;clr=4.000000;4.000000 - seg concave 0: - arc use=0 4.000000:5.497787 -> -0.430492 [5.067296 5.497787] - arc use=1 12.600000:5.497787 -> -0.430492 [5.067296 5.497787] tn=11 - pt 20.000000;-160.000000 cop;clr=4.000000;4.000000 - pt 70.000000;-160.000000 cop;clr=4.000000;4.000000 - seg convex 0: - arc use=0 4.000000:4.457643 -> 1.420344 [4.457643 5.877986] - arc use=1 12.600000:5.877986 -> -1.420344 [4.457643 5.877986] tn=11 - pt 70.000000;-200.000000 cop;clr=4.000000;4.000000 - pt 160.000000;-160.000000 cop;clr=4.000000;4.000000 - pt 160.000000;-200.000000 cop;clr=4.000000;4.000000 - pt 170.000000;-160.000000 cop;clr=4.000000;4.000000 - arc use=1 center=100.000000;-100.000000 r=0.000000 a=-2.034444;0.000000 - arc use=1 center=70.000000;-160.000000 r=0.000000 a=1.107149;0.000000 - arc use=1 center=160.000000;-160.000000 r=0.000000 a=2.356194;0.000000 - arc use=1 center=100.000000;-100.000000 r=12.600000 a=5.497787;-0.430492 - arc use=1 center=70.000000;-160.000000 r=12.600000 a=5.877986;-1.420344 - arc use=1 center=20.000000;-160.000000 r=0.000000 a=-0.254746;0.000000 Index: trunk/src/libgrbs/regression/guide_cross.ref =================================================================== --- trunk/src/libgrbs/regression/guide_cross.ref (revision 1333) +++ trunk/src/libgrbs/regression/guide_cross.ref (nonexistent) @@ -1,22 +0,0 @@ - pt 20.000000;55.000000 cop;clr=2.000000;2.000000 - pt 20.000000;45.000000 cop;clr=2.000000;2.000000 - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:-1.934526 -> 2.950512 [-1.934526 1.015985] - arc use=1 6.000000:1.015985 -> -2.950512 [-1.934526 1.015985] tn=7 - arc use=1 11.000000:7.299171 -> -2.791700 [4.507471 7.299171] tn=14 - pt 50.000000;70.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:1.207066 -> 2.950512 [1.207066 4.157578] - arc use=1 6.000000:1.207066 -> 2.950512 [1.207066 4.157578] tn=14 - arc use=1 11.000000:1.365878 -> 2.791700 [1.365878 4.157578] tn=7 - pt 80.000000;65.000000 cop;clr=2.000000;2.000000 - pt 80.000000;75.000000 cop;clr=2.000000;2.000000 - arc use=1 center=80.000000;75.000000 r=0.000000 a=2.936674;0.000000 - arc use=1 center=50.000000;70.000000 r=11.000000 a=1.365878;2.791700 - arc use=1 center=50.000000;50.000000 r=6.000000 a=1.015985;-2.950512 - arc use=1 center=20.000000;55.000000 r=0.000000 a=-0.363730;0.000000 - arc use=1 center=80.000000;65.000000 r=0.000000 a=2.777863;0.000000 - arc use=1 center=50.000000;70.000000 r=6.000000 a=1.207066;2.950512 - arc use=1 center=50.000000;50.000000 r=11.000000 a=7.299171;-2.791700 - arc use=1 center=20.000000;45.000000 r=0.000000 a=-0.204918;0.000000 Index: trunk/src/libgrbs/regression/cross_arc_inc3.grbs =================================================================== --- trunk/src/libgrbs/regression/cross_arc_inc3.grbs (revision 1333) +++ trunk/src/libgrbs/regression/cross_arc_inc3.grbs (nonexistent) @@ -1,13 +0,0 @@ -# draw incident line first then try to pass through an arc that's crossing it -# -> shall fail - -point_new P0a 20 20 2 3 -point_new P0b 20 40 2 3 - -point_new P1a 5 40 2 3 -point_new P1b 30 40 2 3 - -2net_new n0 1 1 from P0a to P0b -fail 2net_new n1 1 1 from P1a cw P0b to P1b - - Index: trunk/src/libgrbs/regression/conc_cross1.ref =================================================================== --- trunk/src/libgrbs/regression/conc_cross1.ref (revision 1333) +++ trunk/src/libgrbs/regression/conc_cross1.ref (nonexistent) @@ -1,16 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg concave 0: - arc use=0 2.000000:0.815606 -> 1.343193 [0.815606 2.158799] - arc use=1 6.000000:0.815606 -> 1.343193 [0.815606 2.158799] tn=7 - pt 30.000000;80.000000 cop;clr=2.000000;2.000000 - pt 70.000000;80.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:5.527995 -> 1.267835 [5.527995 6.795830] - arc use=1 6.000000:6.795830 -> -1.267835 [5.527995 6.795830] tn=7 - pt 30.000000;70.000000 cop;clr=2.000000;2.000000 - pt 70.000000;80.000000 cop;clr=2.000000;2.000000 - pt 60.000000;110.000000 cop;clr=2.000000;2.000000 - arc use=1 center=60.000000;110.000000 r=0.000000 a=-1.058152;0.000000 - arc use=1 center=70.000000;80.000000 r=6.000000 a=6.795830;-1.267835 - arc use=1 center=50.000000;50.000000 r=6.000000 a=0.815606;1.343193 - arc use=1 center=30.000000;80.000000 r=0.000000 a=-0.982794;0.000000 Index: trunk/src/libgrbs/regression/pp_cnv_inc2.grbs =================================================================== --- trunk/src/libgrbs/regression/pp_cnv_inc2.grbs (revision 1333) +++ trunk/src/libgrbs/regression/pp_cnv_inc2.grbs (nonexistent) @@ -1,21 +0,0 @@ -# concave-concave net traces the same path as an incident-incident net -# the postprocessor should move he concave corners -# TODO: figure the line-line crossing - -# point_new -point_new P0 100 100 4 4 - -point_new P1a 30 160 4 4 -point_new P2a 70 160 4 4 -point_new P3a 70 200 4 4 -point_new P2b 160 160 4 4 -point_new P3b 160 200 4 4 -point_new P1b 170 160 4 4 - - -2net_new ninc 0.6 3 from P2a to P0 -2net_new nconc 2.6 6 from P3a concave cw P2a concave ccw P0 to P2b - - -pp_concave - Index: trunk/src/libgrbs/regression/concave4.grbs =================================================================== --- trunk/src/libgrbs/regression/concave4.grbs (revision 1333) +++ trunk/src/libgrbs/regression/concave4.grbs (nonexistent) @@ -1,13 +0,0 @@ -# convex -> concave arc-to-arc cases - -point_new P0 50 50 2 2 - -point_new P1a 30 80 2 2 -point_new P1b 70 80 2 2 - -point_new P2 60 110 2 2 - - - -# arc2arc -2net_new n1 1 3 from P1a cw P0 concave ccw P1b to P2 Index: trunk/src/libgrbs/regression/cc_order2.grbs =================================================================== --- trunk/src/libgrbs/regression/cc_order2.grbs (revision 1333) +++ trunk/src/libgrbs/regression/cc_order2.grbs (nonexistent) @@ -1,12 +0,0 @@ -# Insert a convex segment below an existing concave segment - -point_new P0 50 50 2 2 - -point_new P1a 30 20 2 2 -point_new P1b 70 20 2 2 - -point_new P2a 30 70 2 2 -point_new P2b 70 70 2 2 - -2net_new n_concave 1 3 from P1a concave cw P0 to P1b -2net_new n_convex 1 3 from P2a cw P0 to P2b Index: trunk/src/libgrbs/regression/concave8.grbs =================================================================== --- trunk/src/libgrbs/regression/concave8.grbs (revision 1333) +++ trunk/src/libgrbs/regression/concave8.grbs (nonexistent) @@ -1,16 +0,0 @@ - -# point_new -point_new P0 100 100 4 4 - -point_new P1a 60 160 4 4 -point_new P3a 70 160 4 4 -point_new P1b 140 160 4 4 - -point_new P2 120 220 4 4 -point_new P2c 110 220 4 4 - - -# original ordering -2net_new n1 2 6 from P1a concave ccw P0 cw P1b to P2 -2net_new n2 2 6 from P3a concave ccw P0 cw P1b to P2c - Index: trunk/src/libgrbs/regression/detach1.grbs =================================================================== --- trunk/src/libgrbs/regression/detach1.grbs (revision 1333) +++ trunk/src/libgrbs/regression/detach1.grbs (nonexistent) @@ -1,15 +0,0 @@ -# A* simulation: start drawing a net and stop and detach at P0 -# then draw only one segment from the detached address - -# point_new -point_new P0 100 100 4 4 - -point_new P1a 50 120 4 4 -point_new P1b 150 120 4 4 - - -######## - -2net_new n1 2 6 from P1a cw P0 detach d1 -2net_new n1 2 6 reattach d1 to P1b - Index: trunk/src/libgrbs/regression/around3.grbs =================================================================== --- trunk/src/libgrbs/regression/around3.grbs (revision 1333) +++ trunk/src/libgrbs/regression/around3.grbs (nonexistent) @@ -1,6 +0,0 @@ -point_new P1 10 10 2 1 -point_new P2 30 10 2 1 -point_new P3 50 10 2 1 -point_new P4 20 50 2 1 - -2net_new n1 1 1 from P1 ccw P4 cw P2 to P3 Index: trunk/src/libgrbs/regression/rollback2.grbs =================================================================== --- trunk/src/libgrbs/regression/rollback2.grbs (revision 1333) +++ trunk/src/libgrbs/regression/rollback2.grbs (nonexistent) @@ -1,21 +0,0 @@ -# drawing n1 should fail because it collides with half-finished n2 -# (because of tester limitations we can not continue n2, as last addr is n1's) - -# point_new -point_new P0 100 100 4 4 - -point_new P1a 60 160 4 4 -point_new P3a 70 160 4 4 -point_new P1b 140 160 4 4 - -point_new P2 120 220 4 4 -point_new P2c 110 220 4 4 - -######## - - - -2net_new n2 2 6 from P2c ccw P1b concave cw P0 pause -fail 2net_new n1 2 6 from P2c ccw P1b concave cw P0 to P3a - -pp_concave Index: trunk/src/libgrbs/regression/convex_cross1.ref =================================================================== --- trunk/src/libgrbs/regression/convex_cross1.ref (revision 1333) +++ trunk/src/libgrbs/regression/convex_cross1.ref (nonexistent) @@ -1,14 +0,0 @@ - pt 20.000000;40.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:3.542728 -> 2.393208 [3.542728 5.935936] - arc use=1 6.000000:5.935936 -> -2.393208 [3.542728 5.935936] tn=5 - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - pt 5.000000;60.000000 cop;clr=2.000000;2.000000 - pt 40.000000;60.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:0.347249 -> 2.447094 [0.347249 2.794344] - arc use=1 6.000000:0.347249 -> 2.447094 [0.347249 2.794344] tn=5 - arc use=1 center=50.000000;50.000000 r=0.000000 a=1.918045;0.000000 - arc use=1 center=40.000000;60.000000 r=6.000000 a=0.347249;2.447094 - arc use=1 center=20.000000;40.000000 r=6.000000 a=5.935936;-2.393208 - arc use=1 center=5.000000;60.000000 r=0.000000 a=-1.169661;0.000000 Index: trunk/src/libgrbs/regression/convex_cross2.ref =================================================================== --- trunk/src/libgrbs/regression/convex_cross2.ref (revision 1333) +++ trunk/src/libgrbs/regression/convex_cross2.ref (nonexistent) @@ -1,9 +0,0 @@ - pt 20.000000;40.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:3.542728 -> 2.168815 [3.542728 5.711543] - arc use=1 6.000000:5.711543 -> -2.168815 [3.542728 5.711543] tn=4 - pt 5.000000;60.000000 cop;clr=2.000000;2.000000 - pt 40.000000;60.000000 cop;clr=2.000000;2.000000 - arc use=1 center=40.000000;60.000000 r=0.000000 a=-2.142438;0.000000 - arc use=1 center=20.000000;40.000000 r=6.000000 a=5.711543;-2.168815 - arc use=1 center=5.000000;60.000000 r=0.000000 a=-1.169661;0.000000 Index: trunk/src/libgrbs/regression/conc_cross1.grbs =================================================================== --- trunk/src/libgrbs/regression/conc_cross1.grbs (revision 1333) +++ trunk/src/libgrbs/regression/conc_cross1.grbs (nonexistent) @@ -1,18 +0,0 @@ -# concave trying to jump orbit: n2 around P0 could head to concave ccw P2b -# only by crossing n1 - -point_new P0 50 50 2 2 - -point_new P1a 30 80 2 2 -point_new P1b 70 80 2 2 - -point_new P2a 30 70 2 2 -point_new P2b 70 80 2 2 - -point_new P2 60 110 2 2 - - - -# arc2arc -2net_new n1 1 3 from P1a concave ccw P0 cw P1b to P2 -fail 2net_new n2 1 3 from P2a concave ccw P0 concave ccw P2b ccw P2 ccw P1b \ No newline at end of file Index: trunk/src/libgrbs/regression/paral3.grbs =================================================================== --- trunk/src/libgrbs/regression/paral3.grbs (revision 1333) +++ trunk/src/libgrbs/regression/paral3.grbs (nonexistent) @@ -1,17 +0,0 @@ -# parallel routes (third route is topo-guided in between inner and outer) - -point_new Ps1 20 58 2 2 -point_new Ps2 20 42 2 2 -point_new Ps3 20 50 2 2 - -point_new Pm1 50 50 2 2 -point_new Pm2 50 70 2 2 - -point_new Pt1 20 62 2 2 -point_new Pt2 20 78 2 2 -point_new Pt3 20 70 2 2 - - -2net_new Nouter 1 3 from Ps2 cw Pm1 cw Pm2 to Pt2 -2net_new Ninner 1 3 from Ps1 cw Pm1 cw Pm2 to Pt1 -2net_new Nmiddle 1 3 from Ps3 cw Pm1 cw Pm2 to Pt3 Index: trunk/src/libgrbs/regression/around1.ref =================================================================== --- trunk/src/libgrbs/regression/around1.ref (revision 1333) +++ trunk/src/libgrbs/regression/around1.ref (nonexistent) @@ -1,16 +0,0 @@ - pt 10.000000;10.000000 cop;clr=2.000000;1.000000 - pt 30.000000;10.000000 cop;clr=2.000000;1.000000 - seg convex 0: - arc use=0 2.000000:4.511031 -> 2.114300 [4.511031 6.625331] - arc use=1 4.000000:6.625331 -> -2.114300 [4.511031 6.625331] tn=5 - pt 50.000000;10.000000 cop;clr=2.000000;1.000000 - pt 20.000000;50.000000 cop;clr=2.000000;1.000000 - seg convex 0: - arc use=0 2.000000:0.563416 -> 2.920323 [0.563416 3.483738] - arc use=1 4.000000:0.563416 -> 2.920323 [0.563416 3.483738] tn=10 - arc use=1 center=20.000000;50.000000 r=0.000000 a=-1.228651;0.000000 - arc use=1 center=30.000000;10.000000 r=4.000000 a=6.625331;-2.114300 - arc use=1 center=10.000000;10.000000 r=0.000000 a=-0.201358;0.000000 - arc use=1 center=50.000000;10.000000 r=0.000000 a=2.134212;0.000000 - arc use=1 center=20.000000;50.000000 r=4.000000 a=0.563416;2.920323 - arc use=1 center=30.000000;10.000000 r=0.000000 a=1.912942;0.000000 Index: trunk/src/libgrbs/regression/rollback1.ref =================================================================== --- trunk/src/libgrbs/regression/rollback1.ref (revision 1333) +++ trunk/src/libgrbs/regression/rollback1.ref (nonexistent) @@ -1,16 +0,0 @@ - pt 100.000000;100.000000 cop;clr=4.000000;4.000000 - seg concave 0: - arc use=0 4.000000:0.815606 -> 1.218838 [0.815606 2.034444] - arc use=1 12.000000:2.034444 -> -1.218838 [0.815606 2.034444] tn=7 - pt 60.000000;160.000000 cop;clr=4.000000;4.000000 - pt 70.000000;160.000000 cop;clr=4.000000;4.000000 - pt 140.000000;160.000000 cop;clr=4.000000;4.000000 - seg convex 0: - arc use=0 4.000000:-0.755190 -> 1.398692 [-0.755190 0.643501] - arc use=1 12.000000:-0.755190 -> 1.398692 [-0.755190 0.643501] tn=7 - pt 120.000000;220.000000 cop;clr=4.000000;4.000000 - pt 110.000000;220.000000 cop;clr=4.000000;4.000000 - arc use=1 center=70.000000;160.000000 r=0.000000 a=-1.107149;0.000000 - arc use=1 center=100.000000;100.000000 r=12.000000 a=2.034444;-1.218838 - arc use=1 center=140.000000;160.000000 r=12.000000 a=-0.755190;1.398692 - arc use=1 center=110.000000;220.000000 r=0.000000 a=-0.927295;0.000000 Index: trunk/src/libgrbs/regression/around2.ref =================================================================== --- trunk/src/libgrbs/regression/around2.ref (revision 1333) +++ trunk/src/libgrbs/regression/around2.ref (nonexistent) @@ -1,14 +0,0 @@ - pt 10.000000;10.000000 cop;clr=2.000000;1.000000 - pt 30.000000;10.000000 cop;clr=2.000000;1.000000 - seg convex 0: - arc use=0 2.000000:4.511031 -> 2.212400 [4.511031 6.723431] - arc use=1 4.000000:6.723431 -> -2.212400 [4.511031 6.723431] tn=5 - pt 50.000000;10.000000 cop;clr=2.000000;1.000000 - pt 20.000000;50.000000 cop;clr=2.000000;1.000000 - seg convex 0: - arc use=0 2.000000:0.563416 -> 3.018423 [0.563416 3.581838] - arc use=1 4.000000:0.563416 -> 3.018423 [0.563416 3.581838] tn=5 - arc use=1 center=50.000000;10.000000 r=0.000000 a=2.134212;0.000000 - arc use=1 center=20.000000;50.000000 r=4.000000 a=0.563416;3.018423 - arc use=1 center=30.000000;10.000000 r=4.000000 a=6.723431;-2.212400 - arc use=1 center=10.000000;10.000000 r=0.000000 a=-0.201358;0.000000 Index: trunk/src/libgrbs/regression/around3.ref =================================================================== --- trunk/src/libgrbs/regression/around3.ref (revision 1333) +++ trunk/src/libgrbs/regression/around3.ref (nonexistent) @@ -1,14 +0,0 @@ - pt 10.000000;10.000000 cop;clr=2.000000;1.000000 - pt 30.000000;10.000000 cop;clr=2.000000;1.000000 - seg convex 0: - arc use=0 2.000000:3.191304 -> 1.722443 [3.191304 4.913747] - arc use=1 4.000000:4.913747 -> -1.722443 [3.191304 4.913747] tn=5 - pt 50.000000;10.000000 cop;clr=2.000000;1.000000 - pt 20.000000;50.000000 cop;clr=2.000000;1.000000 - seg convex 0: - arc use=0 2.000000:0.049712 -> 2.944069 [0.049712 2.993781] - arc use=1 4.000000:0.049712 -> 2.944069 [0.049712 2.993781] tn=5 - arc use=1 center=50.000000;10.000000 r=0.000000 a=-2.940235;0.000000 - arc use=1 center=30.000000;10.000000 r=4.000000 a=4.913747;-1.722443 - arc use=1 center=20.000000;50.000000 r=4.000000 a=0.049712;2.944069 - arc use=1 center=10.000000;10.000000 r=0.000000 a=1.422985;0.000000 Index: trunk/src/libgrbs/regression/rollback2.ref =================================================================== --- trunk/src/libgrbs/regression/rollback2.ref (revision 1333) +++ trunk/src/libgrbs/regression/rollback2.ref (nonexistent) @@ -1,6 +0,0 @@ - pt 100.000000;100.000000 cop;clr=4.000000;4.000000 - pt 60.000000;160.000000 cop;clr=4.000000;4.000000 - pt 70.000000;160.000000 cop;clr=4.000000;4.000000 - pt 140.000000;160.000000 cop;clr=4.000000;4.000000 - pt 120.000000;220.000000 cop;clr=4.000000;4.000000 - pt 110.000000;220.000000 cop;clr=4.000000;4.000000 Index: trunk/src/libgrbs/regression/convex_cross1.grbs =================================================================== --- trunk/src/libgrbs/regression/convex_cross1.grbs (revision 1333) +++ trunk/src/libgrbs/regression/convex_cross1.grbs (nonexistent) @@ -1,17 +0,0 @@ -# refuse to route convex CCW with crossing exit lines - -point_new P0b 20 40 2 2 - -point_new P2b 50 50 2 2 - -point_new P3a 5 60 2 2 -point_new P3b 40 60 2 2 - - -echo "---GOOD:" -2net_new n3 1 3 from P3a cw P0b ccw P3b to P2b - -echo "---BAD:" -fail 2net_new n3 1 3 from P3a ccw P0b ccw P3b to P2b - - Index: trunk/src/libgrbs/regression/concave1.grbs =================================================================== --- trunk/src/libgrbs/regression/concave1.grbs (revision 1333) +++ trunk/src/libgrbs/regression/concave1.grbs (nonexistent) @@ -1,16 +0,0 @@ -# Build two concave nets around P0 in order from in-to-out - -point_new P0 50 50 2 2 - -point_new P1a 30 80 2 2 -point_new P1b 70 80 2 2 - -point_new P2a 40 110 2 2 -point_new P2b 60 110 2 2 - - - -# original concave tests -2net_new n1 1 3 from P1a concave ccw P0 to P1b -2net_new n2 1 3 from P2a concave ccw P0 to P2b - Index: trunk/src/libgrbs/regression/long_convex.ref =================================================================== --- trunk/src/libgrbs/regression/long_convex.ref (revision 1333) +++ trunk/src/libgrbs/regression/long_convex.ref (nonexistent) @@ -1,9 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:2.602271 -> 4.324416 [2.602271 6.926686] - arc use=1 6.000000:6.926686 -> -4.324416 [2.602271 6.926686] tn=4 - pt 46.000000;55.000000 cop;clr=2.000000;2.000000 - pt 50.000000;60.000000 cop;clr=2.000000;2.000000 - arc use=1 center=50.000000;60.000000 r=0.000000 a=-0.927295;0.000000 - arc use=1 center=50.000000;50.000000 r=6.000000 a=6.926686;-4.324416 - arc use=1 center=46.000000;55.000000 r=0.000000 a=-2.110118;0.000000 Index: trunk/src/libgrbs/regression/pp_cnv_inc3.grbs =================================================================== --- trunk/src/libgrbs/regression/pp_cnv_inc3.grbs (revision 1333) +++ trunk/src/libgrbs/regression/pp_cnv_inc3.grbs (nonexistent) @@ -1,19 +0,0 @@ -# concave-convex net reaches concave at an incident net -# the postprocessor should move he concave corner - -# point_new -point_new P0 100 100 4 4 - -point_new P1a 30 160 4 4 -point_new P2a 70 160 4 4 -point_new P3a 70 200 4 4 -point_new P2b 160 160 4 4 -point_new P3b 160 200 4 4 -point_new P1b 170 160 4 4 - - -2net_new ninc 0.6 3 from P2a to P0 -2net_new nconc 2.6 6 from P1a ccw P2a concave ccw P0 to P2b - -pp_concave - Index: trunk/src/libgrbs/regression/concave5.grbs =================================================================== --- trunk/src/libgrbs/regression/concave5.grbs (revision 1333) +++ trunk/src/libgrbs/regression/concave5.grbs (nonexistent) @@ -1,13 +0,0 @@ -# concave -> convex arc-to-arc cases - -point_new P0 50 50 2 2 - -point_new P1a 30 80 2 2 -point_new P1b 70 80 2 2 - -point_new P2 60 110 2 2 - - - -# arc2arc -2net_new n1 1 3 from P1a concave ccw P0 cw P1b to P2 Index: trunk/src/libgrbs/regression/cross_arc_inc1.ref =================================================================== --- trunk/src/libgrbs/regression/cross_arc_inc1.ref (revision 1333) +++ trunk/src/libgrbs/regression/cross_arc_inc1.ref (nonexistent) @@ -1,13 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;5.000000 - seg convex 0: - arc use=0 2.000000:3.640234 -> 2.144309 [3.640234 5.784544] - arc use=1 8.000000:5.784544 -> -2.144309 [3.640234 5.784544] tn=6 - pt 50.000000;30.000000 cop;clr=2.000000;5.000000 - pt 50.000000;70.000000 cop;clr=2.000000;5.000000 - pt 30.000000;70.000000 cop;clr=2.000000;5.000000 - pt 70.000000;70.000000 cop;clr=2.000000;5.000000 - arc use=1 center=70.000000;70.000000 r=0.000000 a=-2.069438;0.000000 - arc use=1 center=50.000000;50.000000 r=8.000000 a=5.784544;-2.144309 - arc use=1 center=30.000000;70.000000 r=0.000000 a=-1.072155;0.000000 - arc use=1 center=50.000000;50.000000 r=0.000000 a=1.570796;0.000000 - arc use=1 center=50.000000;70.000000 r=0.000000 a=-1.570796;0.000000 Index: trunk/src/libgrbs/regression/concave9.grbs =================================================================== --- trunk/src/libgrbs/regression/concave9.grbs (revision 1333) +++ trunk/src/libgrbs/regression/concave9.grbs (nonexistent) @@ -1,15 +0,0 @@ - -# point_new -point_new P0 100 100 4 4 - -point_new P1a 60 160 4 4 -point_new P3a 70 160 4 4 -point_new P1b 140 160 4 4 - -point_new P2 120 220 4 4 -point_new P2c 110 220 4 4 - -# original ordering -2net_new n2 2 6 from P3a concave ccw P0 cw P1b to P2c -2net_new n1 2 6 from P1a concave ccw P0 cw P1b to P2 - Index: trunk/src/libgrbs/regression/cross_arc_inc2.ref =================================================================== --- trunk/src/libgrbs/regression/cross_arc_inc2.ref (revision 1333) +++ trunk/src/libgrbs/regression/cross_arc_inc2.ref (nonexistent) @@ -1,13 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;5.000000 - seg convex 0: - arc use=0 2.000000:3.640234 -> 2.144309 [3.640234 5.784544] - arc use=1 8.000000:5.784544 -> -2.144309 [3.640234 5.784544] tn=6 - pt 50.000000;30.000000 cop;clr=2.000000;5.000000 - pt 50.000000;70.000000 cop;clr=2.000000;5.000000 - pt 30.000000;70.000000 cop;clr=2.000000;5.000000 - pt 70.000000;70.000000 cop;clr=2.000000;5.000000 - arc use=1 center=70.000000;70.000000 r=0.000000 a=-2.069438;0.000000 - arc use=1 center=50.000000;50.000000 r=8.000000 a=5.784544;-2.144309 - arc use=1 center=30.000000;70.000000 r=0.000000 a=-1.072155;0.000000 - arc use=1 center=50.000000;70.000000 r=0.000000 a=-1.570796;0.000000 - arc use=1 center=50.000000;50.000000 r=0.000000 a=1.570796;0.000000 Index: trunk/src/libgrbs/regression/cross_arc_inc3.ref =================================================================== --- trunk/src/libgrbs/regression/cross_arc_inc3.ref (revision 1333) +++ trunk/src/libgrbs/regression/cross_arc_inc3.ref (nonexistent) @@ -1,6 +0,0 @@ - pt 20.000000;20.000000 cop;clr=2.000000;3.000000 - pt 20.000000;40.000000 cop;clr=2.000000;3.000000 - pt 5.000000;40.000000 cop;clr=2.000000;3.000000 - pt 30.000000;40.000000 cop;clr=2.000000;3.000000 - arc use=1 center=20.000000;40.000000 r=0.000000 a=-1.570796;0.000000 - arc use=1 center=20.000000;20.000000 r=0.000000 a=1.570796;0.000000 Index: trunk/src/libgrbs/regression/detach2.grbs =================================================================== --- trunk/src/libgrbs/regression/detach2.grbs (revision 1333) +++ trunk/src/libgrbs/regression/detach2.grbs (nonexistent) @@ -1,20 +0,0 @@ -# A* simulation: start drawing a net and stop and detach at P0 -# then attempt to draw only one segment from the detached address -# This should fail because of n2 is blocking the new arc - - -# point_new -point_new P0 100 100 4 4 - -point_new P1a 50 120 4 4 -point_new P1b 150 120 4 4 - -point_new P2 100 60 4 4 - -######## - -2net_new n2 2 6 from P0 to P2 - -2net_new n1 2 6 from P1a cw P0 detach d1 -fail 2net_new n1 2 6 reattach d1 to P1b - Index: trunk/src/libgrbs/regression/concave1.ref =================================================================== --- trunk/src/libgrbs/regression/concave1.ref (revision 1333) +++ trunk/src/libgrbs/regression/concave1.ref (nonexistent) @@ -1,15 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg concave 0: - arc use=0 2.000000:0.982794 -> 1.176005 [0.982794 2.158799] - arc use=1 6.000000:0.982794 -> 1.176005 [0.982794 2.158799] tn=6 - arc use=1 11.000000:1.405648 -> 0.330297 [1.405648 1.735945] tn=11 - pt 30.000000;80.000000 cop;clr=2.000000;2.000000 - pt 70.000000;80.000000 cop;clr=2.000000;2.000000 - pt 40.000000;110.000000 cop;clr=2.000000;2.000000 - pt 60.000000;110.000000 cop;clr=2.000000;2.000000 - arc use=1 center=70.000000;80.000000 r=0.000000 a=-2.158799;0.000000 - arc use=1 center=50.000000;50.000000 r=6.000000 a=0.982794;1.176005 - arc use=1 center=30.000000;80.000000 r=0.000000 a=-0.982794;0.000000 - arc use=1 center=60.000000;110.000000 r=0.000000 a=-1.735945;0.000000 - arc use=1 center=50.000000;50.000000 r=11.000000 a=1.405648;0.330297 - arc use=1 center=40.000000;110.000000 r=0.000000 a=-1.405648;0.000000 Index: trunk/src/libgrbs/regression/concave2.ref =================================================================== --- trunk/src/libgrbs/regression/concave2.ref (revision 1333) +++ trunk/src/libgrbs/regression/concave2.ref (nonexistent) @@ -1,15 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg concave 0: - arc use=0 2.000000:0.982794 -> 1.176005 [0.982794 2.158799] - arc use=1 6.000000:0.982794 -> 1.176005 [0.982794 2.158799] tn=11 - arc use=1 11.000000:1.405648 -> 0.330297 [1.405648 1.735945] tn=6 - pt 30.000000;80.000000 cop;clr=2.000000;2.000000 - pt 70.000000;80.000000 cop;clr=2.000000;2.000000 - pt 40.000000;110.000000 cop;clr=2.000000;2.000000 - pt 60.000000;110.000000 cop;clr=2.000000;2.000000 - arc use=1 center=60.000000;110.000000 r=0.000000 a=-1.735945;0.000000 - arc use=1 center=50.000000;50.000000 r=11.000000 a=1.405648;0.330297 - arc use=1 center=40.000000;110.000000 r=0.000000 a=-1.405648;0.000000 - arc use=1 center=70.000000;80.000000 r=0.000000 a=-2.158799;0.000000 - arc use=1 center=50.000000;50.000000 r=6.000000 a=0.982794;1.176005 - arc use=1 center=30.000000;80.000000 r=0.000000 a=-0.982794;0.000000 Index: trunk/src/libgrbs/regression/cc_order1.ref =================================================================== --- trunk/src/libgrbs/regression/cc_order1.ref (revision 1333) +++ trunk/src/libgrbs/regression/cc_order1.ref (nonexistent) @@ -1,17 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:3.713235 -> 1.998309 [3.713235 5.711543] - arc use=1 6.000000:5.711543 -> -1.998309 [3.713235 5.711543] tn=6 - seg concave 0: - arc use=0 2.000000:-2.158799 -> 1.176005 [-2.158799 -0.982794] - arc use=1 11.000000:-0.982794 -> -1.176005 [-2.158799 -0.982794] tn=11 - pt 30.000000;20.000000 cop;clr=2.000000;2.000000 - pt 70.000000;20.000000 cop;clr=2.000000;2.000000 - pt 30.000000;70.000000 cop;clr=2.000000;2.000000 - pt 70.000000;70.000000 cop;clr=2.000000;2.000000 - arc use=1 center=70.000000;70.000000 r=0.000000 a=-2.142438;0.000000 - arc use=1 center=50.000000;50.000000 r=6.000000 a=5.711543;-1.998309 - arc use=1 center=30.000000;70.000000 r=0.000000 a=-0.999154;0.000000 - arc use=1 center=70.000000;20.000000 r=0.000000 a=2.158799;0.000000 - arc use=1 center=50.000000;50.000000 r=11.000000 a=-0.982794;-1.176005 - arc use=1 center=30.000000;20.000000 r=0.000000 a=0.982794;0.000000 Index: trunk/src/libgrbs/regression/concave3.ref =================================================================== --- trunk/src/libgrbs/regression/concave3.ref (revision 1333) +++ trunk/src/libgrbs/regression/concave3.ref (nonexistent) @@ -1,14 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg concave 0: - arc use=0 2.000000:0.982794 -> 1.176005 [0.982794 2.158799] - arc use=1 6.000000:0.982794 -> 1.176005 [0.982794 2.158799] tn=5 - pt 30.000000;80.000000 cop;clr=2.000000;2.000000 - pt 70.000000;80.000000 cop;clr=2.000000;2.000000 - seg concave 0: - arc use=0 2.000000:-4.390638 -> 2.231839 [-4.390638 -2.158799] - arc use=1 6.000000:-4.390638 -> 2.231839 [-4.390638 -2.158799] tn=5 - pt 60.000000;110.000000 cop;clr=2.000000;2.000000 - arc use=1 center=60.000000;110.000000 r=0.000000 a=-1.249046;0.000000 - arc use=1 center=70.000000;80.000000 r=6.000000 a=-4.390638;2.231839 - arc use=1 center=50.000000;50.000000 r=6.000000 a=0.982794;1.176005 - arc use=1 center=30.000000;80.000000 r=0.000000 a=-0.982794;0.000000 Index: trunk/src/libgrbs/regression/incang_update.ref =================================================================== --- trunk/src/libgrbs/regression/incang_update.ref (revision 1333) +++ trunk/src/libgrbs/regression/incang_update.ref (nonexistent) @@ -1,21 +0,0 @@ - pt 20.000000;40.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:3.542728 -> 2.168815 [3.542728 5.711543] - arc use=1 6.000000:5.711543 -> -2.168815 [3.542728 5.711543] tn=13 - arc use=1 10.900000:5.386046 -> -1.646486 [3.739560 5.386046] tn=17 - arc use=1 15.800000:5.118457 -> -1.090199 [4.028258 5.118457] tn=8 - pt -5.000000;40.000000 cop;clr=2.000000;2.000000 - pt 60.000000;40.000000 cop;clr=2.000000;2.000000 - pt 0.000000;50.000000 cop;clr=2.000000;2.000000 - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - pt 5.000000;60.000000 cop;clr=2.000000;2.000000 - pt 40.000000;60.000000 cop;clr=2.000000;2.000000 - arc use=1 center=60.000000;40.000000 r=0.000000 a=-2.735525;0.000000 - arc use=1 center=20.000000;40.000000 r=15.800000 a=5.118457;-1.090199 - arc use=1 center=-5.000000;40.000000 r=0.000000 a=-0.684131;0.000000 - arc use=1 center=40.000000;60.000000 r=0.000000 a=-2.142438;0.000000 - arc use=1 center=20.000000;40.000000 r=6.000000 a=5.711543;-2.168815 - arc use=1 center=5.000000;60.000000 r=0.000000 a=-1.169661;0.000000 - arc use=1 center=50.000000;50.000000 r=0.000000 a=-2.467935;0.000000 - arc use=1 center=20.000000;40.000000 r=10.900000 a=5.386046;-1.646486 - arc use=1 center=0.000000;50.000000 r=0.000000 a=-0.972829;0.000000 Index: trunk/src/libgrbs/regression/cc_order2.ref =================================================================== --- trunk/src/libgrbs/regression/cc_order2.ref (revision 1333) +++ trunk/src/libgrbs/regression/cc_order2.ref (nonexistent) @@ -1,17 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:3.713235 -> 1.998309 [3.713235 5.711543] - arc use=1 6.000000:5.711543 -> -1.998309 [3.713235 5.711543] tn=11 - seg concave 0: - arc use=0 2.000000:-2.158799 -> 1.176005 [-2.158799 -0.982794] - arc use=1 11.000000:-0.982794 -> -1.176005 [-2.158799 -0.982794] tn=6 - pt 30.000000;20.000000 cop;clr=2.000000;2.000000 - pt 70.000000;20.000000 cop;clr=2.000000;2.000000 - pt 30.000000;70.000000 cop;clr=2.000000;2.000000 - pt 70.000000;70.000000 cop;clr=2.000000;2.000000 - arc use=1 center=70.000000;20.000000 r=0.000000 a=2.158799;0.000000 - arc use=1 center=50.000000;50.000000 r=11.000000 a=-0.982794;-1.176005 - arc use=1 center=30.000000;20.000000 r=0.000000 a=0.982794;0.000000 - arc use=1 center=70.000000;70.000000 r=0.000000 a=-2.142438;0.000000 - arc use=1 center=50.000000;50.000000 r=6.000000 a=5.711543;-1.998309 - arc use=1 center=30.000000;70.000000 r=0.000000 a=-0.999154;0.000000 Index: trunk/src/libgrbs/regression/concave4.ref =================================================================== --- trunk/src/libgrbs/regression/concave4.ref (revision 1333) +++ trunk/src/libgrbs/regression/concave4.ref (nonexistent) @@ -1,14 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:3.562407 -> 2.299963 [3.562407 5.862371] - arc use=1 6.000000:5.862371 -> -2.299963 [3.562407 5.862371] tn=5 - pt 30.000000;80.000000 cop;clr=2.000000;2.000000 - pt 70.000000;80.000000 cop;clr=2.000000;2.000000 - seg concave 0: - arc use=0 2.000000:-4.390638 -> 2.399027 [-4.390638 -1.991611] - arc use=1 6.000000:-4.390638 -> 2.399027 [-4.390638 -1.991611] tn=5 - pt 60.000000;110.000000 cop;clr=2.000000;2.000000 - arc use=1 center=60.000000;110.000000 r=0.000000 a=-1.249046;0.000000 - arc use=1 center=70.000000;80.000000 r=6.000000 a=-4.390638;2.399027 - arc use=1 center=50.000000;50.000000 r=6.000000 a=5.862371;-2.299963 - arc use=1 center=30.000000;80.000000 r=0.000000 a=-1.149982;0.000000 Index: trunk/src/libgrbs/regression/concave5.ref =================================================================== --- trunk/src/libgrbs/regression/concave5.ref (revision 1333) +++ trunk/src/libgrbs/regression/concave5.ref (nonexistent) @@ -1,14 +0,0 @@ - pt 50.000000;50.000000 cop;clr=2.000000;2.000000 - seg concave 0: - arc use=0 2.000000:0.815606 -> 1.343193 [0.815606 2.158799] - arc use=1 6.000000:0.815606 -> 1.343193 [0.815606 2.158799] tn=5 - pt 30.000000;80.000000 cop;clr=2.000000;2.000000 - pt 70.000000;80.000000 cop;clr=2.000000;2.000000 - seg convex 0: - arc use=0 2.000000:5.527995 -> 1.267835 [5.527995 6.795830] - arc use=1 6.000000:6.795830 -> -1.267835 [5.527995 6.795830] tn=5 - pt 60.000000;110.000000 cop;clr=2.000000;2.000000 - arc use=1 center=60.000000;110.000000 r=0.000000 a=-1.058152;0.000000 - arc use=1 center=70.000000;80.000000 r=6.000000 a=6.795830;-1.267835 - arc use=1 center=50.000000;50.000000 r=6.000000 a=0.815606;1.343193 - arc use=1 center=30.000000;80.000000 r=0.000000 a=-0.982794;0.000000 Index: trunk/src/libgrbs/grbs.h =================================================================== --- trunk/src/libgrbs/grbs.h (revision 1333) +++ trunk/src/libgrbs/grbs.h (nonexistent) @@ -1,170 +0,0 @@ -#ifndef LIBGRBS_GRBS_H -#define LIBGRBS_GRBS_H - -#include -#include - -#define GRBS_MAX_SEG 16 - -typedef struct grbs_point_s grbs_point_t; -typedef struct grbs_arc_s grbs_arc_t; -typedef struct grbs_2net_s grbs_2net_t; -typedef struct grbs_s grbs_t; -typedef struct grbs_addr_s grbs_addr_t; - -typedef enum grbs_arc_dir_e { /* the exact values are important because of array indexing */ - GRBS_ADIR_INC = -1, - GRBS_ADIR_CONVEX_CCW = 0, - GRBS_ADIR_CONVEX_CW = 1, - GRBS_ADIR_CONCAVE_CCW = 10, - GRBS_ADIR_CONCAVE_CW = 11, -} grbs_arc_dir_t; - -#define grbs_adir_is_CW(adir) (((adir) == GRBS_ADIR_CONVEX_CW) || ((adir) == GRBS_ADIR_CONCAVE_CW)) -#define grbs_adir_is_CCW(adir) (((adir) == GRBS_ADIR_CONVEX_CCW) || ((adir) == GRBS_ADIR_CONCAVE_CCW)) -#define grbs_adir_is_convex(adir) (((adir) == GRBS_ADIR_CONVEX_CW) || ((adir) == GRBS_ADIR_CONVEX_CCW)) -#define grbs_adir_is_concave(adir) (((adir) == GRBS_ADIR_CONCAVE_CW) || ((adir) == GRBS_ADIR_CONCAVE_CCW)) -#define grbs_adir_is_arc(adir) ((adir) >= 0) - - -struct grbs_arc_s { - long uid; - - double r; /* in case of incident line: 0 */ - double sa, da; /* start and delta angle; in case of incident line only sa is used */ - int segi; /* segment index around pt */ - double copper, clearance; - - double new_r; /* in case of incident line: 0 */ - double new_sa, new_da; /* start and delta angle; in case of incident line only sa is used; in case of concave arcs, this is not the same as bicycle angle, but is the incident angle */ -/* int new_segi; not needed: can't differ from segi */ - int new_adir; /* if non-zero: direction the arc can progress from sa (+1 or -1, sign of new_da) */ - - unsigned in_use:1; /* whether r, sa and da are valid */ - unsigned new_in_use:1; /* whether new_r, new_sa and new_da are valid */ - unsigned concave:1; /* if 1, both current and new are concave */ - - grbs_point_t *parent_pt; /* can't be deduced from link_arcs because it can be on either of 2 lists */ - - gdl_elem_t link_2net; - gdl_elem_t link_point; - gdl_elem_t link_arcs; - - void *user_data; -}; - -struct grbs_point_s { - long uid; - - double x, y; - double copper, clearance; - gdl_list_t incs; /* of grbs_arc_t; incident line endpoints */ - gdl_list_t arcs[2][GRBS_MAX_SEG]; /* of grbs_arc_t; attached arcs, per curvature (convex=0, concave=1), per segment */ - - gdl_elem_t link_points; - - void *user_data; -}; - -struct grbs_2net_s { - long uid; - - gdl_list_t arcs; /* ordered from start to end */ - double copper; /* trace width/2 */ - double clearance; - - gdl_elem_t link_2nets; - - void *user_data; -}; - -struct grbs_s { - long uids; - - /* user settable callbacks (optional) */ - void (*coll_report_cb)(grbs_t *grbs, grbs_2net_t *tn, grbs_2net_t *coll_tn, grbs_arc_t *coll_arc); /* rounting tn happened to collide with coll_tn; if coll_arc is not NULL, the collision happened at that arc */ - - /* keep track on all objects so they can be freed or quickly reallocated */ - gdl_list_t all_2nets, free_2nets; - gdl_list_t all_points, free_points; - gdl_list_t all_arcs, free_arcs; - - /* caches */ - uall_sysalloc_t sys; - uall_stacks_t stk_points; - uall_stacks_t stk_2nets; - uall_stacks_t stk_arcs; - uall_stacks_t stk_addrs; - - void *user_data; -}; - -typedef enum { - /* base addr */ - ADDR_ARC_CONVEX = 0x01, /* convex go-around: ((*)) ; use obj.arc */ - ADDR_ARC_CONCAVE = 0x02, /* concave go-around: ))*(( ; use obj.arc */ - ADDR_POINT = 0x03, /* incident, without an arc allocated; use obj.pt */ - - /* modifier: arc start or endpoint */ - ADDR_ARC_START = 0x10, - ADDR_ARC_END = 0x20 -} grbs_addr_type_t; - -struct grbs_addr_s { - grbs_addr_type_t type; - union { - grbs_arc_t *arc; - grbs_point_t *pt; - } obj; - void *user_data; -} ; - - -/* A detached address is a safe address to store while running an A*; this - trick is required because when visiting new points the grbs_addr_t often - will be based on a newly created sentinel but after rollback that sentinel - won't exist. So a detached address saves arc only if it's permanent. Plus - it saves the "new" fields so they can be reproduced */ -typedef struct grbs_detached_addr_s { - grbs_addr_type_t type; - grbs_arc_t *arc; /* if NULL, try to create a new sentinel */ - grbs_point_t *pt; - void *user_data; /* copied from grbs_addr_t */ - long user_long; /* spare field for the caller to use */ - - /* these fields are the same as in grbs_arc_t */ - double new_r; - double new_sa, new_da; - int new_adir; - unsigned concave:1; -} grbs_detached_addr_t; - -#define grbs_addr_is_convex(addr) (((addr)->type & 0x0F) == ADDR_ARC_CONVEX) -#define grbs_addr_is_concave(addr) (((addr)->type & 0x0F) == ADDR_ARC_CONCAVE) - -void grbs_init(grbs_t *grbs); -void grbs_uninit(grbs_t *grbs); - -/* object allocation */ -grbs_point_t *grbs_point_new(grbs_t *grbs, double x, double y, double copper, double clearance); -grbs_arc_t *grbs_arc_new(grbs_t *grbs, grbs_point_t *parent, int seg, double r, double sa, double da, int is_concave); -grbs_2net_t *grbs_2net_new(grbs_t *grbs, double copper, double clearance); -void grbs_point_free(grbs_t *grbs, grbs_point_t *p); -void grbs_arc_free(grbs_t *grbs, grbs_arc_t *a); -void grbs_2net_free(grbs_t *grbs, grbs_2net_t *tn); -grbs_addr_t *grbs_addr_new(grbs_t *grbs, grbs_addr_type_t type, void *obj); -void grbs_addr_free_last(grbs_t *grbs); - -#define grbs_arc_parent_2net(arc) \ - ((((arc)->link_2net.parent) == NULL) ? NULL : \ - (((grbs_2net_t *)(((char *)((arc)->link_2net.parent)) - offsetof(grbs_2net_t, arcs))))) - -/* Convert an address into a portable detached addr. Does _not_ free addr */ -void grbs_detach_addr(grbs_t *grbs, grbs_detached_addr_t *dst, grbs_addr_t *addr); - -/* Convert a detached address into an address, creating sentinel if needed - and setting the returned addr's ->new_* fields. A path can be continued - from the returned address */ -grbs_addr_t *grbs_reattach_addr(grbs_t *grbs, grbs_detached_addr_t *src); - -#endif /* LIBGRBS_GRBS_H */ Index: trunk/src/libgrbs/route.h =================================================================== --- trunk/src/libgrbs/route.h (revision 1333) +++ trunk/src/libgrbs/route.h (nonexistent) @@ -1,20 +0,0 @@ -grbs_addr_t *grbs_path_next(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *from, grbs_point_t *to_pt, grbs_arc_dir_t dir); -grbs_arc_t *grbs_path_realize(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *addr, int reverse); -int grbs_path_validate(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *prev_addr, grbs_addr_t *addr, grbs_addr_t *next_addr); - -/* rip-up: remove an address or a whole 2net (and free address(es)) */ -void grbs_path_remove_addr(grbs_t *grbs, grbs_addr_t *addr); -void grbs_path_remove_arc(grbs_t *grbs, grbs_arc_t *arc); -void grbs_path_remove_2net(grbs_t *grbs, grbs_2net_t *tn); - -/* Free all addresses and reset all temporary arcs */ -void grbs_path_cleanup_addr(grbs_t *grbs, grbs_addr_t *addr); -void grbs_path_cleanup_by_tn(grbs_t *grbs, grbs_2net_t *tn); /* faster */ -void grbs_path_cleanup_all(grbs_t *grbs); /* slower */ - - -/*** Optional post processing ***/ - -/* Tune angles of cocanve arcs so corners respect clearance to neighbor - concave or incident lines */ -void grbs_pp_concave_corners(grbs_t *grbs); Index: trunk/src/libgrbs/route_common.c =================================================================== --- trunk/src/libgrbs/route_common.c (revision 1333) +++ trunk/src/libgrbs/route_common.c (nonexistent) @@ -1,370 +0,0 @@ -/*#define GRBS_ROUTE_COMMON_TRACE*/ - -#undef tprinf -#ifdef GRBS_ROUTE_COMMON_TRACE -#include -#define tprintf printf -#else -#define tprintf grbs_nullprintf -#endif - -static const int shrink_concave = 0; - -/* Calculate the radius of a new orbit (arc->new_r) around addr for tn */ -static double grbs_get_new_radius_(grbs_t *grbs, grbs_2net_t *tn, grbs_arc_t *arc) -{ - return arc->r + arc->copper + tn->copper + GRBS_MAX(arc->clearance, tn->clearance); -} - -static double grbs_get_new_radius(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *addr) -{ - assert((addr->type & ADDR_ARC_CONVEX) || (addr->type & ADDR_ARC_CONCAVE)); - assert((addr->type & 0xF0) != 0); - - return grbs_get_new_radius_(grbs, tn, addr->obj.arc); -} - -static void grbs_get_arc_end_(grbs_t *grbs, grbs_2net_t *tn, grbs_arc_t *arc, int which, double *ex, double *ey) -{ - double ang, r; - - assert((which == 0) || (which == 1)); - - ang = arc->new_sa; - if (which == 1) - ang += arc->new_da; - - r = grbs_get_new_radius_(grbs, tn, arc); - - *ex = arc->parent_pt->x + cos(ang) * r; - *ey = arc->parent_pt->y + sin(ang) * r; -} - -static void grbs_get_new_arc_end(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *addr, int which, double *ex, double *ey) -{ - assert((addr->type & ADDR_ARC_CONVEX) || (addr->type & ADDR_ARC_CONCAVE)); - assert((addr->type & 0xF0) != 0); - - grbs_get_arc_end_(grbs, tn, addr->obj.arc, which, ex, ey); -} - -/* Return if ang is a valid entry/exit point between two existing arcs - (addr being the arc below) */ -static int grbs_angle_visible_between_arcs(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *addr, double ang) -{ - grbs_arc_t *under = addr->obj.arc; - grbs_arc_t *above = under->link_point.next; - - if ((above == NULL) && (under->da == 0)) /* new segment with yet zero length - always accept */ - return 1; - - /* has to be within the arc under, else it will cross the under-arc or its line */ - if (!grbs_angle_in_arc(under->sa, under->da, ang, 1)) { - coll_report_arc(grbs, tn, under); - return 0; - } - - /* has to be outside the arc above, else it will cross the above-arc or its line */ - if ((above != NULL) && (grbs_angle_in_arc(above->sa, above->da, ang, 0))) { - coll_report_arc(grbs, tn, above); - return 0; - } - - return 1; -} - -/* Check if a given angle range (for an arc) crosses any incident line of that pt */ -static int arc_crosses_any_incident(grbs_t *grbs, grbs_2net_t *tn, grbs_point_t *pt, double sa, double da) -{ - grbs_arc_t *i; - - for(i = gdl_first(&pt->incs); i != NULL; i = gdl_next(&pt->incs, i)) { - if (grbs_angle_in_arc(sa, da, i->sa, 0)) { - coll_report_arc(grbs, tn, i); - return 1; - } - } - - return 0; -} - -/* find next arc in dir: the one that starts or ends closest to our - startpoint in the right direction */ -static grbs_arc_t *grbs_next_seg(grbs_point_t *from_pt, int from_segi, int from_conc, double from_arc_sa, int adir) -{ - grbs_arc_t *arc, *best_arc = NULL; - double da, best_da = 4*M_PI; - int n; - - for(n = 0; n < GRBS_MAX_SEG; n++) { - if (n == from_segi) /* self collision */ - continue; - arc = gdl_first(&from_pt->arcs[from_conc][n]); - if (arc == NULL) - continue; - da = grbs_arc_get_delta(from_arc_sa, arc->sa, adir); - if (da < best_da) { - best_da = da; - best_arc = arc; - } - da = grbs_arc_get_delta(from_arc_sa, arc->sa + arc->da, adir); - if (da < best_da) { - best_da = da; - best_arc = arc; - } - } - - return best_arc; -} - -/* Checks if convex-below-concave does not cross a concave arc. Returns 0 if - the concave arc 'from' is valid or non-zero on crossing */ -static int convex_below_concave_validate(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *from, double new_da) -{ - int cnc_segi; - - for(cnc_segi = 0; cnc_segi < GRBS_MAX_SEG; cnc_segi++) { - grbs_arc_t *cnc_sentinel = gdl_first(&from->obj.arc->parent_pt->arcs[1][cnc_segi]); - double enda; - - if (cnc_sentinel == NULL) continue; - - printf("sent: %f %f convex: %f %f\n", cnc_sentinel->sa, cnc_sentinel->da, from->obj.arc->new_sa, new_da); - - if (grbs_angle_in_arc(cnc_sentinel->sa, cnc_sentinel->da, from->obj.arc->new_sa, 0)) { - coll_report_arc(grbs, tn, cnc_sentinel->link_point.next); - tprintf("convex_below_concave_validate: start angle\n"); - return 1; - } - - enda = from->obj.arc->new_sa + new_da; - if (enda > 2*M_PI) enda -= 2*M_PI; - if (enda < 0) enda += 2*M_PI; - - if (grbs_angle_in_arc(cnc_sentinel->sa, cnc_sentinel->da, enda, 0)) { - coll_report_arc(grbs, tn, cnc_sentinel->link_point.next); - tprintf("convex_below_concave_validate: end angle\n"); - return 1; - } - } - return 0; -} - - -/* "from" is an existing arc with a start angle where the current route - entered the orbit in its sector; "end_a" is where it should exit (the - direction is known from "from"). This function checks wether this enter-exit - is valid and potentially merges orbit segments */ -int grbs_arc_tune4exit(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *from, double end_a) -{ - grbs_arc_t *best_arc = NULL, *sentinel; - double nsa, nda; - int adir = from->obj.arc->new_adir, is_new_seg, collides_next, from_conc = grbs_addr_is_concave(from); - grbs_point_t *from_pt = addr_point(from); - - assert(from->type & ADDR_ARC_END); - - nsa = from->obj.arc->new_sa; - nda = grbs_arc_get_delta(nsa, end_a, adir); - - if (arc_crosses_any_incident(grbs, tn, from->obj.arc->parent_pt, nsa, nda)) { - tprintf("tune4exit: incident cross\n"); - return -1; - } - - if (!from_conc && convex_below_concave_validate(grbs, tn, from, nda)) - return -1; - - - from->obj.arc->new_da = nda; - - is_new_seg = ((from->obj.arc->link_point.next == NULL) && (from->obj.arc->link_point.prev == NULL) && !from->obj.arc->in_use); - - best_arc = grbs_next_seg(from_pt, from->obj.arc->segi, from_conc, nsa, adir); -/* printf("@@@ best arc: %p\n", best_arc);*/ - - /* first arc around this point -> always works */ - if (best_arc == NULL) { -/* printf(" -> first arc\n");*/ - goto fin; - } - - /* whether the next existing arc is within our new arc */ - collides_next = grbs_angle_in_arc(nsa, nda, best_arc->sa, 1) || grbs_angle_in_arc(nsa, nda, best_arc->sa + best_arc->da, 1); - - /* 'from' can extend anything only if it's a new segment - we never merge - existing segments as that would always make crossings */ - if (!is_new_seg) { - if (collides_next) { - coll_report_arc(grbs, tn, best_arc); - goto fail; /* new arc within an existing segment would cross a different segment */ - } - goto fin; - } - - - /* from is a new segment, check if it needs to be merged with the next */ - if (collides_next) { - int to_sid = best_arc->segi; -/* printf(" --> extend!\n");*/ - - /* The only possible way the new, wider arc would be able to extend - is if it becomes the first arc. By now we know it starts before the - lowest orbit, because that's how it got a new segment originally. Check - if end is beyond the lowest orbit of the target segment (best_arc) */ - if (grbs_angle_in_arc(best_arc->sa, best_arc->da, nsa+nda, 0)) { - coll_report_arc(grbs, tn, best_arc); - goto fail; /* existing arc would cross our new arc */ - } - - /* remove 'from' from its new segment and add it as lowest orbit under best_arc */ - gdl_remove(&from_pt->arcs[from_conc][from->obj.arc->segi], from->obj.arc, link_point); - - sentinel = gdl_first(&from_pt->arcs[from_conc][to_sid]); - if (!sentinel->new_in_use) { - gdl_remove(&from_pt->arcs[from_conc][to_sid], sentinel, link_point); - gdl_insert(&from_pt->arcs[from_conc][to_sid], from->obj.arc, link_point); - from->obj.arc->sa = sentinel->sa; - from->obj.arc->da = sentinel->da; - grbs_arc_free(grbs, sentinel); - } - else - gdl_insert_after(&from_pt->arcs[from_conc][to_sid], sentinel, from->obj.arc, link_point); - - from->obj.arc->segi = to_sid; - } - - fin:; - if (((from->type & 0x0F) == ADDR_ARC_CONCAVE) && shrink_concave) - from->obj.arc->new_da -= adir * (tn->copper + tn->clearance) / from->obj.arc->new_r; - - - return 0; - - fail:; - from->obj.arc->new_da = 0; /* keep the to-be-new-seg */ - return -1; -} - -/* Decide if the exit side of an arc continues the right direction; returns - non-zero for invalid curving. Invalid curving is a concave go-around that - has started as convex: the incoming line starts a tangential arc but the - next exit of that arc is not continuing forward but goes backward */ -static int grbs_invalid_convex_(grbs_t *grbs, grbs_point_t *pt, double r, double arc_ang, int adir, double other_x, double other_y) -{ - double cs = cos(arc_ang), sn = sin(arc_ang); - double rx = cs * r, ry = sn * r; /* radius vector */ - double tx = -ry, ty = rx; /* tangent vector */ - double ax = pt->x + rx, ay = pt->y + ry; /* arc endpoint */ - double vx = other_x - ax, vy = other_y - ay; /* outgoing line vector */ - double diff; - int res; - - if (adir < 0) { - tx = -tx; - ty = -ty; - } - -/* tang = atan2(ty, tx); vang = atan2(vy, vx); res = fabs(tang-vang) > 0.001; */ - - diff = atan2(ty*vx - vy*tx, tx*vx + ty*vy); /* same as atan(t) - atan(v); see https://en.wikipedia.org/wiki/Atan2 */ - res = (diff < -0.001) || (diff > 0.001); - - tprintf(" Invalid convex_: v=(%f;%f) t=(%f;%f) arcdir=%d -> %d\n", vx, vy, tx, ty, adir, res); - return res; -} - -/* choose the angle-side that continues the trace: check delta angle - for both possible angle-sides in our predefined trace direction and - pick the one that is shorter and is convex */ -static int from_arc_ang_side(grbs_t *grbs, grbs_addr_t *from, double to_x, double to_y, double a[2], int is_convex) -{ - int as, from_ang_side = -1, is_concave = !is_convex; - double best_da; - - assert(from->obj.arc->new_adir != 0); - - best_da = 2*M_PI+1; - for(as = 0; as < 2; as++) { - double da = fabs(grbs_arc_get_delta(from->obj.arc->new_sa, a[as], from->obj.arc->new_adir)); - if (da < best_da) { - if (is_concave || (!grbs_invalid_convex_(grbs, from->obj.arc->parent_pt, from->obj.arc->new_r, a[as], from->obj.arc->new_adir, to_x, to_y))) { - from_ang_side = as; - best_da = da; - } - } - } - - return from_ang_side; -} - -grbs_arc_t *grbs_new_sentinel(grbs_t *grbs, grbs_point_t *pt, double sa, double da, int is_concave, int *seg_out) -{ - int n; - - for(n = 0; n < GRBS_MAX_SEG; n++) { - grbs_arc_t *seg = gdl_first(&pt->arcs[is_concave][n]); - if (seg == NULL) { - seg = grbs_arc_new(grbs, pt, n, pt->copper, sa, da, is_concave); - seg->copper = 0; - seg->clearance = pt->clearance; - if (seg_out != NULL) *seg_out = n; - return seg; - } - } - - if (seg_out != NULL) *seg_out = -1; - return NULL; -} - -int grbs_get_seg_idx(grbs_t *grbs, grbs_point_t *pt, double ang, int is_concave) -{ - int n; - - /* simple case: angle is within the range of an existing segment */ - for(n = 0; n < GRBS_MAX_SEG; n++) { - grbs_arc_t *seg = gdl_first(&pt->arcs[is_concave][n]); - if (seg != NULL) { - if ((seg->new_in_use) && (grbs_angle_in_arc(seg->new_sa, seg->new_da, ang, 1))) - return -1; /* Spiral: we are about to enter above a new orbit we created */ - - /* do not chekc for seg->in_use: first arc could be a sentinel representing the angle span */ - if (grbs_angle_in_arc(seg->sa, seg->da, ang, 1)) { - if (seg->new_in_use) - return -1; /* Spiral: we are about to enter under a new orbit we created */ - return n; - } - } - } - - /* ang is in an empty zone, allocate a new sentinel, zero length */ - if (grbs_new_sentinel(grbs, pt, ang, 0, is_concave, &n) != NULL) - return n; - - return -1; /* probably ran out of available sentinel slots */ -} - -/* returns 1 if sentinel got removed */ -int grbs_clean_unused_sentinel_seg(grbs_t *grbs, grbs_point_t *pt, int cnc, int segi) -{ - grbs_arc_t *seg = gdl_first(&pt->arcs[cnc][segi]); - - if ((seg != NULL) && !seg->new_in_use && (seg->link_point.next == NULL)) { - gdl_remove(&pt->arcs[cnc][segi], seg, link_point); - grbs_arc_free(grbs, seg); - return 1; - } - - return 0; -} - -/* remove any orphaned sentinel so that it won't limit new segments or - segment expansion */ -void grbs_clean_unused_sentinel(grbs_t *grbs, grbs_point_t *pt) -{ - int segi, cnc; - - for(cnc = 0; cnc < 2; cnc++) - for(segi = 0; segi < GRBS_MAX_SEG; segi++) - grbs_clean_unused_sentinel_seg(grbs, pt, cnc, segi); -} Index: trunk/src/libgrbs/tester.c =================================================================== --- trunk/src/libgrbs/tester.c (revision 1333) +++ trunk/src/libgrbs/tester.c (nonexistent) @@ -1,732 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -grbs_t ctx; -htsp_t name2obj; -int CGI = 0; - -#define shift_name(args, req_uniq) \ -do { \ - args = strpbrk(args, " \t"); \ - if (args != NULL) { \ - *args = '\0'; \ - args++; \ - } \ - else \ - args = ""; \ - if (req_uniq) { \ - if (htsp_get(&name2obj, name) != NULL) { \ - fprintf(stderr, "error: name %s is already in use\n", name); \ - return -1; \ - } \ - } \ -} while(0) - -#define obj_by_name(dst, name, errmsg) \ -do { \ - dst = htsp_get(&name2obj, name); \ - if (dst == NULL) { \ - fprintf(stderr, "%s by the name '%s'\n", errmsg, name); \ - return -1; \ - } \ -} while(0) - -#define remember(name, obj) \ - htsp_set(&name2obj, strdup(name), obj) - -#define forget(name) \ -do { \ - htsp_entry_t *e = htsp_popentry(&name2obj, name); \ - if (e != NULL) \ - free(e->key); \ -} while(0) - -#define ERR_SYNTAX -42 - -static int parse_cmd(char *cmd, char *args); - -static int cmd_point_new(char *args) -{ - char *name = args; - double x, y, co, cl; - grbs_point_t *p; - - shift_name(args, 1); - if (sscanf(args, "%lf %lf %lf %lf", &x, &y, &co, &cl) != 4) { - fprintf(stderr, "syntax error in point_new args; should be: name x y copper clearance\n"); - return -1; - } - - p = grbs_point_new(&ctx, x, y, co, cl); - remember(name, p); - - return 0; -} - -static int cmd_svg_begin(char *args) -{ - char *name = args; - FILE *f; - - shift_name(args, 1); - f = fopen(args, "w"); - if (f == NULL) { - fprintf(stderr, "svg_begin: can't open file '%s' for write\n", args); - return -1; - } - - grbs_svg_begin(&ctx, f); - remember(name, f); - - return 0; -} - -static int cmd_svg_end(char *args) -{ - char *name = args; - FILE *f; - - obj_by_name(f, name, "svg_end: no open svg"); - - grbs_svg_end(&ctx, f); - fclose(f); - forget(name); - - return 0; -} - -static int cmd_fill_circle(char *args) -{ - char *name = args; - double x, y, sr; - int pos; - FILE *f; - - shift_name(args, 0); - obj_by_name(f, name, "fill_circle: no open svg"); - - if (sscanf(args, "%lf %lf %lf %n", &x, &y, &sr, &pos) != 3) { - fprintf(stderr, "syntax error in fill_circle; should be: svgname x y sr color\n"); - return -1; - } - - grbs_svg_fill_circle(f, x, y, sr, args+pos); - return 0; -} - -static int cmd_wf_circle(char *args) -{ - char *name = args; - double x, y, sr; - int pos; - FILE *f; - - shift_name(args, 0); - obj_by_name(f, name, "wf_circle: no open svg"); - - if (sscanf(args, "%lf %lf %lf %n", &x, &y, &sr, &pos) != 3) { - fprintf(stderr, "syntax error in wf_circle; should be: svgname x y sr color\n"); - return -1; - } - - grbs_svg_wf_circle(f, x, y, sr, args+pos); - return 0; -} - -static int cmd_fill_line(char *args) -{ - char *name = args; - double x1, y1, x2, y2, sr; - int pos; - FILE *f; - - shift_name(args, 0); - obj_by_name(f, name, "fill_line: no open svg"); - - if (sscanf(args, "%lf %lf %lf %lf %lf %n", &x1, &y1, &x2, &y2, &sr, &pos) != 5) { - fprintf(stderr, "syntax error in fill_line; should be: svgname x1 y1 x2 y2 sr color\n"); - return -1; - } - - grbs_svg_fill_line(f, x1, y1, x2, y2, sr, args+pos); - return 0; -} - -static int cmd_wf_line(char *args) -{ - char *name = args; - double x1, y1, x2, y2, sr; - int pos; - FILE *f; - - shift_name(args, 0); - obj_by_name(f, name, "wf_line: no open svg"); - - if (sscanf(args, "%lf %lf %lf %lf %lf %n", &x1, &y1, &x2, &y2, &sr, &pos) != 5) { - fprintf(stderr, "syntax error in wf_line; should be: svgname x1 y1 x2 y2 sr color\n"); - return -1; - } - - grbs_svg_wf_line(f, x1, y1, x2, y2, sr, args+pos); - return 0; -} - -static int cmd_fill_arc(char *args) -{ - char *name = args; - double cx, cy, r, sa, da, sr; - int pos; - FILE *f; - - shift_name(args, 0); - obj_by_name(f, name, "fill_arc: no open svg"); - - if (sscanf(args, "%lf %lf %lf %lf %lf %lf %n", &cx, &cy, &r, &sa, &da, &sr, &pos) != 6) { - fprintf(stderr, "syntax error in fill_arc; should be: svgname cx, cy, r, start_abgle, end_angle, stroke_radius, color\n"); - return -1; - } - - grbs_svg_fill_arc(f, cx, cy, r, sa, da, sr, args+pos); - return 0; -} - -static int cmd_wf_arc(char *args) -{ - char *name = args; - double cx, cy, r, sa, da, sr; - int pos; - FILE *f; - - shift_name(args, 0); - obj_by_name(f, name, "wf_arc: no open svg"); - - if (sscanf(args, "%lf %lf %lf %lf %lf %lf %n", &cx, &cy, &r, &sa, &da, &sr, &pos) != 6) { - fprintf(stderr, "syntax error in wf_arc; should be: svgname cx, cy, r, start_abgle, end_angle, stroke_radius, color\n"); - return -1; - } - - grbs_svg_wf_arc(f, cx, cy, r, sa, da, sr, args+pos); - return 0; -} - -static void d1() {} - -#define shift_word(s, next) \ -do { \ - if (s != NULL) { \ - next = strpbrk(s, " \t"); \ - if (next != NULL) { \ - *next = '\0'; \ - next++; \ - } \ - while(isspace(*s)) s++; \ - if ((strcmp(s, "break") == 0) || (strcmp(s, "bp") == 0)) { \ - d1(); \ - s = next; \ - continue; \ - } \ - } \ - else \ - next = NULL; \ - break; \ -} while(1) - -static int cmd_draw(char *args) -{ - char *name = args, *s, *next; - int points = 0, wires = 0; - FILE *f; - - shift_name(args, 0); - obj_by_name(f, name, "draw: no open svg"); - - for(s = args; s != NULL; s = next) { - shift_word(s, next); - if (*s == '\0') - break; - if (strcmp(s, "all") == 0) - points = wires = 1; - else if (strcmp(s, "points") == 0) - points = 1; - else if (strcmp(s, "wires") == 0) - wires = 1; - else { - fprintf(stderr, "error: draw: no such thing to draw: '%s'\n", s); - } - } - - if (points) - grbs_svg_draw_points(&ctx, f); - - if (wires) - grbs_svg_draw_wires(&ctx, f); - - return 0; -} - -static int cmd_dump(char *args) -{ - char *s, *next; - int points = 0, wires = 0; - FILE *f; - - f = stdout; - - for(s = args; s != NULL; s = next) { - shift_word(s, next); - if (*s == '\0') - break; - if (strcmp(s, "all") == 0) - points = wires = 1; - else if (strcmp(s, "points") == 0) - points = 1; - else if (strcmp(s, "wires") == 0) - wires = 1; - else { - fprintf(stderr, "error: draw: no such thing to draw: '%s'\n", s); - } - } - - if (points) - grbs_svg_dump_points(&ctx, f); - - if (wires) - grbs_svg_dump_wires(&ctx, f); - - return 0; -} - -#define DETACHED -42 -grbs_addr_t *last_addr = NULL, *head = NULL; -static int path_parse_append(grbs_2net_t *tn, char *args) -{ - - grbs_addr_t *addr; - char *s, *cmd, *pt, *next; - int curr_dir, res = -1, concave; - grbs_point_t *curr = NULL; - - - for(s = args; s != NULL; s = next) { - shift_word(s, next); cmd = s; s = next; - - if (strcmp(cmd, "reattach") == 0) { - grbs_detached_addr_t *det; - char *name; - - shift_word(s, next); name = s; s = next; - obj_by_name(det, name, "no such detached address"); - addr = grbs_reattach_addr(&ctx, det); - free(det); - if (addr == NULL) { - fprintf(stderr, "error: failed to reattach at %s\n", s); - return -1; - } - - addr->user_data = head; - head = last_addr = addr; - continue; - } - - - concave = 0; - curr_dir = -1; - - /* decode optional cmd prefix */ - if (strcmp(cmd, "concave") == 0) { - concave = 10; - shift_word(s, next); cmd = s; s = next; /* affects the next word */ - } - - shift_word(s, next); pt = s; - - if (*cmd == '\0') - break; - - /* decode cmd */ - if (strcmp(cmd, "pause") == 0) - return 0; - else if (strcmp(cmd, "detach") == 0) { - grbs_detached_addr_t *det = malloc(sizeof(grbs_detached_addr_t)); - grbs_detach_addr(&ctx, det, last_addr); - shift_word(s, next); - remember(s, det); - res = DETACHED; - goto err; - } - else if ((strcmp(cmd, "from") == 0) || (strcmp(cmd, "to") == 0)) - curr_dir = GRBS_ADIR_INC; - else if (strcmp(cmd, "cw") == 0) - curr_dir = GRBS_ADIR_CONVEX_CW + concave; - else if (strcmp(cmd, "ccw") == 0) - curr_dir = GRBS_ADIR_CONVEX_CCW + concave; - else { - fprintf(stderr, "Invalid path at '%s': expected from, to or around\n", cmd); - goto err; - } - - - /* find the point */ - obj_by_name(curr, pt, "Path: no point"); - - if (last_addr != NULL) { - addr = grbs_path_next(&ctx, tn, last_addr, curr, curr_dir); -/* printf("draw to %p:%d a=%p\n", curr, curr_dir, addr);*/ - last_addr = addr; - } - else { - addr = last_addr = grbs_addr_new(&ctx, ADDR_POINT, curr); -/* printf("draw from %p:%d a=%p\n", curr, curr_dir, last_addr);*/ - } - - if (addr != NULL) { - /* use ->user_data to build a singly linked list of addresses for this route */ - addr->user_data = head; - head = addr; - } - else { - fprintf(stderr, "Invalid path at '%s': failed to create arc\n", s); - goto err; - } - } - - /* check if the final path doesn't contain intersecting lines */ - last_addr = NULL; - for(addr = head; addr != NULL; addr = addr->user_data) { - if (grbs_path_validate(&ctx, tn, last_addr, addr, addr->user_data) != 0) { - fprintf(stderr, "Invalid path at '%s': failed to validate\n", s); - goto err; - } - last_addr = addr; - } - - /* reconstruct the path */ - for(addr = head; addr != NULL; addr = addr->user_data) - grbs_path_realize(&ctx, tn, addr, 0); - - res = 0; - - err:; - /* free all temporary addrs used for the routing */ - grbs_path_cleanup_all(&ctx); - - last_addr = NULL; - head = NULL; - return res; -} - -static int cmd_2net_new(char *args) -{ - char *name = args; - double co, cl; - grbs_2net_t *tn; - int pos, res; - - shift_name(args, 1); - - if (sscanf(args, "%lf %lf %n", &co, &cl, &pos) != 2) { - fprintf(stderr, "syntax error in 2net_new args; should be: name copper clearance [path]\n"); - return -1; - } - - args += pos; - tn = grbs_2net_new(&ctx, co, cl); - - res = path_parse_append(tn, args); - if (res == DETACHED) - res = 0; - else - remember(name, tn); - return res; -} - -static int cmd_2net_del(char *args) -{ - char *name = args; - grbs_2net_t *tn; - - shift_name(args, 0); - obj_by_name(tn, name, "No such two-net"); - - grbs_path_remove_2net(&ctx, tn); - forget(name); - return 0; -} - -static int cmd_2net_append(char *args) -{ - char *name = args; - grbs_2net_t *tn; - - shift_name(args, 0); - obj_by_name(tn, name, "No such two-net"); - - while(isspace(*args)) args++; - return path_parse_append(tn, args); -} - -static int cmd_2net_cleanup(char *args) -{ - grbs_addr_t *addr; - - for(addr = head; addr != NULL; addr = addr->user_data) - grbs_path_cleanup_addr(&ctx, addr); - - uall_stacks_clean(&ctx.stk_addrs); - - return 0; -} - - -static int cmd_geo_bicycle(char *args) -{ - char *name = args; - double cx1, cy1, r1, cx2, cy2, r2, sr; - double a[4]; - char *color; - int pos, res, cross; - FILE *f; - - shift_name(args, 0); - obj_by_name(f, name, "geo_bicycle: no open svg"); - - if (sscanf(args, "%lf %lf %lf %lf %lf %lf %lf %d %n", &cx1, &cy1, &r1, &cx2, &cy2, &r2, &sr, &cross, &pos) != 8) { - fprintf(stderr, "syntax error in geo_bicycle; should be: svgname cx1 cy1 r1 cx2 cy2 r2 sr color\n"); - return -1; - } - color = args+pos; - - res = grbs_bicycle_angles(cx1, cy1, r1, cx2, cy2, r2, a, cross); - if (res == 0) { - int n, m; - - for(n = 0; n < 2; n++) { - double x1, y1, x2, y2; - m = cross ? (!n) : n; - x1 = cx1 + cos(a[n+0]) * r1; y1 = cy1 + sin(a[n+0]) * r1; - x2 = cx2 + cos(a[m+2]) * r2; y2 = cy2 + sin(a[m+2]) * r2; - grbs_svg_wf_line(f, x1, y1, x2, y2, sr, color); - } - } - else - fprintf(stderr, "invalid bicycle\n"); - return 0; - -} - -static int cmd_echo(char *args) -{ - if (!CGI) - printf("%s\n", args); - return 0; -} - -static int cmd_fail(char *cmd) -{ - char *args; - int res; - - args = strpbrk(cmd, " \t"); - if (args != NULL) { - *args = '\0'; - args++; - while(isspace(*args)) args++; - } - else - args = ""; - - res = parse_cmd(cmd, args); - if (res == ERR_SYNTAX) - return res; - if (res == 0) { - fprintf(stderr, "command '%s' is expected to fail but did not fail\n", cmd); - return -1; - } - return 0; -} - - -static int cmd_pp_concave(char *cmd) -{ - grbs_pp_concave_corners(&ctx); - return 0; -} - -static int parse_cmd(char *cmd, char *args) -{ - if (*cmd == '\0') return 0; - - if (strcmp(cmd, "point_new") == 0) return cmd_point_new(args); - if (strcmp(cmd, "svg_begin") == 0) return cmd_svg_begin(args); - if (strcmp(cmd, "svg_end") == 0) return cmd_svg_end(args); - if (strcmp(cmd, "fill_circle") == 0) return cmd_fill_circle(args); - if (strcmp(cmd, "wf_circle") == 0) return cmd_wf_circle(args); - if (strcmp(cmd, "fill_line") == 0) return cmd_fill_line(args); - if (strcmp(cmd, "wf_line") == 0) return cmd_wf_line(args); - if (strcmp(cmd, "fill_arc") == 0) return cmd_fill_arc(args); - if (strcmp(cmd, "wf_arc") == 0) return cmd_wf_arc(args); - if (strcmp(cmd, "draw") == 0) return cmd_draw(args); - if (strcmp(cmd, "dump") == 0) return cmd_dump(args); - if (strcmp(cmd, "2net_new") == 0) return cmd_2net_new(args); - if (strcmp(cmd, "2net_del") == 0) return cmd_2net_del(args); - if (strcmp(cmd, "2net_append") == 0) return cmd_2net_append(args); - if (strcmp(cmd, "2net_cleanup") == 0) return cmd_2net_cleanup(args); - if (strcmp(cmd, "geo_bicycle") == 0) return cmd_geo_bicycle(args); - if (strcmp(cmd, "echo") == 0) return cmd_echo(args); - if (strcmp(cmd, "fail") == 0) return cmd_fail(args); - if (strcmp(cmd, "pp_concave") == 0) return cmd_pp_concave(args); - - - fprintf(stderr, "syntax error: unknown command %s\n", cmd); - return ERR_SYNTAX; -} - -int parse(char *line) -{ - char *cmd, *args, *end; - - while(isspace(*line)) line++; - if (*line == '#') - return 0; - - cmd = line; - args = strpbrk(cmd, " \t\r\n"); - if (args != NULL) { - *args = '\0'; - args++; - while(isspace(*args)) args++; - end = strpbrk(args, "\r\n"); - if (end != NULL) - *end = '\0'; - } - return parse_cmd(cmd, args); -} - -int fparse(FILE *f) -{ - char line[1024]; - long lno = 0; - - while(fgets(line, 1024, f) != NULL) { - lno++; - if (parse(line) != 0) { - fprintf(stderr, " (in line %ld)\n", lno); - return -1; - } - } - return 0; -} - -int main(int argc, char *argv[]) -{ - int res, n; - FILE *f; - char *filename, *basename = NULL, bn[1024], *sep, *basename_end; - int dump_svg = 0, dump_text = 0; - - f = stdin; - for(n = 1; n < argc; n++) { - char *cmd = argv[n], *arg = argv[n+1]; - while(*cmd == '-') cmd++; - switch(*cmd) { - case 'C': CGI = 1; break; - case 'f': - if (basename != NULL) { - fprintf(stderr, "only one -f accepted\n"); - return -1; - } - n++; - filename = arg; - sep = strrchr(filename, '.'); - if (sep == NULL) - sep = filename+strlen(filename); - if ((sep - filename) > sizeof(bn)-8) { - fprintf(stderr, "path '%s' is too long (%ld)\n", filename, (long)(sep - filename)); - return -1; - } - strncpy(bn, filename, sep-filename); - bn[sep-filename] = '\0'; - basename = bn; - basename_end = basename + (sep-filename); - f = fopen(filename, "r"); - if (f == NULL) { - fprintf(stderr, "can not open file '%s' for read\n", filename); - return -1; - } - break; - case 's': dump_svg = 1; break; - case 'd': dump_text = 1; break; - } - } - - - grbs_init(&ctx); - htsp_init(&name2obj, strhash, strkeyeq); - - res = fparse(f); - - if (CGI && (res == 0)) { - printf("Content-Type: image/svg+xml\n\n"); - grbs_svg_begin(&ctx, stdout); - grbs_svg_draw_points(&ctx, stdout); - grbs_svg_draw_wires(&ctx, stdout); - grbs_svg_end(&ctx, stdout); - } - - if (dump_svg) { - if (basename != NULL) { - FILE *fo; - - strcpy(basename_end, ".svg"); - fo = fopen(basename, "w"); - if (fo != NULL) { - grbs_svg_begin(&ctx, fo); - grbs_svg_draw_points(&ctx, fo); - grbs_svg_draw_wires(&ctx, fo); - grbs_svg_end(&ctx, fo); - fclose(fo); - } - else - fprintf(stderr, "Failed to open '%s' for write for -s\n", basename); - *basename_end = '\0'; - } - else - fprintf(stderr, "Can't save svg on -s without -f\n"); - } - - if (dump_text) { - if (basename != NULL) { - FILE *fo; - - strcpy(basename_end, ".dump"); - fo = fopen(basename, "w"); - if (fo != NULL) { - grbs_svg_dump_points(&ctx, fo); - grbs_svg_dump_wires(&ctx, fo); - fclose(fo); - } - else - fprintf(stderr, "Failed to open '%s' for write for -d\n", basename); - *basename_end = '\0'; - } - else - fprintf(stderr, "Can't save dump on -d without -f\n"); - } - - genht_uninit_deep(htsp, &name2obj, { - free(htent->key); - }); - grbs_uninit(&ctx); - - return res; -} Index: trunk/src/libgrbs/route_detach.c =================================================================== --- trunk/src/libgrbs/route_detach.c (revision 1333) +++ trunk/src/libgrbs/route_detach.c (nonexistent) @@ -1,61 +0,0 @@ -/* remove the 'new' */ -void grbs_detach_addr(grbs_t *grbs, grbs_detached_addr_t *dst, grbs_addr_t *addr) -{ - dst->type = addr->type; - dst->user_data = addr->user_data; - - - switch(addr->type & 0x0F) { - case ADDR_ARC_CONVEX: - case ADDR_ARC_CONCAVE: - dst->arc = addr->obj.arc; - dst->pt = addr->obj.arc->parent_pt; - dst->new_sa = addr->obj.arc->new_sa; - dst->new_da = addr->obj.arc->new_da; - dst->new_r = addr->obj.arc->new_r; - dst->new_adir = addr->obj.arc->new_adir; - dst->concave = addr->obj.arc->concave; - - addr->obj.arc->new_in_use = 0; - if (grbs_clean_unused_sentinel_seg(grbs, addr->obj.arc->parent_pt, addr->obj.arc->concave, addr->obj.arc->segi)) - dst->arc = NULL; /* sentinel got removed */ - break; - case ADDR_POINT: - dst->arc = NULL; - dst->pt = addr->obj.pt; - break; - } -} - -grbs_addr_t *grbs_reattach_addr(grbs_t *grbs, grbs_detached_addr_t *src) -{ - grbs_addr_t *addr = grbs_addr_new(grbs, src->type, NULL); - - addr->user_data = src->user_data; - - switch(src->type & 0x0F) { - case ADDR_ARC_CONVEX: - case ADDR_ARC_CONCAVE: - if (src->arc == NULL) { - int segi; - /* need to allocate a new sentinel */ - addr->obj.arc = grbs_new_sentinel(grbs, src->pt, src->new_sa, src->new_da, src->concave, &segi); - addr->obj.arc->segi = segi; - } - else - addr->obj.arc = src->arc; - - addr->obj.arc->new_r = src->new_r; - addr->obj.arc->new_sa = src->new_sa; - addr->obj.arc->new_da = src->new_da; - addr->obj.arc->new_adir = src->new_adir; - addr->obj.arc->new_in_use = 1; - break; - - case ADDR_POINT: - addr->obj.pt = src->pt; - break; - } - - return addr; -} Index: trunk/src/libgrbs/route_realize.c =================================================================== --- trunk/src/libgrbs/route_realize.c (revision 1333) +++ trunk/src/libgrbs/route_realize.c (nonexistent) @@ -1,508 +0,0 @@ -/*#define GRBS_ROUTE_REALIZE_TRACE*/ - -#undef tprinf -#ifdef GRBS_ROUTE_REALIZE_TRACE -#include -#define tprintf printf -#else -#define tprintf grbs_nullprintf -#endif - -/* update the sentinel (segment info) so that delta angle is always positive and - matches the first arc's (narc) */ -static void update_seg_sentinel_angles(grbs_arc_t *sentinel, grbs_arc_t *narc) -{ - double sa = narc->sa, da = narc->da; - if (da < 0) { /* normalize angles so the sentinel arc is always positive */ - sa = sa + da; - da = -da; - } - sentinel->sa = sa; - sentinel->da = da; -} - -/* if narc is the lowest orbit, update the sentinel, assuming narc has changed */ -static void auto_update_seg_sentinel_angles(grbs_arc_t *narc) -{ - grbs_arc_t *sentinel = narc->link_point.parent->first; - if ((sentinel != NULL) && (sentinel->link_point.next == narc)) - update_seg_sentinel_angles(sentinel, narc); -} - - -/* Calculate angle side to move - try to find the closest angle between old and new */ -static int grbs_angle_update_get_ang_side(grbs_arc_t *arc, int at_end, double olda[2], double a[2]) -{ - int ang_side; - double ta, best_ta = 4 * M_PI, diff, real_ta; - - if (at_end) - ta = arc->sa + arc->da; - else - ta = arc->sa; - - if (ta < 0) - ta += 2.0 * M_PI; - - /* check ang_side for 0 and 1 to see if ta is closer: */ - - /* olda[0] and plain ta is the best so far... */ - ang_side = 0; - best_ta = fabs(olda[0] - ta); - real_ta = ta; - - /* ... then check the other combinations of ang_side ang ta vs. ta - 2*pi */ - diff = fabs(olda[0] - (ta - 2.0 * M_PI)); - if (diff < best_ta) { - ang_side = 0; - best_ta = diff; - real_ta = ta - 2.0 * M_PI; - } - - diff = fabs(olda[1] - ta); - if (diff < best_ta) { - ang_side = 1; - best_ta = diff; - real_ta = ta; - } - - diff = fabs(olda[1] - (ta - 2.0 * M_PI)); - if (diff < best_ta) { - ang_side = 1; - best_ta = diff; - real_ta = ta - 2.0 * M_PI; - } - - - tprintf("center: %f %f\n", arc->parent_pt->x, arc->parent_pt->y); - tprintf("TUNE ang_side=%d ta=%f (real_ta=%f) %f -> %f olda=(%f %f)\n", ang_side, ta, real_ta, olda[ang_side], a[ang_side], olda[0], olda[1]); - - - /* make sure the old angle picked is the right one after all */ - assert(fabs(olda[ang_side] - real_ta) < 0.001); - - return ang_side; -} - -/* Move one end point of arc to match ang */ -static void grbs_angle_update_ang_end(grbs_arc_t *arc, int at_end, double ang, grbs_arc_t *from) -{ - if (arc->r == 0) { - double ex, ey, ea; - assert(from != NULL); - ea = at_end ? from->sa : from->sa + from->da; - ex = from->parent_pt->x + cos(ea) * from->r; - ey = from->parent_pt->y + sin(ea) * from->r; - arc->sa = atan2(ey - arc->parent_pt->y, ex - arc->parent_pt->x); - } - else if (at_end) { - arc->da = grbs_arc_get_delta(arc->sa, ang, arc->da > 0 ? +1 : -1); /* don't change the other side angle */ - } - else { - double old = arc->sa; - arc->sa = ang; - arc->da = grbs_arc_get_delta(arc->sa, old + arc->da, arc->da > 0 ? +1 : -1); /* don't change the other side angle */ - } -} - -/* Radius of "arc" changed, tune the angle knowing the adjacent arc on route; - returns whether any angle has been changed */ -static int grbs_angle_update_ang1(grbs_t *grbs, grbs_arc_t *arc, int at_end, grbs_arc_t *next, double oldr) -{ - double olda[4], a[4], nextr; - int ang_side, next_ang_side, next_at_end, crossbelt = 0; - - if (((arc->da > 0) && (next->da < 0)) || ((arc->da < 0) && (next->da > 0))) - crossbelt = 1; - - nextr = next->r; - if (next->concave) - nextr = 0; - - if (grbs_bicycle_angles(arc->parent_pt->x, arc->parent_pt->y, oldr, next->parent_pt->x, next->parent_pt->y, nextr, olda, crossbelt) != 0) - return 0; - if (grbs_bicycle_angles(arc->parent_pt->x, arc->parent_pt->y, arc->r, next->parent_pt->x, next->parent_pt->y, nextr, a, crossbelt) != 0) - return 0; - - if (next->concave) { - double ox, oy, ta; - cnc_get_end_arc(arc, at_end, &ox, &oy); - ta = -atan2(next->parent_pt->y - oy, next->parent_pt->x - ox); - if (ta < 0) - ta += 2.0 * M_PI; - if (fabs(ta - next->sa) < 0.001) - next_ang_side = 0; - else { - assert(fabs(ta - (next->sa + next->da)) < 0.001); - next_ang_side = 1; - } - - olda[2+next_ang_side] = ta; - next_at_end = next_ang_side; - } - else { - next_at_end = !at_end; - if (next->r != 0) - next_ang_side = grbs_angle_update_get_ang_side(next, next_at_end, olda+2, a+2); - else - next_ang_side = !at_end; /* incident line special casing */ - } - - /* tune the angle this side */ - ang_side = grbs_angle_update_get_ang_side(arc, at_end, olda, a); - grbs_angle_update_ang_end(arc, at_end, a[ang_side], NULL); - - /* tune the angle of the other side (next) */ - grbs_angle_update_ang_end(next, next_at_end, a[next_ang_side+2], arc); - auto_update_seg_sentinel_angles(next); - return 1; -} - -/* Radius of "arc" changed, tune the angles; oldr is the previous radius */ -static void grbs_angle_update(grbs_t *grbs, grbs_arc_t *arc, double oldr) -{ - grbs_arc_t *next, *prev; - int changed = 0; - - if (arc->concave) - return; /* concave arcs keep their angles on move */ /* concave-target-angle */ - - next = arc->link_2net.next; - prev = arc->link_2net.prev; - - - if (prev != NULL) changed += grbs_angle_update_ang1(grbs, arc, 0, prev, oldr); - if (next != NULL) changed += grbs_angle_update_ang1(grbs, arc, 1, next, oldr); - - if (changed) - auto_update_seg_sentinel_angles(arc); -} - -/* Calculate incident angles (e.g. on start/end, after a route has been realized) */ -static void grbs_inc_ang_update(grbs_t *grbs, grbs_arc_t *a) -{ - double cx, cy, nx, ny, ang; - grbs_arc_t *next; - - assert(a->r == 0); - - /* get the endpoint of the next arc segment */ - if (a->link_2net.next != NULL) { - next = a->link_2net.next; - ang = next->sa; - } - else if (a->link_2net.prev != NULL) { - next = a->link_2net.prev; - ang = next->sa + next->da; - } - else - return; /* placed incident arc first, no next yet */ - - cx = a->parent_pt->x; - cy = a->parent_pt->y; - nx = next->parent_pt->x + next->r * cos(ang); - ny = next->parent_pt->y + next->r * sin(ang); - - a->sa = atan2(ny - cy, nx - cx); -} - -/* When a new arc is inserted, increase radius of existing arcs and tune - their end angles */ -static void bump_seg_radii(grbs_t *grbs, grbs_arc_t *from, double incr) -{ - grbs_arc_t *a; - - tprintf(" bump_seg_radii:\n"); - for(a = from; a != NULL; a = a->link_point.next) { - double oldr = a->r; - a->r += incr; - tprintf(" %f -> %f a=%p %p\n", oldr, a->r, a, a->link_point.next); - grbs_angle_update(grbs, a, oldr); - } -} - -/* Calculate the minimum r for the lowest concave orbit from the highest - convex arc and current tn; this shall be done only when tn is inserted - as the lowest concave orbit */ -static double bump_get_highest_convex(grbs_t *grbs, grbs_2net_t *tn, grbs_arc_t *conc_sentinel, double *highest_copper, double *highest_clearance) -{ - int conv_segi; - double highest = 0, hnewr; - - for(conv_segi = 0; conv_segi < GRBS_MAX_SEG; conv_segi++) { - grbs_arc_t *convex_last; - grbs_arc_t *conv_sentinel = gdl_first(&conc_sentinel->parent_pt->arcs[0][conv_segi]); - - if ((conv_sentinel == NULL) || (!grbs_arc_overlaps_arc_new(conv_sentinel, conc_sentinel))) continue; - - convex_last = gdl_last(&conv_sentinel->parent_pt->arcs[0][conv_segi]); - - hnewr = convex_last->r + tn->copper + convex_last->copper + GRBS_MAX(tn->clearance, convex_last->clearance); - if (hnewr > highest) { - highest = hnewr; - *highest_copper = convex_last->copper; - *highest_clearance = convex_last->clearance; - } - } - - return highest; -} - -/* if there is anything above the new arc, make room for it by - pushing the above-arcs further (by exactly as much as the new arc - is going to take) */ -static double bump_seg_radii_any(grbs_t *grbs, grbs_2net_t *tn, grbs_arc_t *arc, int *need_narc_post_update, double *narc_oldr_out, int is_concave) -{ - grbs_arc_t *next; - double prev_copper, prev_clearance, newr, incr, prevr; - double narc_oldr = 0, narcr = arc->new_r; - - - /* simple case: either convex or concave without convex segments below: - previous radius:copper:clearance is the same-segment arc below or the point */ - if (!arc->in_use) { - prev_copper = arc->parent_pt->copper; - prev_clearance = arc->parent_pt->clearance; - prevr = 0; - } - else { - prev_copper = arc->copper; - prev_clearance = arc->clearance; - prevr = arc->r; - } - - /* when adding a new concave on bottom it's radius may depend on any - convex region that overlaps with ours */ - if (is_concave && (arc->link_point.prev == NULL)) { - double cop, clr, hnewr; - hnewr = bump_get_highest_convex(grbs, tn, arc, &cop, &clr); - - /* new radius of our concave arc if it was only for the highest convex below */ - if ((hnewr > 0) && (hnewr > narcr)) - narcr = hnewr; - } - - next = grbs_next_arc_in_use(arc); - if (next == NULL) { - *narc_oldr_out = 0; - return narcr; - } - - newr = prevr + prev_copper + tn->copper + GRBS_MAX(prev_clearance, tn->clearance); /* new arc added on top of the previous */ - tprintf("newr=%f != %f (prev=%f/%f curr=%f/%f)\n", newr, narcr, prev_copper, prev_clearance, tn->copper, tn->clearance); - if (newr != narcr) { - narc_oldr = narcr; - narcr = newr; /* may replace an arc with smaller or larger spacing reqs... */ - tprintf(" new narc r: %f -> %f\n", narc_oldr, narcr); - *need_narc_post_update = 1; - } - - newr = narcr + tn->copper + next->copper + GRBS_MAX(next->clearance, tn->clearance); /* new radius of the next route */ - incr = newr - next->r; - tprintf("incr; narc->r=%f newr=%f oldr=%f incr=%f W: next=%f/%f curr=%f/%f\n", narcr, newr, next->r, incr, next->copper, next->clearance, tn->copper, tn->clearance); - - bump_seg_radii(grbs, next, incr); - *narc_oldr_out = narc_oldr; - return narcr; -} - -/* bump any concave segment that is in overlap with our convex */ -static void bump_seg_radii_concave_above_convex(grbs_t *grbs, grbs_arc_t *convex_sentinel) -{ - int conc_segi; - - for(conc_segi = 0; conc_segi < GRBS_MAX_SEG; conc_segi++) { - double newr; - grbs_arc_t *convex_last, *conc_first; - grbs_arc_t *conc_sentinel = gdl_first(&convex_sentinel->parent_pt->arcs[1][conc_segi]); - - if ((conc_sentinel == NULL) || (!grbs_arc_overlaps_arc(convex_sentinel, conc_sentinel))) continue; - - convex_last = gdl_last(&convex_sentinel->parent_pt->arcs[0][convex_sentinel->segi]); - conc_first = conc_sentinel->link_point.next; - - if (conc_first == NULL) - return; /* orphaned concave */ - - newr = convex_last->r + convex_last->copper + conc_first->copper + GRBS_MAX(convex_last->clearance, conc_first->clearance); /* new arc added on top of the previous */ - if (newr > conc_first->r) - bump_seg_radii(grbs, conc_first, newr - conc_first->r); - } -} - -grbs_arc_t *grbs_path_realize(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *addr, int reverse) -{ - grbs_arc_t *arc, *narc, *a, *first; - grbs_point_t *pt; - int rev = 1, need_narc_post_update = 0, type = (addr->type & 0x0F), is_concave = (type == ADDR_ARC_CONCAVE); - double narcr, narc_oldr; - - switch(type) { - case ADDR_ARC_CONVEX: - case ADDR_ARC_CONCAVE: - arc = addr->obj.arc; - assert(arc->new_in_use); - - pt = arc->parent_pt; - first = gdl_first(&pt->arcs[is_concave][arc->segi]); - - /* make room for the new arc */ - narcr = bump_seg_radii_any(grbs, tn, arc, &need_narc_post_update, &narc_oldr, is_concave); - - /* now that we have the room: insert the new arc */ - if (rev) - narc = grbs_arc_new(grbs, arc->parent_pt, arc->segi, narcr, arc->new_sa + arc->new_da, -arc->new_da, arc->concave); - else - narc = grbs_arc_new(grbs, arc->parent_pt, arc->segi, narcr, arc->new_sa, arc->new_da, arc->concave); - arc->new_r = arc->new_sa = arc->new_da = 0; - arc->new_in_use = 0; - - if (arc == first) - update_seg_sentinel_angles(first, narc); - - /* if we inserted a convex, we need to bump any concave above it as well */ - if (!is_concave) { - /* have to set these up temporarily, because first concave radius - calculation depends on these if our arc is the highest orbit convex */ - narc->copper = tn->copper; - narc->clearance = tn->clearance; - - bump_seg_radii_concave_above_convex(grbs, first); - } - -#warning TODO: line coll on the last line - - if (coll_check_arc(grbs, tn, narc)) { - grbs_arc_free(grbs, narc); - return NULL; - } - - break; - - case ADDR_POINT: - pt = addr->obj.pt; - /* this will insert the new arc in the ->incs list becuase r=0 (segi doesn't matter) */ - narc = grbs_arc_new(grbs, pt, 0, 0, 0, 0, 0); -#warning TODO: line coll - break; - - default: abort(); - } - - narc->in_use = 1; - narc->copper = tn->copper; - narc->clearance = tn->clearance; - - if (reverse) - gdl_insert(&tn->arcs, narc, link_2net); - else - gdl_append(&tn->arcs, narc, link_2net); - - if (narc->r == 0) { - grbs_inc_ang_update(grbs, narc); - /* there is no sentinel under an incident */ - } - else { - if (need_narc_post_update) - grbs_angle_update(grbs, narc, narc_oldr); - auto_update_seg_sentinel_angles(narc); - } - - /* when the second arc is placed, go back and calc the incident angle of - the first which was unknown by the time it was created, if route start - is incident (TODO: else it's a backrolled partial route's last arc which) */ - if (gdl_length(&tn->arcs) == 2) { - a = gdl_first(&tn->arcs); - if (a->r == 0) - grbs_inc_ang_update(grbs, a); - } - - return narc; -} - -int grbs_path_validate(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *prev_addr, grbs_addr_t *addr, grbs_addr_t *next_addr) -{ - int ty, type = (addr->type & 0x0F); - grbs_arc_t *arc = addr->obj.arc; - grbs_point_t *pt; - double ax1, ay1, ax2, ay2, bx1, by1, bx2, by2; - - switch(type) { - case ADDR_ARC_CONVEX: - - /* check for self intersecting lines */ - if ((arc->new_da <= M_PI) && (arc->new_da >= -M_PI)) - return 0; /* no intersection possible if angle is below 180 deg */ - - /* do not do anything if there are no two exit lines */ - if ((prev_addr == NULL) || (next_addr == NULL)) - return 0; - - /* determine local arc endpoints of the exit lines */ - pt = arc->parent_pt; - ax1 = pt->x + cos(arc->new_sa + arc->new_da) * arc->new_r; - ay1 = pt->y + sin(arc->new_sa + arc->new_da) * arc->new_r; - bx1 = pt->x + cos(arc->new_sa) * arc->new_r; - by1 = pt->y + sin(arc->new_sa) * arc->new_r; - - /* determine remote arc endpoints of the exit lines */ - ty = (prev_addr->type & 0x0F); - if (ty == ADDR_POINT) { - ax2 = prev_addr->obj.pt->x; - ay2 = prev_addr->obj.pt->y; - } - else { - grbs_arc_t *prev = prev_addr->obj.arc; - ax2 = prev->parent_pt->x + cos(prev->new_sa) * prev->new_r; - ay2 = prev->parent_pt->y + sin(prev->new_sa) * prev->new_r; - } - - ty = (next_addr->type & 0x0F); - if (ty == ADDR_POINT) { - bx2 = next_addr->obj.pt->x; - by2 = next_addr->obj.pt->y; - } - else { - grbs_arc_t *next = next_addr->obj.arc; - bx2 = next->parent_pt->x + cos(next->new_sa + next->new_da) * next->new_r; - by2 = next->parent_pt->y + sin(next->new_sa + next->new_da) * next->new_r; - } - - return grbs_line_isc_line(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2); - } - return 0; -} - -void grbs_path_cleanup_all(grbs_t *grbs) -{ - grbs_arc_t *a, *next; - for(a = gdl_first(&grbs->all_arcs); a != NULL; a = next) { - next = gdl_next(&grbs->all_arcs, a); - a->new_in_use = 0; - grbs_clean_unused_sentinel_seg(grbs, a->parent_pt, a->concave, a->segi); - } - uall_stacks_clean(&grbs->stk_addrs); -} - -void grbs_path_cleanup_addr(grbs_t *grbs, grbs_addr_t *addr) -{ - switch(addr->type & 0x0F) { - case ADDR_ARC_CONVEX: - case ADDR_ARC_CONCAVE: - addr->obj.arc->new_in_use = 0; - grbs_clean_unused_sentinel_seg(grbs, addr->obj.arc->parent_pt, addr->obj.arc->concave, addr->obj.arc->segi); - break; - case ADDR_POINT: - break; - } -} - -void grbs_path_cleanup_by_tn(grbs_t *grbs, grbs_2net_t *tn) -{ - grbs_addr_t *addr; - - for(addr = gdl_first(&tn->arcs); addr != NULL; addr = gdl_next(&tn->arcs, addr)) - grbs_path_cleanup_addr(grbs, addr); - uall_stacks_clean(&grbs->stk_addrs); -} - Index: trunk/src/libgrbs/addr.c =================================================================== --- trunk/src/libgrbs/addr.c (revision 1333) +++ trunk/src/libgrbs/addr.c (nonexistent) @@ -1,27 +0,0 @@ -#define addr_is_incident(addr) (((addr)->type & 0x0F) == ADDR_POINT) - -static grbs_point_t *addr_point(const grbs_addr_t *addr) -{ - switch(addr->type & 0x0F) { - case ADDR_ARC_CONVEX: - case ADDR_ARC_CONCAVE: - return addr->obj.arc->parent_pt; - case ADDR_POINT: - return addr->obj.pt; - } - abort(); - return 0; -} - -static double addr_radius(const grbs_addr_t *addr) -{ - switch(addr->type & 0x0F) { - case ADDR_ARC_CONVEX: - case ADDR_ARC_CONCAVE: - return addr->obj.arc->r; - case ADDR_POINT: - return 0; - } - abort(); - return 0; -} Index: trunk/src/libgrbs/geo.c =================================================================== --- trunk/src/libgrbs/geo.c (revision 1333) +++ trunk/src/libgrbs/geo.c (nonexistent) @@ -1,173 +0,0 @@ -#include - -#include "geo.h" - -int grbs_bicycle_angles(double cx1, double cy1, double r1, double cx2, double cy2, double r2, double a[4], int cross) -{ - double dx = cx2 - cx1, dy = cy2 - cy1; - double dlen, alpha, beta; - - dlen = sqrt(dx*dx + dy*dy); - - if (fabs(r2-r1) >= dlen) - return -1; /* degenerate case: bigger circle contains the smaller one; also catchec concentric */ - - if (cross) - alpha = acos((r1 + r2) / dlen); - else - alpha = acos((r1 - r2) / dlen); - beta = atan2(dy, dx); - - a[0] = beta + alpha; - a[1] = beta - alpha; - if (cross) { - a[2] = beta + (M_PI - alpha); - a[3] = beta - (M_PI - alpha); - } - else { - a[2] = a[0]; - a[3] = a[1]; - } - - if (a[0] < 0) a[0] += 2.0*M_PI; - if (a[1] < 0) a[1] += 2.0*M_PI; - if (a[2] < 0) a[2] += 2.0*M_PI; - if (a[3] < 0) a[3] += 2.0*M_PI; - - return 0; -} - -int grbs_angle_in_arc(double arc_sa, double arc_da, double ang, int inclusive) -{ - double arc_ea; - - /* make sure angle is always positive */ - if (ang < 0) - ang += 2.0 * M_PI; - - if (arc_da < 0) { /* swap endpoints so da is always positive */ - arc_sa = arc_sa + arc_da; - arc_da = -arc_da; - } - if (arc_sa < 0) - arc_sa += 2.0*M_PI; - - arc_ea = arc_sa + arc_da; - - /* if arc spans from some high value through zero, the end angle has - to be larger than 2*pi; if ang is under both start and end, that may - be the case so add a full circle to ang, last chance to get it in - range */ - if ((arc_sa > ang) && (arc_ea > ang)) - ang += 2.0*M_PI; - - if (inclusive) { - if ((ang >= arc_sa) && (ang <= arc_ea)) - return 1; - } - else { - if ((ang > arc_sa) && (ang < arc_ea)) - return 1; - } - - if (arc_ea > 2.0*M_PI) { - ang += 2.0*M_PI; - if (inclusive) { - if ((ang >= arc_sa) && (ang <= arc_ea)) - return 1; - } - else { - if ((ang > arc_sa) && (ang < arc_ea)) - return 1; - } - } - - return 0; -} - -double grbs_arc_get_delta(double sa, double ea, int dir) -{ - double da; - - if (dir > 0) { - da = ea - sa; - if (da < 0) - da = 2*M_PI + da; - else if (da > 2*M_PI) - da -= 2*M_PI; - return da; - } - else { - da = sa - ea; - if (da < 0) - da = 2*M_PI + da; - else if (da > 2*M_PI) - da -= 2*M_PI; - return -da; - } -} - -int grbs_get_adir(double from_x, double from_y, double to_cx, double to_cy, double to_r, double to_a) -{ - double vx = to_cx - from_x, vy = to_cy - from_y, asplit; - int top_side; - - /* cut the circle in half by incoming centerline the see which half - the actual line hits */ - asplit = atan2(vy, vx); - top_side = grbs_angle_in_arc(asplit, M_PI, to_a, 1); - - return top_side ? -1 : +1; -} - -grbs_arc_t *grbs_next_arc_in_use(grbs_arc_t *arc) -{ - for(arc = arc->link_point.next; arc != NULL; arc = arc->link_point.next) - if (arc->in_use) - return arc; - return NULL; -} - -grbs_arc_t *grbs_prev_arc_in_use(grbs_arc_t *arc) -{ - for(arc = arc->link_point.prev; arc != NULL; arc = arc->link_point.prev) - if (arc->in_use) - return arc; - return NULL; -} - - -static double grbs_crossp(double x1, double y1, double x2, double y2) -{ - return (x1 * y2 - y1 * x2); -} - -/* Basic idea borrowed from gengeo2d (and in turn from pcb-rnd) */ -int grbs_line_isc_line(double ax1, double ay1, double ax2, double ay2, double bx1, double by1, double bx2, double by2) -{ - double s, r, adx, ady, bdx, bdy, ptx, pty; - - adx = ax2 - ax1; ady = ay2 - ay1; - bdx = bx2 - bx1; bdy = by2 - by1; - ptx = ax1 - bx1; pty = ay1 - by1; - - s = grbs_crossp(adx, ady, ptx, pty); - r = grbs_crossp(adx, ady, bdx, bdy); - - if (r == 0.0) { /* parallel or overlapping lines */ - if (s == 0.0) - return 2; /* overlap */ - return 0; /* parallel */ - } - - s /= r; - r = grbs_crossp(bdx, bdy, ptx, pty) / r; - - if ((r >= 0.0) && (r <= 1.0) && (s >= 0.0) && (s <= 1.0)) { - /* intersection is within the limits of line 'b' (r) and line 'a' (s)*/ - return 1; - } - - /* intersection is not on the line segments */ - return 0; -} Index: trunk/src/libgrbs/route_remove.c =================================================================== --- trunk/src/libgrbs/route_remove.c (revision 1333) +++ trunk/src/libgrbs/route_remove.c (nonexistent) @@ -1,199 +0,0 @@ -/*#define GRBS_ROUTE_REMOVE_TRACE*/ - -#undef tprinf -#ifdef GRBS_ROUTE_REMOVE_TRACE -#include -#define tprintf printf -#else -#define tprintf grbs_nullprintf -#endif - -/* Calculate the minimum r for the lowest concave orbit from the highest - convex arc */ -static double shrink_get_highest_convex(grbs_t *grbs, grbs_arc_t *conc_sentinel, double *highest_copper, double *highest_clearance) -{ - int conv_segi; - double highest = 0, hnewr; - - for(conv_segi = 0; conv_segi < GRBS_MAX_SEG; conv_segi++) { - grbs_arc_t *convex_last; - grbs_arc_t *conv_sentinel = gdl_first(&conc_sentinel->parent_pt->arcs[0][conv_segi]); - - if ((conv_sentinel == NULL) || (!grbs_arc_overlaps_arc_new(conv_sentinel, conc_sentinel))) continue; - - convex_last = gdl_last(&conv_sentinel->parent_pt->arcs[0][conv_segi]); - - hnewr = convex_last->r + convex_last->copper + convex_last->clearance; - if (hnewr > highest) { - highest = hnewr; - *highest_copper = convex_last->copper; - *highest_clearance = convex_last->clearance; - } - } - - return highest; -} - -/* if there is anything above the new arc, shrink radius pushing the - above-arcs lower (by exactly as much as twonet tn took) */ -static grbs_arc_t *shrink_seg_radii_any(grbs_t *grbs, grbs_arc_t *arc, int *need_narc_post_update, double *narc_oldr_out, int is_concave) -{ - grbs_arc_t *next, *prev; - double prev_copper, prev_clearance, newr, incr, prevr; - double narc_oldr = 0, narcr; - - - prev = grbs_prev_arc_in_use(arc); - - /* simple case: either convex or concave without convex segments below: - previous radius:copper:clearance is the same-segment arc below or the point */ - if ((!arc->in_use) || (prev == NULL)) { - prev_copper = arc->parent_pt->copper; - prev_clearance = arc->parent_pt->clearance; - prevr = 0; - } - else { - prev_copper = prev->copper; - prev_clearance = prev->clearance; - prevr = prev->r; - } - - next = grbs_next_arc_in_use(arc); - if (next == NULL) { - *narc_oldr_out = 0; - return NULL; - } - narcr = next->r; - - /* when removing a concave on bottom it's radius may depend on any - convex region that overlaps with ours */ - if (is_concave && (arc->link_point.prev == NULL)) { - double cop, clr, hnewr; - hnewr = shrink_get_highest_convex(grbs, arc, &cop, &clr); - - /* new radius of our concave arc if it was only for the highest convex below */ - if ((hnewr > 0) && (hnewr > narcr)) - narcr = hnewr; - } - - - newr = prevr + prev_copper + next->copper + GRBS_MAX(prev_clearance, next->clearance); /* new arc added on top of the previous */ - tprintf("remove: newr=%f != %f (prev=%f/%f next=%f/%f)\n", newr, narcr, prev_copper, prev_clearance, next->copper, next->clearance); - if (newr != narcr) { - narc_oldr = narcr; - narcr = newr; /* may replace an arc with smaller or larger spacing reqs... */ - tprintf(" new narc r: %f -> %f\n", narc_oldr, narcr); - *need_narc_post_update = 1; - } - - incr = newr - next->r; - tprintf("decr; narc->r=%f newr=%f oldr=%f incr=%f W: next=%f/%f\n", narcr, newr, next->r, incr, next->copper, next->clearance); - - bump_seg_radii(grbs, next, incr); - *narc_oldr_out = narc_oldr; - return next; -} - - -static void grbs_del_arc(grbs_t *grbs, grbs_arc_t *arc) -{ - if (arc->link_2net.parent != NULL) - gdl_remove(arc->link_2net.parent, arc, link_2net); - gdl_remove(arc->link_point.parent, arc, link_point); - grbs_arc_free(grbs, arc); -} - -static void grbs_path_remove_incident(grbs_t *grbs, grbs_arc_t *arc) -{ - grbs_del_arc(grbs, arc); -} - -/* shrink any concave segment that is in overlap with our convex */ -static void shrink_seg_radii_concave_above_convex(grbs_t *grbs, grbs_arc_t *convex_sentinel) -{ - int conc_segi; - - for(conc_segi = 0; conc_segi < GRBS_MAX_SEG; conc_segi++) { - double newr; - grbs_arc_t *convex_last, *conc_first; - grbs_arc_t *conc_sentinel = gdl_first(&convex_sentinel->parent_pt->arcs[1][conc_segi]); - - if ((conc_sentinel == NULL) || (!grbs_arc_overlaps_arc(convex_sentinel, conc_sentinel))) continue; - - convex_last = gdl_last(&convex_sentinel->parent_pt->arcs[0][convex_sentinel->segi]); - conc_first = conc_sentinel->link_point.next; - - if (conc_first == NULL) - return; /* orphaned concave */ - - newr = convex_last->r + convex_last->copper + conc_first->copper + GRBS_MAX(convex_last->clearance, conc_first->clearance); /* new arc added on top of the previous */ - if (newr < conc_first->r) - bump_seg_radii(grbs, conc_first, newr - conc_first->r); - } -} - -void grbs_path_remove_arc(grbs_t *grbs, grbs_arc_t *arc) -{ - grbs_arc_t *first, *sarc, *sentinel; - int need_narc_post_update = 0; - double narc_oldr; - grbs_point_t *pt; - - if (arc->r == 0) { - grbs_path_remove_incident(grbs, arc); - return; - } - - pt = arc->parent_pt; - first = sentinel = gdl_first(&pt->arcs[arc->concave][arc->segi]); - if (!first->new_in_use) - first = gdl_next(&pt->arcs[arc->concave][arc->segi], first); /* for already realized arcs: first is the first above sentinel */ - - /* make room for the new arc */ - sarc = shrink_seg_radii_any(grbs, arc, &need_narc_post_update, &narc_oldr, arc->concave); - if (arc == first) { - if (sarc != NULL) - update_seg_sentinel_angles(sentinel, sarc); - else - grbs_del_arc(grbs, sentinel); - } - - /* if we removed a convex, we need to bump any concave above it as well */ - if (!arc->concave) - shrink_seg_radii_concave_above_convex(grbs, first); - - grbs_del_arc(grbs, arc); -} - - -void grbs_path_remove_addr(grbs_t *grbs, grbs_addr_t *addr) -{ - int type = (addr->type & 0x0F); - - switch(type) { - case ADDR_ARC_CONVEX: - case ADDR_ARC_CONCAVE: - grbs_path_remove_arc(grbs, addr->obj.arc); - break; - - case ADDR_POINT: - /* an address without an actual grbs_arc_t has no further effect - nothing to do here */ - break; - - default: abort(); - } -} - - - -void grbs_path_remove_2net(grbs_t *grbs, grbs_2net_t *tn) -{ - grbs_arc_t *n, *next; - for(n = gdl_first(&tn->arcs); n != NULL; n = next) { - next = gdl_next(&tn->arcs, n); - grbs_path_remove_arc(grbs, n); - } - - grbs_2net_free(grbs, tn); -} - Index: trunk/src/libgrbs/addr_hash.c =================================================================== --- trunk/src/libgrbs/addr_hash.c (revision 1333) +++ trunk/src/libgrbs/addr_hash.c (nonexistent) @@ -1,75 +0,0 @@ -#include "addr_hash.h" - -grbs_addr_key_t grbs_addr_new_to_key(const grbs_addr_t *addr) -{ - grbs_addr_key_t res = {0}; - grbs_arc_t *arc; - - switch(addr->type & 0x0f) { - case ADDR_ARC_CONVEX: res.is_concave = 0; break; - case ADDR_ARC_CONCAVE: res.is_concave = 1; break; - case ADDR_POINT: - res.pt_uid = addr->obj.pt->uid; - return res; - default: - assert(!"grbs_addr_new_to_key: invalid address type"); - abort(); - } - - /* convex or concave arc */ - arc = addr->obj.arc; - res.is_ccw = arc->new_adir < 0; - res.ang = (addr->type & ADDR_ARC_END) ? arc->new_sa + arc->new_da : arc->new_sa; - res.pt_uid = arc->parent_pt->uid; - - for(res.orbit = 0; arc != NULL; arc = arc->link_point.prev) - res.orbit++; - - return res; -} - -grbs_addr_key_t grbs_det_addr_to_key(const grbs_detached_addr_t *det) -{ - grbs_addr_key_t res = {0}; - grbs_arc_t *arc; - - res.pt_uid = det->pt->uid; - - if ((det->type & 0x0f) == ADDR_POINT) return res; - - /* convex or concave arc */ - res.ang = (det->type & ADDR_ARC_END) ? det->new_sa + det->new_da : det->new_sa; - res.is_concave = det->concave; - res.is_ccw = det->new_adir < 0; - - if (det->arc != NULL) { - for(res.orbit = 0, arc = det->arc; arc != NULL; arc = arc->link_point.prev) - res.orbit++; - } - else - res.orbit = 1; /* (det->arc == NULL) means first orbit over a new sentinel */ - - return res; -} - -grbs_addr_key_t grbs_point_to_key(const grbs_point_t *pt) -{ - grbs_addr_key_t res = {0}; - res.pt_uid = pt->uid; - return res; -} - - -int grbs_addr_hash_keyeq(grbs_addr_key_t a, grbs_addr_key_t b) -{ - int diff; - - /* cheap tests first */ - if ((a.orbit != b.orbit) || (a.is_concave != b.is_concave) || (a.pt_uid != b.pt_uid) || (a.is_ccw != b.is_ccw)) - return 0; - - /* for angle, allow +-1 for rounding errors */ - diff = a.ang - b.ang; - return (diff >= -1) && (diff <= 1); -} - Index: trunk/src/libgrbs/bugs/concave_inc.grbs =================================================================== --- trunk/src/libgrbs/bugs/concave_inc.grbs (revision 1333) +++ trunk/src/libgrbs/bugs/concave_inc.grbs (nonexistent) @@ -1,14 +0,0 @@ -# concave -> convex arc-to-arc cases - -point_new P0 50 50 2 2 - -point_new P1a 30 80 2 2 -point_new P1b 70 80 2 2 - -point_new P2 60 110 2 2 - - - -# arc2arc -2net_new n1 1 3 from P1a concave ccw P0 cw P1b to P2 -2net_new n2 1 3 from P0 cw P1b \ No newline at end of file Index: trunk/src/libgrbs/bugs/concave1.grbs =================================================================== --- trunk/src/libgrbs/bugs/concave1.grbs (revision 1333) +++ trunk/src/libgrbs/bugs/concave1.grbs (nonexistent) @@ -1,10 +0,0 @@ -# The incident angle of n1 is going to be updated because of n2 bumping -# the radius of n1's arc around P0b - -point_new P0 50 50 2 2 - -point_new P1a 30 30 2 2 -point_new P1b 70 30 2 2 - -2net_new n_concave 1 3 from P1a concave ccw P0 to P1b -2net_new n_concave 1 3 from P1a concave cw P0 to P1b Index: trunk/src/libgrbs/geo.h =================================================================== --- trunk/src/libgrbs/geo.h (revision 1333) +++ trunk/src/libgrbs/geo.h (nonexistent) @@ -1,28 +0,0 @@ -int grbs_bicycle_angles(double cx1, double cy1, double r1, double cx2, double cy2, double r2, double a[4], int cross); - -int grbs_angle_in_arc(double arc_sa, double arc_da, double ang, int inclusive); - -double grbs_arc_get_delta(double sa, double ea, int dir); - - -/* A line from point from_x;from_y is connecting to an arc, radius to_r, at - angle to_a. Assuming routing is coming from the point, through the line, - calculate and return arc angle direction to continue that line (+1 or -1). */ -int grbs_get_adir(double from_x, double from_y, double to_cx, double to_cy, double to_r, double to_a); - -/* Return the next or prev arc with in_use==1 around a point */ -grbs_arc_t *grbs_next_arc_in_use(grbs_arc_t *arc); -grbs_arc_t *grbs_prev_arc_in_use(grbs_arc_t *arc); - - -#define GRBS_MIN(a,b) ((a) < (b) ? (a) : (b)) -#define GRBS_MAX(a,b) ((a) > (b) ? (a) : (b)) - -#define grbs_arc_overlaps_arc(arc1, arc2) \ - (grbs_angle_in_arc((arc1)->sa, (arc1)->da, (arc2)->sa, 1) || grbs_angle_in_arc((arc1)->sa, (arc1)->da, ((arc2)->sa) + (arc2)->da, 1)) - -#define grbs_arc_overlaps_arc_new(arc1, arc2) \ - (grbs_angle_in_arc((arc1)->sa, (arc1)->da, (arc2)->new_sa, 1) || grbs_angle_in_arc((arc1)->sa, (arc1)->da, ((arc2)->new_sa) + (arc2)->new_da, 1)) - -/* Return if two lines intersect */ -int grbs_line_isc_line(double ax1, double ay1, double ax2, double ay2, double bx1, double by1, double bx2, double by2); Index: trunk/src/libgrbs/addr_hash.h =================================================================== --- trunk/src/libgrbs/addr_hash.h (revision 1333) +++ trunk/src/libgrbs/addr_hash.h (nonexistent) @@ -1,24 +0,0 @@ -#include "grbs.h" - -/* hash key that encodes a mostly topological point on an orbit */ -typedef struct grbs_addr_key_s { - unsigned short int ang; /* in (radian * 10000), normalized between 0 and 2*PI */ - unsigned char orbit; /* 0 means incident, 1 is the first (innermost non-sentinel) orbit in the segment */ - unsigned is_concave:1; - unsigned is_ccw:1; - unsigned pt_uid:32; -} grbs_addr_key_t; - - -/* Convert address or detached address to key */ -grbs_addr_key_t grbs_addr_new_to_key(const grbs_addr_t *addr); -grbs_addr_key_t grbs_det_addr_to_key(const grbs_detached_addr_t *det); -grbs_addr_key_t grbs_point_to_key(const grbs_point_t *pt); - -/* Standard functions for genht */ -int grbs_addr_hash_keyeq(grbs_addr_key_t a, grbs_addr_key_t b); - -/* This macro creates a hash function for grbs_addr_key_t (depends on - genht/hash.h */ -#define GRBS_ADDR_HASH(func_name) \ - unsigned int func_name(grbs_addr_key_t key) { return murmurhash(&key, sizeof(key)); } Index: trunk/src/libgrbs/debug.c =================================================================== --- trunk/src/libgrbs/debug.c (revision 1333) +++ trunk/src/libgrbs/debug.c (nonexistent) @@ -1,291 +0,0 @@ -#include -#include "debug.h" -#include "geo.h" - -#define COLOR_COPPER_POINT "#A05050" -#define COLOR_CLR_POINT "#D0A070" -#define COLOR_COPPER_WIRE "#902020" -#define COLOR_CLR_WIRE "#907050" -#define COLOR_SECT "#111111" -#define SECTOR_EXTEND 2 - -void grbs_svg_begin(grbs_t *grbs, FILE *f) -{ - fprintf(f, "\n"); - fprintf(f, "\n"); -} - -void grbs_svg_end(grbs_t *grbs, FILE *f) -{ - fprintf(f, ""); -} - -void grbs_svg_fill_circle(FILE *f, double x, double y, double sr, const char *color) -{ - fprintf(f, " \n", - x, y, sr, color); -} - -void grbs_svg_wf_circle(FILE *f, double x, double y, double sr, const char *color) -{ - fprintf(f, " \n", - x, y, sr, color); -} - -void grbs_svg_fill_line(FILE *f, double x1, double y1, double x2, double y2, double sr, const char *color) -{ - fprintf(f, " \n", - x1, y1, x2, y2, sr*2.0, color); -} - -void grbs_svg_wf_line(FILE *f, double x1, double y1, double x2, double y2, double sr, const char *color) -{ - int sweep = 0; - double dx, dy, len, vx, vy, nx, ny; - - dx = x2 - x1; - dy = y2 - y1; - if ((dx == 0) && (dy == 0)) { - grbs_svg_wf_circle(f, x1, y1, sr, color); - return; - } - - len = sqrt(dx*dx + dy*dy); - vx = dx / len; - vy = dy / len; - nx = -vy; - ny = vx; - - fprintf(f, " \n"); -} - -void grbs_svg_fill_arc(FILE *f, double cx, double cy, double r, double sa, double da, double sr, const char *color) -{ - double ea = sa + da; - double x1, y1, x2, y2; - int large = (fabs(da) > M_PI); - int sweep = (da > 0.0); - - x1 = cx + cos(sa) * r; y1 = cy + sin(sa) * r; - - if (fabs(da) < 0.0001) { - grbs_svg_fill_circle(f, x1, y1, sr, color); - return; - } - - x2 = cx + cos(ea) * r; y2 = cy + sin(ea) * r; - - fprintf(f, " \n", - sr*2.0, color, - x1, y1, r, r, large, sweep, x2, y2); -} - -void grbs_svg_wf_arc(FILE *f, double cx, double cy, double r, double sa, double da, double sr, const char *color) -{ - double ea = sa + da; - double x1i, y1i, x2i, y2i, x1o, y1o, x2o, y2o, ri, ro; - double cs, sn; - int large = (fabs(da) > M_PI); - int sweep = (da > 0.0); - - ri = r - sr; ro = r + sr; - - if ((fabs(da) < 0.0001) || (ri < 0)) { - double x1 = cx + cos(sa) * r, y1 = cy + sin(sa) * r; - grbs_svg_wf_circle(f, x1, y1, sr, color); - return; - } - - - cs = cos(sa); sn = sin(sa); - x1i = cx + cs * ri; y1i = cy + sn * ri; - x1o = cx + cs * ro; y1o = cy + sn * ro; - - cs = cos(ea); sn = sin(ea); - x2i = cx + cs * ri; y2i = cy + sn * ri; - x2o = cx + cs * ro; y2o = cy + sn * ro; - - fprintf(f, " \n"); -} - - -void grbs_svg_draw_points(grbs_t *grbs, FILE *f) -{ - grbs_point_t *p; - int s, c; - for(p = gdl_first(&grbs->all_points); p != NULL; p = gdl_next(&grbs->all_points, p)) { - grbs_svg_fill_circle(f, p->x, p->y, p->copper, COLOR_COPPER_POINT); - grbs_svg_wf_circle(f, p->x, p->y, p->copper+p->clearance, COLOR_CLR_POINT); - /* draw sentinels */ - for(c = 0; c < 2; c++) - for(s = 0; s < GRBS_MAX_SEG; s++) { - grbs_arc_t *first = gdl_first(&p->arcs[c][s]), *last = gdl_last(&p->arcs[c][s]); - if (first != NULL) { - double sx, sy, r = last->r + last->copper + last->clearance + SECTOR_EXTEND; - sx = p->x + cos(first->sa) * r; - sy = p->y + sin(first->sa) * r; - grbs_svg_fill_line(f, p->x, p->y, sx, sy, 0.05, COLOR_SECT); - sx = p->x + cos(first->sa + first->da) * r; - sy = p->y + sin(first->sa + first->da) * r; - grbs_svg_fill_line(f, p->x, p->y, sx, sy, 0.05, COLOR_SECT); - - grbs_svg_fill_arc(f, p->x, p->y, r, first->sa, first->da, 0.05, COLOR_SECT); - } - } - } -} - -void grbs_svg_dump_points(grbs_t *grbs, FILE *f) -{ - grbs_point_t *p; - int segi, c; - - for(p = gdl_first(&grbs->all_points); p != NULL; p = gdl_next(&grbs->all_points, p)) { - fprintf(f, " pt %f;%f cop;clr=%f;%f\n", p->x, p->y, p->copper, p->clearance); - - for(c = 0; c < 2; c++) - for(segi = 0; segi < GRBS_MAX_SEG; segi++) { - grbs_arc_t *a = gdl_first(&(p->arcs[c][segi])); - if (a != NULL) { - fprintf(f, " seg %s %d:\n", c ? "concave" : "convex", segi); - for(; a != NULL; a = gdl_next(&(p->arcs[c][segi]), a)) { - grbs_2net_t *tn = grbs_arc_parent_2net(a); - fprintf(f, " arc use=%d %f:%f -> %f [%f %f]", a->in_use, a->r, a->sa, a->da, GRBS_MIN(a->sa, a->sa+a->da), GRBS_MAX(a->sa, a->sa+a->da)); - if (tn != NULL) - fprintf(f, " tn=%ld", tn->uid); - if (a->new_in_use) - fprintf(f, " new: %f:%f -> %f [%f %f]", a->new_r, a->new_sa, a->new_da, GRBS_MIN(a->new_sa, a->new_sa + a->new_da), GRBS_MAX(a->new_sa, a->new_sa + a->new_da)); - fprintf(f, "\n"); - } - } - } - } -} - -static void svg_draw_inc_angle(grbs_t *grbs, FILE *f, grbs_arc_t *a) -{ - double cx, cy, R = 3; - - assert(a->r == 0); - - cx = a->parent_pt->x; - cy = a->parent_pt->y; - - grbs_svg_fill_line(f, cx, cy, cx + R*cos(a->sa), cy + R*sin(a->sa), 0.05, COLOR_SECT); -} - -void grbs_svg_draw_2net(grbs_t *grbs, FILE *f, grbs_2net_t *tn) -{ - grbs_arc_t *a; - double cx, cy, x, y, px, py; - int pvalid = 0; - - for(a = gdl_first(&tn->arcs); a != NULL; a = gdl_next(&tn->arcs, a)) { - assert(a->in_use); - - cx = a->parent_pt->x; - cy = a->parent_pt->y; - - if (pvalid) { - x = cx + a->r * cos(a->sa); - y = cy + a->r * sin(a->sa); - grbs_svg_fill_line(f, px, py, x, y, tn->copper, COLOR_COPPER_WIRE); - grbs_svg_wf_line(f, px, py, x, y, tn->copper + tn->clearance, COLOR_CLR_WIRE); - } - - grbs_svg_fill_arc(f, cx, cy, a->r, a->sa, a->da, tn->copper, COLOR_COPPER_WIRE); - grbs_svg_wf_arc(f, cx, cy, a->r, a->sa, a->da, tn->copper + tn->clearance, COLOR_CLR_WIRE); - px = cx + a->r * cos(a->sa + a->da); - py = cy + a->r * sin(a->sa + a->da); - pvalid = 1; - } - - a = gdl_first(&tn->arcs); - if ((a != NULL) && (a->r == 0)) - svg_draw_inc_angle(grbs, f, a); - - a = gdl_last(&tn->arcs); - if ((a != NULL) && (a->r == 0)) - svg_draw_inc_angle(grbs, f, a); -} - -void grbs_svg_draw_wires(grbs_t *grbs, FILE *f) -{ - grbs_2net_t *tn; - for(tn = gdl_first(&grbs->all_2nets); tn != NULL; tn = gdl_next(&grbs->all_2nets, tn)) - grbs_svg_draw_2net(grbs, f, tn); -} - - -void grbs_svg_dump_2net(grbs_t *grbs, FILE *f, grbs_2net_t *tn) -{ - grbs_arc_t *a; - - for(a = gdl_first(&tn->arcs); a != NULL; a = gdl_next(&tn->arcs, a)) - fprintf(f, " arc use=%d center=%f;%f r=%f a=%f;%f\n", a->in_use, a->parent_pt->x, a->parent_pt->y, a->r, a->sa, a->da); -} - -void grbs_svg_dump_wires(grbs_t *grbs, FILE *f) -{ - grbs_2net_t *tn; - for(tn = gdl_first(&grbs->all_2nets); tn != NULL; tn = gdl_next(&grbs->all_2nets, tn)) - grbs_svg_dump_2net(grbs, f, tn); -} - - -/* returns 1 if has unused sentinel */ -static int grbs_has_unused_sentinel_seg(grbs_t *grbs, grbs_point_t *pt, int cnc, int segi) -{ - grbs_arc_t *seg = gdl_first(&pt->arcs[cnc][segi]); - - if ((seg != NULL) && !seg->in_use && !seg->new_in_use && (seg->link_point.next == NULL)) { - gdl_remove(&pt->arcs[cnc][segi], seg, link_point); - grbs_arc_free(grbs, seg); - return 1; - } - - return 0; -} - -int grbs_count_unused_sentinel_pt(grbs_t *grbs, grbs_point_t *pt) -{ - int segi, cnc, res = 0; - - for(cnc = 0; cnc < 2; cnc++) - for(segi = 0; segi < GRBS_MAX_SEG; segi++) - res += grbs_has_unused_sentinel_seg(grbs, pt, cnc, segi); - - return res; -} - -long grbs_count_unused_sentinel(grbs_t *grbs) -{ - grbs_point_t *pt; - long res = 0; - - for(pt = gdl_first(&grbs->all_points); pt != NULL; pt = gdl_next(&grbs->all_points, pt)) - res += grbs_count_unused_sentinel_pt(grbs, pt); - return res; -} Index: trunk/src/libgrbs/route_postproc.c =================================================================== --- trunk/src/libgrbs/route_postproc.c (revision 1333) +++ trunk/src/libgrbs/route_postproc.c (nonexistent) @@ -1,245 +0,0 @@ -#define GRBS_ROUTE_POSTPROC_TRACE - -#undef tprintf -#ifdef GRBS_ROUTE_POSTPROC_TRACE -#include -#define tprintf printf -#else -#define tprintf grbs_nullprintf -#endif - -/* if ang is in arc between arc_sa_ and arc_da_ exclusive, truncate the arc so - one of the new boundaries is ang. If trunc_end is 0, truncate sa, else - truncate end angle (da) */ -static int grbs_angle_in_arc_trunc(double *arc_sa_, double *arc_da_, double ang, int trunc_end) -{ - double arc_sa = *arc_sa_, arc_da = *arc_da_; - double arc_ea; - int swapped = 0; - - /* make sure angle is always positive */ - if (ang < 0) - ang += 2.0 * M_PI; - - if (arc_da < 0) { /* swap endpoints so da is always positive */ - arc_sa = arc_sa + arc_da; - arc_da = -arc_da; - swapped = 1; - } - if (arc_sa < 0) - arc_sa += 2.0*M_PI; - - arc_ea = arc_sa + arc_da; - - /* if arc spans from some high value through zero, the end angle has - to be larger than 2*pi; if ang is under both start and end, that may - be the case so add a full circle to ang, last chance to get it in - range */ - if ((arc_sa > ang) && (arc_ea > ang)) - ang += 2.0*M_PI; - - if ((ang > arc_sa) && (ang < arc_ea)) - goto do_trunc; - - if (arc_ea > 2.0*M_PI) { - ang += 2.0*M_PI; - if ((ang > arc_sa) && (ang < arc_ea)) - goto do_trunc; - } - - return 0; - - do_trunc:; - /* (ea > sa) and ang is between */ - if (swapped) - trunc_end = !trunc_end; - if (trunc_end) - arc_ea = ang; /* truncate at end */ - else - arc_sa = ang; /* truncate at start */ - - /* now convert back from sa & ea to sa & da, keeping original direction */ - if (*arc_da_ >= 0) { /* positive da */ - *arc_sa_ = arc_sa; - *arc_da_ = arc_ea - arc_sa; - } - else { /* negative da */ - *arc_sa_ = arc_ea; - *arc_da_ = arc_sa - arc_ea; - } - - return 1; -} - -/* Apply a limit on res at orbit r and l_ang, using effective width ew; returns - number of changes made */ -static int conc_corner_limit(grbs_t *grbs, grbs_arc_t *res, double r, double ew, double l_ang) -{ - double isa, ida, iea; /* limits's start, delta and end angle */ - double ea = asin(ew/r); /* effective angle; see trunk/doc/GRBS/conc_pp_ea.svg */ - int chg = 0; - - /* angle range of limit+-ew at r */ - isa = l_ang - ea; - iea = l_ang + ea; - ida = ea * 2; - - /* arc bool: check which end of res is affected by ia */ - if (grbs_angle_in_arc(isa, ida, res->sa, 1)) { /* res start angle is affected */ - chg += grbs_angle_in_arc_trunc(&res->sa, &res->da, isa, 0); - chg += grbs_angle_in_arc_trunc(&res->sa, &res->da, iea, 0); - } - if (grbs_angle_in_arc(isa, ida, res->sa+res->da, 1)) { /* res end angle is affected */ - chg += grbs_angle_in_arc_trunc(&res->sa, &res->da, isa, 1); - chg += grbs_angle_in_arc_trunc(&res->sa, &res->da, iea, 1); - } - - return chg; -} - -/* Find incident nets from pt that would limit the first "arc"; calculate the - limited arc in res. Return 0 on success */ -static int conc_corner_find_sentinel_limits(grbs_t *grbs, grbs_point_t *pt, grbs_arc_t *arc, grbs_arc_t *res) -{ - grbs_arc_t *i; - - /* initial range is the original arc */ - res->r = arc->r; - res->sa = arc->sa; - res->da = arc->da; - - for(i = gdl_first(&(pt->incs)); i != NULL; i = gdl_next(&(pt->incs), i)) { - double ew; - - if (!i->in_use) - continue; - - /* effective width: distance between the centerlines of i's net and arc's net */ - ew = arc->copper + i->copper + GRBS_MAX(arc->clearance, i->clearance); - conc_corner_limit(grbs, res, arc->r, ew, i->sa); - } - return 0; -} - -/* Update the endpoint of the other (next or previous, depending on tn_dir - being +1 or -1) arc on the two-net so it heads to the corresponding endpoint - of 'from' */ -void conc_update_other(grbs_t *grbs, grbs_arc_t *from, int tn_dir) -{ - grbs_arc_t *dst = (tn_dir > 0) ? from->link_2net.next : from->link_2net.prev; - int dst_at_end = (tn_dir > 0) ? 0 : 1; - double ex, ey, ea, ang; - - /* endpoint on 'from' */ - ea = dst_at_end ? from->sa : from->sa + from->da; - ex = from->parent_pt->x + cos(ea) * from->r; - ey = from->parent_pt->y + sin(ea) * from->r; - - if (dst->r == 0) { /* dst is incident */ - dst->sa = atan2(ey - dst->parent_pt->y, ex - dst->parent_pt->x); - auto_update_seg_sentinel_angles(dst); - return; - } - - if (dst->concave) { - /* dst is convex or concave */ - double dx = ex - dst->parent_pt->x; - double dy = ey - dst->parent_pt->y; - - /* see trunk/doc/GRBS/conc_pp.oa.svg for the other-arc-is-convex case, which is the basis for the concave (90 +-degree shift) */ - - if (dst->da > 0) - ang = M_PI/2 - (asin(dst->r / sqrt(dx*dx + dy*dy)) - atan2(dy, dx)); - else - ang = (asin(dst->r / sqrt(dx*dx + dy*dy)) + atan2(dy, dx)) - M_PI/2; - } - else { /* other-arc-is-convex case */ - double a[4]; - grbs_bicycle_angles( - dst->parent_pt->x, dst->parent_pt->y, dst->r, - ex, ey, 0, a, 0); - ang = a[dst->da < 0]; - } - - tprintf(" conc_update_other: ang=%f\n", ang); - - if (dst_at_end == 0) { - double old = dst->sa; - dst->sa = ang; - dst->da = grbs_arc_get_delta(dst->sa, old + dst->da, dst->da > 0 ? +1 : -1); /* don't change the other side angle */ - } - else - dst->da = grbs_arc_get_delta(dst->sa, ang, dst->da > 0 ? +1 : -1); /* don't change the other side angle */ - - auto_update_seg_sentinel_angles(dst); -} - -/* Tune angles of concave arcs so their corners fit with other concave - arcs and incident nets (runs on all concave segments at a given point) */ -void grbs_pp_concave_corners_at(grbs_t *grbs, grbs_point_t *pt) -{ - int segi, sa_chg, ea_chg; - for(segi = 0; segi < GRBS_MAX_SEG; segi++) { - grbs_arc_t *prev, *a, *sentinel = gdl_first(&pt->arcs[1][segi]), ra; - - if (sentinel == NULL) - continue; - - for(a = gdl_next(&(pt->arcs[1][segi]), sentinel); ((a != NULL) && (a->in_use == 0)); a = gdl_next(&(pt->arcs[1][segi]), a)) ; - if (a == NULL) - continue; - - - tprintf("PP cc %f;%f\n", pt->x, pt->y); - tprintf(" sentinel: %f + %f; first: %f + %f\n", sentinel->sa, sentinel->da, a->sa, a->da); - - /* for the innermost arc look up incident and other concaves */ - - conc_corner_find_sentinel_limits(grbs, pt, a, &ra); - - sa_chg = (ra.sa != a->sa); - ea_chg = (ra.da != a->da); - if (sa_chg || ea_chg) { - tprintf(" truncate: %f + %f\n", ra.sa, ra.da); - sentinel->sa = a->sa = ra.sa; - sentinel->da = a->da = ra.da; - if (sa_chg) - conc_update_other(grbs, a, -1); - if (ea_chg) - conc_update_other(grbs, a, +1); - } - - /* from the second concave arc on, it's only the previous arc ends that we need to consider */ - prev = a; - for(a = gdl_next(&(pt->arcs[1][segi]), a); a != NULL; a = gdl_next(&(pt->arcs[1][segi]), a)) { - double ew; - - if (!a->in_use) - continue; - - /* effective width: distance between the centerlines of prev's net and a's net */ - ew = a->copper + prev->copper + GRBS_MAX(a->clearance, prev->clearance); - sa_chg = conc_corner_limit(grbs, a, a->r, ew, prev->sa); - ea_chg = conc_corner_limit(grbs, a, a->r, ew, prev->sa + prev->da); - - if (sa_chg) - conc_update_other(grbs, a, -1); - if (ea_chg) - conc_update_other(grbs, a, +1); - - prev = a; - } - } -} - - -/* Tune angles of concave arcs so their corners fit with other concave - arcs and incident nets (runs on all concave segments at every point) */ -void grbs_pp_concave_corners(grbs_t *grbs) -{ - grbs_point_t *p; - for(p = gdl_first(&grbs->all_points); p != NULL; p = gdl_next(&grbs->all_points, p)) { - grbs_pp_concave_corners_at(grbs, p); - } -} - Index: trunk/src/libgrbs/collision.c =================================================================== --- trunk/src/libgrbs/collision.c (revision 1333) +++ trunk/src/libgrbs/collision.c (nonexistent) @@ -1,52 +0,0 @@ -static int grbs_arc_is_outmost(grbs_t *grbs, grbs_arc_t *arc) -{ - int conc_segi; - - if (arc->link_point.next != NULL) - return 0; - - /* if there is a cocave above, this is not the outermost */ - for(conc_segi = 0; conc_segi < GRBS_MAX_SEG; conc_segi++) { - grbs_arc_t *conc_sentinel = gdl_first(&arc->parent_pt->arcs[1][conc_segi]); - if ((conc_sentinel != NULL) && (grbs_arc_overlaps_arc(arc, conc_sentinel))) - return 0; - } - - - return 1; -} - -static grbs_2net_t *coll_check_arc(grbs_t *grbs, grbs_2net_t *tn, grbs_arc_t *arc) -{ - if (!grbs_arc_is_outmost(grbs, arc)) /* do not check collision on inner arcs */ - return NULL; - -#warning TODO: callback: use ->new_* if exist or plain fields - - return NULL; -} - -static grbs_2net_t *coll_check_line(grbs_t *grbs, grbs_2net_t *tn, double x1, double y1, double x2, double y2) -{ -#warning TODO: callback: use ->new_* if exist or plain fields - - return NULL; -} - -static void coll_report(grbs_t *grbs, grbs_2net_t *tn, grbs_2net_t *coll_tn, grbs_arc_t *coll_arc) -{ - if ((grbs->coll_report_cb != NULL) && (coll_tn != NULL)) - grbs->coll_report_cb(grbs, tn, coll_tn, coll_arc); -} - - -static void coll_report_arc(grbs_t *grbs, grbs_2net_t *tn, grbs_arc_t *coll_arc) -{ - coll_report(grbs, tn, grbs_arc_parent_2net(coll_arc), coll_arc); -} - -static void coll_report_tn(grbs_t *grbs, grbs_2net_t *tn, grbs_2net_t *coll_tn) -{ - if (grbs->coll_report_cb != NULL) - grbs->coll_report_cb(grbs, tn, coll_tn, NULL); -} Index: trunk/src/libgrbs/debug.h =================================================================== --- trunk/src/libgrbs/debug.h (revision 1333) +++ trunk/src/libgrbs/debug.h (nonexistent) @@ -1,32 +0,0 @@ -#ifndef LIBGRBS_DEBUG_H -#define LIBGRBS_DEBUG_H - -#include -#include - -void grbs_svg_begin(grbs_t *grbs, FILE *f); -void grbs_svg_end(grbs_t *grbs, FILE *f); - -/* low level draw; fill has no stroke, wf is wireframe contour, cl is centerline - sr is "stroke radius" (half of trace width) */ -void grbs_svg_fill_circle(FILE *f, double x, double y, double sr, const char *color); -void grbs_svg_wf_circle(FILE *f, double x, double y, double sr, const char *color); -void grbs_svg_fill_line(FILE *f, double x1, double y1, double x2, double y2, double sr, const char *color); -void grbs_svg_wf_line(FILE *f, double x1, double y1, double x2, double y2, double sr, const char *color); -void grbs_svg_fill_arc(FILE *f, double cx, double cy, double r, double sa, double da, double sr, const char *color); -void grbs_svg_wf_arc(FILE *f, double cx, double cy, double r, double sa, double da, double sr, const char *color); - -/* high level draw: draw all objects of a kind */ -void grbs_svg_draw_points(grbs_t *grbs, FILE *f); -void grbs_svg_dump_points(grbs_t *grbs, FILE *f); -void grbs_svg_draw_wires(grbs_t *grbs, FILE *f); -void grbs_svg_dump_wires(grbs_t *grbs, FILE *f); -void grbs_svg_draw_2net(grbs_t *grbs, FILE *f, grbs_2net_t *tn); -void grbs_svg_dump_2net(grbs_t *grbs, FILE *f, grbs_2net_t *tn); - -/* Return the number of unused sentinels left in a grbs; a non-zero - value is usually an indication of a bug */ -long grbs_count_unused_sentinel(grbs_t *grbs); - - -#endif Index: trunk/src/libgrbs/route_next.c =================================================================== --- trunk/src/libgrbs/route_next.c (revision 1333) +++ trunk/src/libgrbs/route_next.c (nonexistent) @@ -1,744 +0,0 @@ -/*#define GRBS_ROUTE_NEXT_TRACE*/ -/*#define GRBS_ROUTE_NEXT_FAIL_TRACE*/ - -#undef tprinf -#ifdef GRBS_ROUTE_NEXT_TRACE -#include -#define tprintf printf -#else -#define tprintf grbs_nullprintf -#endif - -#undef failprinf -#ifdef GRBS_ROUTE_NEXT_FAIL_TRACE -#include -#define failprintf \ - printf("fail: %s L%d: ", __FUNCTION__, __LINE__); \ - printf -#else -#define failprintf grbs_nullprintf -#endif - -static int grbs_inc_line_is_valid_(grbs_t *grbs, grbs_point_t *pt, double ang, double copper, double clearance, int is_concave, grbs_arc_t **coll) -{ - grbs_arc_t *a; - int side = 0; -#warning TODO: set side - for(a = gdl_first(&pt->arcs[is_concave][side]); a != NULL; a = gdl_next(&pt->arcs[is_concave][side], a)) { - double sa = a->sa, da = a->da; - if (!a->in_use) continue; -#warning TODO: extend sa and da with copper and clearance; NOPE: concave postproc solved this - if (grbs_angle_in_arc(sa, da, ang, 0)) { - *coll = a; - return 0; - } - } - return 1; -} - -/* Return whether an incident line is valid (not crossing any arc around pt) */ -static int grbs_inc_line_is_valid(grbs_t *grbs, grbs_point_t *pt, double ang, double copper, double clearance, grbs_arc_t **coll) -{ - /* check for both convex and concave segments */ - return grbs_inc_line_is_valid_(grbs, pt, ang, copper, clearance, 0, coll) && grbs_inc_line_is_valid_(grbs, pt, ang, copper, clearance, 1, coll); -} - - -static int grbs_inc_line2arc_is_valid(grbs_t *grbs, grbs_2net_t *tn, grbs_point_t *pt, grbs_addr_t *addr, double arc_ang, double copper, double clearance) -{ - grbs_arc_t *arc = addr->obj.arc, *coll; - double r, ax, ay, vx, vy, ang; - int valid; - - assert(!addr_is_incident(addr)); - r = arc->new_r; - ax = arc->parent_pt->x + cos(arc_ang) * r; - ay = arc->parent_pt->y + sin(arc_ang) * r; - vx = ax - pt->x; - vy = ay - pt->y; - ang = atan2(vy, vx); - - valid = grbs_inc_line_is_valid(grbs, pt, ang, copper, clearance, &coll); - if (!valid) - coll_report_arc(grbs, tn, coll); - - return valid; -} - -static grbs_addr_t *grbs_implement_incident(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *from, double from_r, double from_a, grbs_point_t *to_pt, int segi, int new_at_from, grbs_addr_type_t curving, int concave_dir) -{ - grbs_point_t *from_pt = addr_point(from); - grbs_2net_t *coll_tn; - double aex, aey; - - if (new_at_from) { - /* when creating a new go-around arc, we first place start (new_sa), so - addr is set to ADDR_ARC_END which means next we will need to set the end - (delta) */ - grbs_addr_t *res = grbs_addr_new(grbs, curving | ADDR_ARC_END, from->obj.arc); - res->obj.arc->segi = segi; - res->obj.arc->new_r = from_r; - res->obj.arc->new_sa = from_a; - res->obj.arc->new_da = 0; - res->obj.arc->new_adir = (curving == ADDR_ARC_CONCAVE) ? concave_dir : grbs_get_adir(to_pt->x, to_pt->y, from_pt->x, from_pt->y, from_r, from_a); - res->obj.arc->new_in_use = 1; - coll_tn = coll_check_arc(grbs, tn, res->obj.arc); - if (coll_tn != NULL) { - failprintf("arc collision failed\n"); - coll_report_tn(grbs, tn, coll_tn); - grbs_arc_free(grbs, res->obj.arc); - grbs_addr_free_last(grbs); - return NULL; - } - return res; - } - - /* coming from an existing arc, tune the angle; we should be coming from an - arc end: order is point -> arc_start -> arc_end -> point */ - if (grbs_arc_tune4exit(grbs, tn, from, from_a) != 0) { - failprintf("tune4exit failed\n"); - return NULL; - } - - grbs_get_new_arc_end(grbs, tn, from, 1, &aex, &aey); - coll_tn = coll_check_line(grbs, tn, aex, aey, to_pt->x, to_pt->y); - if (coll_tn != NULL) { - failprintf("line collision\n"); - coll_report_tn(grbs, tn, coll_tn); - return NULL; - } - - return grbs_addr_new(grbs, ADDR_POINT, to_pt); -} - -static grbs_addr_t *grbs_implement_arc2arc(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *from, double from_r, double from_a, grbs_addr_t *to, double to_r, double to_a, int segi, int to_concave_dir) -{ - grbs_point_t *from_pt = addr_point(from), *to_pt; - grbs_arc_t *to_arc; - grbs_2net_t *coll_tn; - double ex1, ey1, ex2, ey2; - - assert((from->type & ADDR_ARC_CONVEX) || (from->type & ADDR_ARC_CONCAVE)); - assert(from->type & ADDR_ARC_END); - assert((to->type & ADDR_ARC_CONVEX) || (to->type & ADDR_ARC_CONCAVE)); - - /* coming from an existing arc, tune the angle */ - if (grbs_arc_tune4exit(grbs, tn, from, from_a) != 0) { - failprintf("from exit fail\n"); - return NULL; - } - - to_pt = addr_point(to); - to_arc = to->obj.arc; - to_arc->segi = segi; - to_arc->new_r = to_r; - to_arc->new_sa = to_a; - to_arc->new_da = 0; - to_arc->new_adir = ((to->type & 0x0F) == ADDR_ARC_CONVEX) ? grbs_get_adir(from_pt->x, from_pt->y, to_pt->x, to_pt->y, to_r, to_a) : to_concave_dir; - to_arc->new_in_use = 1; - - coll_tn = coll_check_arc(grbs, tn, to_arc); - if (coll_tn != NULL) { - failprintf("arc collision failed\n"); - coll_report_tn(grbs, tn, coll_tn); - to_arc->new_in_use = 0; - return NULL; - } - - grbs_get_new_arc_end(grbs, tn, from, 1, &ex1, &ey1); - grbs_get_arc_end_(grbs, tn, to_arc, 0, &ex2, &ey2); - coll_tn = coll_check_line(grbs, tn, ex1, ey1, ex2, ey2); - if (coll_tn != NULL) { - failprintf("line collision\n"); - coll_report_tn(grbs, tn, coll_tn); - to_arc->new_in_use = 0; - return NULL; - } - - return grbs_addr_new(grbs, (to->type & 0x0F) | ADDR_ARC_END, to_arc); -} - -static void cnc_get_end_arc(grbs_arc_t *arc, int at_end, double *ox, double *oy) -{ - double ang; - grbs_point_t *from_pt = arc->parent_pt; - - ang = arc->new_sa; - if (at_end) - ang += arc->new_da; - *ox = from_pt->x + arc->new_r * cos(ang); - *oy = from_pt->y + arc->new_r * sin(ang); -} - -static void cnc_get_end(grbs_addr_t *from, int at_end, double *ox, double *oy) -{ - grbs_point_t *from_pt = addr_point(from); - - if (!shrink_concave || (from->type == ADDR_POINT)) { /* simplified (original) version: same angle as incident */ - *ox = from_pt->x; - *oy = from_pt->y; - return; - } - cnc_get_end_arc(from->obj.arc, at_end, ox, oy); -} - -/* Checks if concave-above-convex does not cross a convex arc's exit lines - below. Returns 0 if the concave arc 'from' is valid or non-zero on crossing */ -static int concave_above_convex_validate(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *from, double end_ang) -{ - int cvx_segi; - - for(cvx_segi = 0; cvx_segi < GRBS_MAX_SEG; cvx_segi++) { - grbs_arc_t *cvx_sentinel = gdl_first(&from->obj.arc->parent_pt->arcs[0][cvx_segi]); - int start_in, end_in; - - if (cvx_sentinel == NULL) continue; - - start_in = grbs_angle_in_arc(cvx_sentinel->sa, cvx_sentinel->da, from->obj.arc->new_sa, 0); - end_in = grbs_angle_in_arc(cvx_sentinel->sa, cvx_sentinel->da, end_ang, 0); - if (start_in != end_in) { - coll_report_arc(grbs, tn, cvx_sentinel->link_point.next); - return 1; - } - } - return 0; -} - -static grbs_addr_t *path_find_arc2inc(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *from, grbs_point_t *to_pt, int to_segi) -{ - grbs_point_t *from_pt = addr_point(from); - double a[4], fromr_r; - int new_at_from = 0; - double from_ang; - grbs_addr_type_t from_curving = (from->type & 0x0F); - - assert(from->type != ADDR_POINT); - fromr_r = grbs_get_new_radius(grbs, tn, from); - - if (from_curving == ADDR_ARC_CONVEX) { - int from_ang_side; - - /* order of from->to does not really matter here */ - if (grbs_bicycle_angles(from_pt->x, from_pt->y, fromr_r, to_pt->x, to_pt->y, 0, a, 0) != 0) { - failprintf("bicycle angles failed\n"); - return NULL; - } - - from_ang_side = from_arc_ang_side(grbs, from, to_pt->x, to_pt->y, a, 1); - if (from_ang_side < 0) { - failprintf("from angle side\n"); - return NULL; - } - - from_ang = a[from_ang_side]; - } - else if (from_curving == ADDR_ARC_CONCAVE) { - double ox, oy; - cnc_get_end(from, 1, &ox, &oy); - from_ang = atan2(to_pt->y - oy, to_pt->x - ox); /* concave-target-angle (this will set ->new_da exit angle to face to to_pt) */ - if (concave_above_convex_validate(grbs, tn, from, from_ang) != 0) { - failprintf("concave-above-convex: invalid exit angle (concave arc crosses convex exit)\n"); - return NULL; - } - } - else { - assert(!"arc2inc: invalid curving; 'from' must be convex or concave arc"); - return NULL; - } - - - if (!grbs_inc_line2arc_is_valid(grbs, tn, to_pt, from, from_ang, tn->copper, tn->clearance)) { - failprintf("inc_line2arc_is_valid\n"); - return NULL; - } - - return grbs_implement_incident(grbs, tn, from, fromr_r, from_ang, to_pt, to_segi, new_at_from, ADDR_ARC_CONVEX, 0); -} - -static grbs_addr_t *path_find_inc2arc_convex(grbs_t *grbs, grbs_2net_t *tn, grbs_point_t *from_pt, grbs_addr_t *to, int to_adir, int to_segi) -{ - grbs_point_t *to_pt = addr_point(to); - double a[4], tor_r; - int new_at_from = 1; - - assert(to->type != ADDR_POINT); - - if (to->obj.arc->new_in_use) {/* spiral is invalid as it is not the shortest path to revisit an addr */ - failprintf("spiral\n"); - return NULL; - } - - tor_r = grbs_get_new_radius(grbs, tn, to); - - /* order of from->to does not really matter here */ - if (grbs_bicycle_angles(from_pt->x, from_pt->y, 0, to_pt->x, to_pt->y, tor_r, a, 0) != 0) { - failprintf("bicycle angles\n"); - return NULL; - } - - assert(grbs_adir_is_arc(to_adir)); - - if (!grbs_angle_visible_between_arcs(grbs, tn, to, a[to_adir])) { - failprintf("angle visible between arcs\n"); - return NULL; - } - - if (!grbs_inc_line2arc_is_valid(grbs, tn, from_pt, to, a[to_adir], tn->copper, tn->clearance)) { - failprintf("inc_line2arc_is_valid\n"); - return NULL; - } - - return grbs_implement_incident(grbs, tn, to, tor_r, a[to_adir], from_pt, to_segi, new_at_from, ADDR_ARC_CONVEX, 0); -} - -static grbs_addr_t *path_find_inc2arc_concave(grbs_t *grbs, grbs_2net_t *tn, grbs_point_t *from_pt, grbs_addr_t *to, grbs_arc_dir_t to_adir, int to_segi) -{ - grbs_point_t *to_pt = addr_point(to); - double to_ang, tor_r; - int new_at_from = 1, to_concave_dir; - - assert(to->type != ADDR_POINT); - - if (to->obj.arc->new_in_use) {/* spiral is invalid as it is not the shortest path to revisit an addr */ - failprintf("spiral\n"); - return NULL; - } - - tor_r = grbs_get_new_radius(grbs, tn, to); - to_ang = atan2(from_pt->y - to_pt->y, from_pt->x - to_pt->x); /* concave-target-angle */ - - if (shrink_concave) - to_ang += ((to_adir == GRBS_ADIR_CONCAVE_CCW) ? -1 : +1) * (tn->copper + tn->clearance) / tor_r ; - - - if (!grbs_angle_visible_between_arcs(grbs, tn, to, to_ang)) { - failprintf("angle visible between arcs\n"); - return NULL; - } - - if (!grbs_inc_line2arc_is_valid(grbs, tn, from_pt, to, to_ang, tn->copper, tn->clearance)) { - failprintf("inc_line2arc_is_valid\n"); - return NULL; - } - - to_concave_dir = grbs_adir_is_CW(to_adir) ? +1 : -1; - return grbs_implement_incident(grbs, tn, to, tor_r, to_ang, from_pt, to_segi, new_at_from, ADDR_ARC_CONCAVE, to_concave_dir); -} - -static grbs_addr_t *path_find_inc2inc(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *from, grbs_point_t *to_pt) -{ - grbs_2net_t *coll_tn; - grbs_arc_t *coll; - grbs_point_t *from_pt = addr_point(from); - double vx = to_pt->x - from_pt->x, vy = to_pt->y - from_pt->y; - double ang = atan2(vy, vx); - - if (!grbs_inc_line_is_valid(grbs, from_pt, ang, tn->copper, tn->clearance, &coll)) { - failprintf("inc_line_is_valid: from\n"); - coll_report_arc(grbs, tn, coll); - return NULL; - } - if (!grbs_inc_line_is_valid(grbs, to_pt, ang - M_PI, tn->copper, tn->clearance, &coll)) { - failprintf("inc_line_is_valid: to\n"); - coll_report_arc(grbs, tn, coll); - return NULL; - } - - coll_tn = coll_check_line(grbs, tn, from_pt->x, from_pt->y, to_pt->x, to_pt->y); - if (coll_tn != NULL) { - failprintf("line collision\n"); - coll_report_tn(grbs, tn, coll_tn); - return NULL; - } - - return grbs_addr_new(grbs, ADDR_POINT, to_pt); -} - -static void load_under_above_me(grbs_arc_t *arc, grbs_arc_t **addr_under_me, grbs_arc_t **addr_above_me) -{ - if (arc->in_use) - *addr_under_me = arc; - - *addr_above_me = grbs_next_arc_in_use(arc); -} - -/* Return the next (or previous) arc that continues the 'from' arc on its - route to go around to_pt. If not found, return NULL. If found, set to_ang - to the angle closer to 'from' on the path */ -static grbs_arc_t *grbs_topo_guide_next(grbs_t *grbs, grbs_arc_t *from, grbs_point_t *to_pt, int to_is_concave, double *from_ang, double *to_ang) -{ - grbs_arc_t *arc; - - arc = from->link_2net.next; - if ((arc != NULL) && (arc->parent_pt == to_pt) && (arc->concave == to_is_concave)) { - *from_ang = from->sa + from->da; - *to_ang = arc->sa; - return arc; - } - - arc = from->link_2net.prev; - if ((arc != NULL) && (arc->parent_pt == to_pt) && (arc->concave == to_is_concave)) { - *from_ang = from->sa; - *to_ang = arc->sa + arc->da; - return arc; - } - - return NULL; -} - -/* special case: our path is guided by an existing path: we are consistently - above or below an existing route. This happens if our 'from' is below - (or above) another net whose next (or previous) step is the same point as - ours and has the same convexity as ours. - - In this case do a quick topological routing: our net sure will end up below - (or above) the guiding net at the 'to' address. - - Beside being an optimization this also fixes a bug: when a second parallel - net is inserted or appended, purely by angles we can't decide if the new - net should go below or above the existing same-angle net at 'to'. With - the topological approach the under/above decision is easy, and since we - are walkign the same path, we cna just copy the existing angles. - */ -static grbs_addr_t *path_find_arc2arc_topo(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *from, grbs_addr_t *to, grbs_arc_dir_t to_adir, int to_segi) -{ - grbs_arc_t *from_under_me = NULL, *from_above_me = NULL; - grbs_arc_t *to_under_me = NULL, *to_above_me = NULL; - grbs_arc_t *arc, *to_arc, *tou; - grbs_2net_t *coll_tn; - double from_ang, to_ang, to_r, to_d; - int swapped = 0; - - /* we use this only for the arc-arc case */ - assert((from->type & 0x0f) != ADDR_POINT); - assert((to->type & 0x0f) != ADDR_POINT); - - /* figure what's under and above on the from side */ - load_under_above_me(from->obj.arc, &from_under_me, &from_above_me); - if ((from_under_me == NULL) && (from_above_me == NULL)) { - /* we are in a seg alone; a common reason for that is that we entered - beyond an existing segment and would merge with it once the exit - angle is known. This can happen only in one direction (forward in adir) - and only with the next segment. Try and see. - - Of course it may be that the next segment is unrelated (too far away, - which also means it's going somewhere else). That's not a problem - because then the 'to' part won't match and we will return as - 'not guided' */ - arc = from->obj.arc; - tprintf("TOPO-guide: *MERGE* need to step %p ", arc); - arc = grbs_next_seg(arc->parent_pt, arc->segi, arc->concave, arc->new_sa, arc->new_adir); - tprintf("-> %p\n", arc); - if ((arc == NULL) || (from->obj.arc->concave != arc->concave)) - return NULL; - - load_under_above_me(arc, &from_under_me, &from_above_me); - } - - tprintf("TOPO-guide: fume=%p fame=%p\n", from_under_me, from_above_me); - - if ((from_under_me == NULL) && (from_above_me == NULL)) /* we are truely alone */ - return NULL; - - if (from_under_me != NULL) - to_under_me = grbs_topo_guide_next(grbs, from_under_me, to->obj.arc->parent_pt, !grbs_adir_is_convex(to_adir), &from_ang, &to_ang); - if ((to_under_me == NULL) && (from_above_me != NULL)) - to_above_me = grbs_topo_guide_next(grbs, from_above_me, to->obj.arc->parent_pt, !grbs_adir_is_convex(to_adir), &from_ang, &to_ang); - - if ((to_above_me != NULL) && (to_above_me->r == 0)) /* no guide: to_above_me is an incident line */ - to_above_me = NULL; - if ((to_under_me != NULL) && (to_under_me->r == 0)) /* no guide: to_under_me is an incident line */ - to_under_me = NULL; - - if ((to_under_me == NULL) && (to_above_me == NULL)) /* no guide: under and above go out elsewhere */ - return NULL; - - to_d = grbs_adir_is_CW(to_adir) ? +1 : -1; - - if (to_d != from->obj.arc->new_adir) { - arc = to_under_me; - to_under_me = to_above_me; - to_above_me = arc; - swapped = 1; - tprintf(" TOPO-guide: need to swap\n"); - } - -#warning TODO: test everything with concaves - - tprintf("TOPO-guide: tume=%p tame=%p\n", to_under_me, to_above_me); - - arc = (to_under_me != NULL) ? to_under_me : to_above_me; /* the original guiding route we are reproducing */ - tou = (to_under_me != NULL) ? to_under_me : to_above_me->link_point.prev; /* the to-arc we build on top */ - - - - if (tou->new_in_use != 0) { - failprintf("guided spiral\n"); - return NULL; /* spiral */ - } - - /* coming from an existing arc, tune the angle */ - if (grbs_arc_tune4exit(grbs, tn, from, from_ang) != 0) { - failprintf("guided from exit fail\n"); - return NULL; - } - - to_arc = tou; - - /* if we are above our guide, we need to invent a new radius above our - guide's radius */ - if (to_under_me != NULL) { - grbs_addr_t addr; - addr = *to; - addr.obj.arc = to_under_me; - to_r = grbs_get_new_radius(grbs, tn, &addr); - } - else - to_r = arc->r; - - if (swapped) { - grbs_arc_t *froma = from->obj.arc; - double a[4]; - int from_adir_idx = (froma->new_adir > 0) ? 1 : 0; - int to_adir_idx = (to_d > 0) ? 1 : 0; - - /* recalculate angles */ - if (grbs_bicycle_angles(froma->parent_pt->x, froma->parent_pt->y, froma->new_r, to_arc->parent_pt->x, to_arc->parent_pt->y, to_r, a, 1) != 0) { - failprintf("guided: swapped bicycle angle\n"); - return NULL; - } - - if (!grbs_adir_is_convex(to_adir)) { /* calculate concave angle for to_arc */ - double ex, ey, ea; - int at_end = 1; - assert(from != NULL); - ea = at_end ? froma->sa : froma->sa + froma->da; - ex = froma->parent_pt->x + cos(ea) * froma->r; - ey = froma->parent_pt->y + sin(ea) * froma->r; - to_ang = atan2(ey - to_arc->parent_pt->y, ex - to_arc->parent_pt->x); - } - else - to_ang = a[to_adir_idx+2]; /* in convex case it's from bicycle */ - - tprintf("SWAP TUNE: from %f->%f to %f->%f to_ang: %f\n", - fmod(froma->new_sa + froma->new_da, 2*M_PI), a[from_adir_idx], - to_ang, a[to_adir_idx+2], to_ang); - - if (!froma->concave) /* concave angles won't change */ - froma->new_da = grbs_arc_get_delta(froma->new_sa, a[from_adir_idx], froma->new_da > 0 ? +1 : -1); - } - - if (grbs_adir_is_convex(to_adir)) /* since we don't yet shrink concave, the previous/next convex will be invalid if we are concave... */ - { /* a final check on not going invalid convex */ - grbs_arc_t *froma = from->obj.arc; - double ox, oy; - - ox = to_arc->parent_pt->x + cos(to_ang) * to_r; - oy = to_arc->parent_pt->y + sin(to_ang) * to_r; - - if (!froma->concave && (grbs_invalid_convex_(grbs, froma->parent_pt, froma->new_r, froma->new_sa + froma->new_da, (froma->new_adir > 0) ? +1 : -1, ox, oy))) { - failprintf("guided: from invalid convex\n"); - return NULL; - } - } - - coll_tn = coll_check_arc(grbs, tn, from->obj.arc); - if (coll_tn != NULL) { - failprintf("arc collision failed\n"); - coll_report_tn(grbs, tn, coll_tn); - return NULL; - } - - to_arc->segi = arc->segi; - to_arc->new_r = to_r; - to_arc->new_sa = to_ang; - to_arc->new_da = 0; - to_arc->new_adir = to_d; - to_arc->new_in_use = 1; - - grbs_clean_unused_sentinel(grbs, from->obj.arc->parent_pt); - grbs_clean_unused_sentinel(grbs, to_arc->parent_pt); - - return grbs_addr_new(grbs, (to->type & 0x0F) | ADDR_ARC_END, to_arc); -} - - -static grbs_addr_t *path_find_arc2arc(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *from, grbs_addr_t *to, grbs_arc_dir_t to_adir, int to_segi) -{ - grbs_point_t *from_pt = addr_point(from); - grbs_point_t *to_pt = addr_point(to); - int from_is_convex = ((from->type & 0x0F) == ADDR_ARC_CONVEX), to_concave_dir; - double a[4], fromr_r, tor_r, fromb_r, tob_r, to_x, to_y, from_x, from_y; - int from_ang_side, crossbelt; - int to_adir_idx = (to_adir >= 10) ? (to_adir - 10) : to_adir; - grbs_addr_t *topo; - - if (!addr_is_incident(to)) { - if (to->obj.arc->new_in_use) { /* spiral is invalid as it is not the shortest path to revisit an addr */ - failprintf("spiral\n"); - return NULL; - } - } - - /* shorthand: if our route is being guided by an existing route, just copy - that instead of trying to invent it again. Beside being an optimization - this also fixes a bug (see at the function) */ - topo = path_find_arc2arc_topo(grbs, tn, from, to, to_adir, to_segi); - if (topo != NULL) - return topo; - - fromr_r = grbs_get_new_radius(grbs, tn, from); - fromb_r = from_is_convex ? fromr_r : 0; - tor_r = grbs_get_new_radius(grbs, tn, to); - tob_r = grbs_adir_is_convex(to_adir) ? tor_r : 0; - - crossbelt = (from->obj.arc->new_adir > 0) ? (to_adir_idx == 0) : (to_adir_idx != 0); - if (grbs_bicycle_angles(from_pt->x, from_pt->y, fromb_r, to_pt->x, to_pt->y, tob_r, a, crossbelt) != 0) { - failprintf("bicycle_angles\n"); - return NULL; - } - - to_x = to->obj.arc->parent_pt->x + cos(a[to_adir_idx+2]) * tob_r; - to_y = to->obj.arc->parent_pt->y + sin(a[to_adir_idx+2]) * tob_r; - - from_ang_side = from_arc_ang_side(grbs, from, to_x, to_y, a, from_is_convex); - if (from_ang_side < 0) { - failprintf("from ang side\n"); - return NULL; - } - - from_x = from->obj.arc->parent_pt->x + cos(a[from_ang_side]) * fromb_r; - from_y = from->obj.arc->parent_pt->y + sin(a[from_ang_side]) * fromb_r; - - if (!from_is_convex) { - double ox = from_x, oy = from_y, fang; - if (shrink_concave) - cnc_get_end(from, 1, &ox, &oy); - fang = atan2(to_y - oy, to_x - ox); /* concave-target-angle */ - - if (shrink_concave && grbs_adir_is_convex(to_adir)) /* concave->convex: need to tune a[2] and a[3] */ - grbs_bicycle_angles(ox, oy, fromb_r, to_pt->x, to_pt->y, tob_r, a, crossbelt); - a[0] = a[1] = fang; - } - - if (!grbs_adir_is_convex(to_adir)) { - double ox = from_x, oy = from_y; - if (shrink_concave) - cnc_get_end(from, 1, &ox, &oy); - a[2] = a[3] = atan2(oy - to_y, ox - to_x); /* concave-target-angle */ - } - - /* printf("arc2arc crossbelt: %d r: %f -> %f ang: %f %f\n", crossbelt, fromr_r, tor_r, a[0], a[2]); */ - - if (!grbs_angle_visible_between_arcs(grbs, tn, from, a[from_ang_side])) { - failprintf("between-arcs: from\n"); - return NULL; - } - if (!grbs_angle_visible_between_arcs(grbs, tn, to, a[to_adir_idx+2])) { - failprintf("between-arcs: to\n"); - return NULL; - } - - to_concave_dir = grbs_adir_is_CW(to_adir) ? +1 : -1; - return grbs_implement_arc2arc(grbs, tn, from, fromr_r, a[from_ang_side], to, tor_r, a[to_adir_idx+2], to_segi, to_concave_dir); -} - -static grbs_addr_t *grbs_path_next_arc(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *from, grbs_point_t *to_pt, grbs_arc_dir_t adir, int adir_idx) -{ - int to_sid = -1, is_convex = grbs_adir_is_convex(adir); - grbs_point_t *from_pt = addr_point(from); - double a[4]; - double to_r = to_pt->copper + GRBS_MAX(to_pt->clearance, tn->clearance) + tn->copper; /* precise centerline radius around 'to' on the innermost possible orbit */ - - if (addr_is_incident(from)) { /* coming from an incident attachment */ - grbs_addr_t to_addr, *res; - double to_ang; - - if (grbs_adir_is_convex(adir)) { - if (grbs_bicycle_angles(from_pt->x, from_pt->y, 0, to_pt->x, to_pt->y, to_r, a, 0) != 0) { - failprintf("bicycle angles\n"); - return NULL; - } - to_ang = a[adir_idx]; - } - else - to_ang = atan2(from_pt->y - to_pt->y, from_pt->x - to_pt->x); /* concave-target-angle */ - - to_sid = grbs_get_seg_idx(grbs, to_pt, to_ang, grbs_adir_is_concave(adir)); - if (to_sid < 0) { - failprintf("no seg\n"); - return NULL; - } - - /* iterate with to_addr over possible orbits from in to out */ - for(to_addr.obj.arc = gdl_first(&to_pt->arcs[!is_convex][to_sid]); to_addr.obj.arc != NULL; to_addr.obj.arc = gdl_next(&to_pt->arcs[!is_convex][to_sid], to_addr.obj.arc)) { - to_addr.type = ADDR_ARC_CONVEX | ADDR_ARC_START; - if (is_convex) - res = path_find_inc2arc_convex(grbs, tn, from_pt, &to_addr, adir, to_sid); - else - res = path_find_inc2arc_concave(grbs, tn, from_pt, &to_addr, adir, to_sid); - if (res != NULL) - return res; - to_addr.type = ADDR_ARC_CONVEX | ADDR_ARC_END; - if (is_convex) - res = path_find_inc2arc_convex(grbs, tn, from_pt, &to_addr, adir, to_sid); - else - res = path_find_inc2arc_concave(grbs, tn, from_pt, &to_addr, adir, to_sid); - if (res != NULL) - return res; - } - } - else { /* orbit-to-orbit */ - grbs_addr_t to_addr, *res; - int crossbelt = (from->obj.arc->new_adir > 0) ? (grbs_adir_is_CCW(adir)) : (!grbs_adir_is_CCW(adir)); - double fromR = ((from->type & 0x0F) == ADDR_ARC_CONVEX) ? from->obj.arc->new_r : 0; - double toR = grbs_adir_is_convex(adir) ? to_r : 0; - grbs_addr_type_t to_curving = grbs_adir_is_convex(adir) ? ADDR_ARC_CONVEX : ADDR_ARC_CONCAVE; - - assert(from->type & ADDR_ARC_END); - - if (grbs_bicycle_angles(from_pt->x, from_pt->y, fromR, to_pt->x, to_pt->y, toR, a, crossbelt) != 0) { - failprintf("bicycle angles\n"); - return NULL; - } - to_sid = grbs_get_seg_idx(grbs, to_pt, a[adir_idx+2], grbs_adir_is_concave(adir)); - if (to_sid < 0) { - failprintf("no seg\n"); - return NULL; - } - - /* iterate with to_addr over possible orbits from in to out */ - for(to_addr.obj.arc = gdl_first(&to_pt->arcs[!is_convex][to_sid]); to_addr.obj.arc != NULL; to_addr.obj.arc = gdl_next(&to_pt->arcs[!is_convex][to_sid], to_addr.obj.arc)) { - to_addr.type = to_curving | ADDR_ARC_START; - res = path_find_arc2arc(grbs, tn, from, &to_addr, adir, to_sid); - if (res != NULL) - return res; - to_addr.type = to_curving | ADDR_ARC_END; - res = path_find_arc2arc(grbs, tn, from, &to_addr, adir, to_sid); - if (res != NULL) - return res; - } - } - - failprintf("invalid case\n"); - grbs_clean_unused_sentinel_seg(grbs, to_pt, grbs_adir_is_concave(adir), to_sid); /* remove sentinel that might be left behind from grbs_get_seg_idx() on to_pt */ - return NULL; -} - -grbs_addr_t *grbs_path_next(grbs_t *grbs, grbs_2net_t *tn, grbs_addr_t *from, grbs_point_t *to_pt, grbs_arc_dir_t adir) -{ - if (grbs_adir_is_convex(adir)) - return grbs_path_next_arc(grbs, tn, from, to_pt, adir, adir); - - if (grbs_adir_is_concave(adir)) - return grbs_path_next_arc(grbs, tn, from, to_pt, adir, adir - 10); - - /* if not the above two, we are going into to_pt as incident line */ - - /* coming from an incident -> inc-to-inc */ - if (addr_is_incident(from)) - return path_find_inc2inc(grbs, tn, from, to_pt); - - /* exiting from an arc, going into a point */ - return path_find_arc2inc(grbs, tn, from, to_pt, from->obj.arc->segi); -} Index: trunk/src/libgrbs/Makefile =================================================================== --- trunk/src/libgrbs/Makefile (revision 1333) +++ trunk/src/libgrbs/Makefile (nonexistent) @@ -1,22 +0,0 @@ -ROOT=../.. -SRC_3RD=$(ROOT)/src_3rd -CFLAGS = -Wall -g -I$(SRC_3RD) -I.. -LIBS = $(SRC_3RD)/libualloc/libualloc.a $(SRC_3RD)/genht/libgenht.a -LDFLAGS = -lm -OBJS=tester.o grbs.o debug.o addr_hash.o - -tester: $(OBJS) - $(CC) -o tester $(OBJS) $(LIBS) $(LDFLAGS) - -tester.o: tester.c grbs.h debug.h route.h - -grbs.o: grbs.c route_common.c route_next.c route_realize.c route_remove.c route_postproc.c route_detach.c collision.c addr.c geo.c grbs.h route.h - -debug.o: debug.c debug.h - -addr_hash.o: addr_hash.c addr_hash.h grbs.h - -test: - cd regression && ./Test.sh - @echo "*** QC pass ***" - Index: trunk/src/libgrbs/grbs.c =================================================================== --- trunk/src/libgrbs/grbs.c (revision 1333) +++ trunk/src/libgrbs/grbs.c (nonexistent) @@ -1,154 +0,0 @@ -#include -#include -#include "grbs.h" - -void grbs_init(grbs_t *grbs) -{ - memset(grbs, 0, sizeof(grbs_t)); - - /* initialize the low level allocator: use libc's malloc/free */ - grbs->sys.alloc = uall_stdlib_alloc; - grbs->sys.free = uall_stdlib_free; - grbs->sys.page_size = 4096; /* how much memory to allocate to grow the stack */ - - /* initialize the stack allocators */ - grbs->stk_points.sys = &grbs->sys; grbs->stk_points.elem_size = sizeof(grbs_point_t); - grbs->stk_2nets.sys = &grbs->sys; grbs->stk_2nets.elem_size = sizeof(grbs_2net_t); - grbs->stk_arcs.sys = &grbs->sys; grbs->stk_arcs.elem_size = sizeof(grbs_arc_t); - grbs->stk_addrs.sys = &grbs->sys; grbs->stk_addrs.elem_size = sizeof(grbs_addr_t); -} - -void grbs_uninit(grbs_t *grbs) -{ - uall_stacks_clean(&grbs->stk_points); - uall_stacks_clean(&grbs->stk_2nets); - uall_stacks_clean(&grbs->stk_arcs); - uall_stacks_clean(&grbs->stk_addrs); -} - -/* Low level object allocation: try to reuse an object from the free list, - if that's not possible, allocate a new one on the stack */ -#define grbs_new_(grbs, type, var, stk, all_lst, free_lst, linkfld) \ - do { \ - var = gdl_first(&grbs->free_lst); \ - if (var == NULL) { \ - var = uall_stacks_alloc(&grbs->stk); \ - memset(var, 0, sizeof(type)); \ - var->uid = ++grbs->uids; \ - } \ - else \ - gdl_remove(&grbs->free_lst, var, linkfld); \ - gdl_append(&grbs->all_lst, var, linkfld); \ - } while(0) - -/* Allocate a new object; "what" is arc, point or 2net; result is in var */ -#define grbs_new(grbs, what, var) \ - grbs_new_(grbs, grbs_ ## what ##_t, var, stk_ ## what ## s, all_ ## what ## s, free_ ## what ## s, link_ ## what ## s) - - -#define grbs_free_(grbs, var, all_lst, free_lst, linkfld) \ - do { \ - gdl_remove(&grbs->all_lst, var, linkfld); \ - gdl_append(&grbs->free_lst, var, linkfld); \ - } while(0) - -#define grbs_free(grbs, what, var) \ - grbs_free_(grbs, var, all_ ## what ## s, free_ ## what ## s, link_ ## what ## s) - - -grbs_point_t *grbs_point_new(grbs_t *grbs, double x, double y, double copper, double clearance) -{ - grbs_point_t *p; - - grbs_new(grbs, point, p); - - p->x = x; - p->y = y; - p->copper = copper; - p->clearance = clearance; - - return p; -} - -void grbs_point_free(grbs_t *grbs, grbs_point_t *p) -{ - grbs_free(grbs, point, p); -} - -grbs_arc_t *grbs_arc_new(grbs_t *grbs, grbs_point_t *parent, int seg, double r, double sa, double da, int is_concave) -{ - grbs_arc_t *a, *n; - - grbs_new(grbs, arc, a); - - a->r = r; - a->sa = sa; - a->da = da; - a->parent_pt = parent; - a->concave = is_concave; - - if (r != 0) { - for(n = gdl_first(&parent->arcs[!!is_concave][seg]); n != NULL; n = gdl_next(&parent->arcs[!!is_concave][seg], n)) - if (n->r >= r) - break; - if (n != NULL) - gdl_insert_before(&parent->arcs[!!is_concave][seg], n, a, link_point); - else - gdl_append(&parent->arcs[!!is_concave][seg], a, link_point); - } - else - gdl_append(&parent->incs, a, link_point); - - return a; -} - -void grbs_arc_free(grbs_t *grbs, grbs_arc_t *a) -{ - grbs_free(grbs, arc, a); -} - -grbs_2net_t *grbs_2net_new(grbs_t *grbs, double copper, double clearance) -{ - grbs_2net_t *tn; - - grbs_new(grbs, 2net, tn); - - tn->copper = copper; - tn->clearance = clearance; - - return tn; -} - -void grbs_2net_free(grbs_t *grbs, grbs_2net_t *tn) -{ - grbs_free(grbs, 2net, tn); -} - - -grbs_addr_t *grbs_addr_new(grbs_t *grbs, grbs_addr_type_t type, void *obj) -{ - grbs_addr_t *a; - - a = uall_stacks_alloc(&grbs->stk_addrs); /* this one doesn't have a free/all list as its temporary allocated for A* */ - a->type = type; - a->obj.pt = obj; - - return a; -} - -void grbs_addr_free_last(grbs_t *grbs) -{ - uall_stacks_free(&grbs->stk_addrs); -} - -static void grbs_nullprintf(const char *fmt, ...) {} - -#include "geo.c" -#include "addr.c" -#include "collision.c" -#include "route_common.c" -#include "route_next.c" -#include "route_realize.c" -#include "route_remove.c" -#include "route_postproc.c" -#include "route_detach.c" Index: trunk/src/plugins/Makefile.inc =================================================================== --- trunk/src/plugins/Makefile.inc (revision 1333) +++ trunk/src/plugins/Makefile.inc (revision 1334) @@ -1,4 +1,5 @@ PLG=$(ROOT)/src/plugins/ +THIRD=$(ROOT)/src_3rd include $(PLG)/io_tedax/Makefile.inc include $(PLG)/export_animator/Makefile.inc Index: trunk/src/plugins/rt_topo/Makefile.inc =================================================================== --- trunk/src/plugins/rt_topo/Makefile.inc (revision 1333) +++ trunk/src/plugins/rt_topo/Makefile.inc (revision 1334) @@ -6,6 +6,6 @@ $(PLG)/rt_topo/laa.o \ $(PLG)/rt_topo/trbs.o \ $(PLG)/rt_topo/crbs.o \ - $(PLG)/../libgrbs/grbs.o \ - $(PLG)/../libgrbs/addr_hash.o \ - $(PLG)/../libgrbs/debug.o + $(THIRD)/libgrbs/grbs.o \ + $(THIRD)/libgrbs/addr_hash.o \ + $(THIRD)/libgrbs/debug.o Index: trunk/src/plugins/rt_topo/crbs.c =================================================================== --- trunk/src/plugins/rt_topo/crbs.c (revision 1333) +++ trunk/src/plugins/rt_topo/crbs.c (revision 1334) @@ -34,7 +34,7 @@ #include "io.h" #include "route_res.h" -#include "../libgrbs/debug.h" +#include #include "crbs.h" Index: trunk/src/plugins/rt_topo/crbs.h =================================================================== --- trunk/src/plugins/rt_topo/crbs.h (revision 1333) +++ trunk/src/plugins/rt_topo/crbs.h (revision 1334) @@ -7,9 +7,9 @@ #include #include #include -#include <../libgrbs/grbs.h> +#include -#include "../libgrbs/addr_hash.h" +#include typedef grbs_addr_key_t htad_key_t; Index: trunk/src/plugins/rt_topo/crbs_route.c =================================================================== --- trunk/src/plugins/rt_topo/crbs_route.c (revision 1333) +++ trunk/src/plugins/rt_topo/crbs_route.c (revision 1334) @@ -32,7 +32,7 @@ #undef HT #include -#include "../libgrbs/route.h" +#include static int crbs_grbs_draw(crbs_t *crbs, char *fn); Index: trunk/src_3rd =================================================================== --- trunk/src_3rd (revision 1333) +++ trunk/src_3rd (revision 1334) Property changes on: trunk/src_3rd ___________________________________________________________________ Modified: svn:externals ## -9,5 +9,5 ## svn://svn.repo.hu/libusearch/trunk/libusearch libusearch svn://svn.repo.hu/libualloc/trunk/libualloc libualloc svn://svn.repo.hu/genprique/trunk genprique +svn://svn.repo.hu/libgrbs/trunk/libgrbs libgrbs -