New example: Systematic testing of intersection (and approximation) algorithm(s).
[shapes.git] / examples / features / intersections-other.shape
blob88b2f01a2c3a55a82c2d908c0eb497d0b0f0a9d0
1 pth1: @defaultunit:1%C | (0cm,0cm)>(^0°)--(^)<(1cm,1cm)>(^0°)--(^)<(2cm,~1cm)>(^0°)--(^180°)<(3cm,0cm)
2 line: (~1cm,1cm)--(0cm,1cm)--(1cm,~1cm)
4 sl1Mark: @width:2bp & @stroking:RGB_RED | [stroke [circle 2mm]]
5 sl2Mark: @width:0.7bp & @stroking:RGB_BLUE | [stroke [circle 2mm]]
6 sla1Mark: @width:2bp & @stroking:RGB_RED | [stroke [circle 3mm]]
7 sla2Mark: @width:0.7bp & @stroking:RGB_BLUE | [stroke [circle 3mm]]
9 fixedHead: [ShapesArrow width:3bp ...]
11 helper: \ pth1 pth2 →
13   sl: [intersection pth1 pth2]
14   sla: [approximator pth1 pth2]
15   ( newGroup
16     << [stroke pth1 head:fixedHead]
17     << @width:0.3bp | [stroke pth2 head:fixedHead]
18     << sl1Mark >> [shift sl.p]
19     << sl2Mark >> [shift sl.info.other.p]
20     << sla1Mark >> [shift sla.p]
21     << sla2Mark >> [shift sla.info.other.p]
22     << ( newText << ( newString << [abs sl.p - sl.info.other.p] ) ) >> [shift (0,~15mm)]
23     << ( newText << ( newString << [abs sla.p - sla.info.other.p] ) ) >> [shift (0,~20mm)]
24   )
27 ##unit d = 5cm
29 helper2: \ pth1 pth2 → ( [helper pth1 pth2] & [[shift (1d,0)] [helper pth2 pth1]] )
30 helper8: \ pth1 pth2 → ( [helper2 pth1 pth2] & [[shift (0,~1d)] [helper2 pth1 [reverse pth2]]] & [[shift (0,~2d)] [helper2 [reverse pth1] pth2]] & [[shift (0,~3d)] [helper2 [reverse pth1] [reverse pth2]]] )
32 •page << [helper8 pth1 line] >> [shift (0d,0cm)]
33       << [helper8 [shift (5mm,0)]*[scale x:~1][]line line] >> [shift (2d,0cm)]
34       << [helper8 [shift (~5mm,0)]*[scale x:~1][]line line] >> [shift (4d,0cm)]
35       << [helper8 pth1 [shift (0.5cm,~1cm)]*[rotate 60°][]pth1] >> [shift (6d,0cm)]