1 /** This file is part of Shapes.
3 ** Shapes is free software: you can redistribute it and/or modify
4 ** it under the terms of the GNU General Public License as published by
5 ** the Free Software Foundation, either version 3 of the License, or
8 ** Shapes is distributed in the hope that it will be useful,
9 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ** GNU General Public License for more details.
13 ** You should have received a copy of the GNU General Public License
14 ** along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 ** Copyright 2008, 2010, 2014 Henrik Tidefelt
19 ##needs ..Shapes..Geometry / pathmapping
22 ##lookin ..Shapes..Geometry
26 helper: \ sl → [if sl.looped [Data..list] [Data..cons sl [helper sl+1]]]
27 \ pth → [helper pth.begin]
32 ( (@stroking:Traits..RGB..BLACK | [[pathpoints pth].foldl \ p sl → ( p & [Graphics..stroke [shift sl.p][]( (sl.N*6*@width)--(sl.N*~5*@width) )] ) null])
34 [Graphics..stroke pth]
39 (@stroking:Traits..RGB..GREEN & @width:(2*@width) | [Graphics..stroke [Geometry..controlling pth]] )
44 testPth: Geometry..@defaultunit:1%C | (0cm,0cm)>(^~30°)--(^)<(2cm,3cm)>(^45°)--(^)<(5cm,2cm)>(^0°)--(6cm,2cm)--(8cm,4cm)
46 test: \ •dst pth method →
51 •dst << @stroking:Traits..RGB..RED | [cstroke pth]
52 •dst << [Debug..log_after `1´ ...][][Graphics..stroke [method pth 2mm]]
53 •dst << [Debug..log_after `1´ ...][][Graphics..stroke [method pth ~2mm]]
56 pth: [shift (0,~5cm)][][upsample_inflections ../pth]
57 •dst << @stroking:Traits..RGB..RED | [cstroke pth]
58 •dst << [Debug..log_after `2´ ...][][Graphics..stroke [method pth 2mm]]
59 •dst << [Debug..log_after `2´ ...][][Graphics..stroke [method pth ~2mm]]
63 pth: ../pth >> upsample_inflections >> upsample_balance >> [shift (0,~10cm)]
64 •dst << @stroking:Traits..RGB..RED | [cstroke pth]
65 •dst << [Debug..log_after `3´ ...][][Graphics..stroke [method pth 2mm]]
66 •dst << [Debug..log_after `3´ ...][][Graphics..stroke [method pth ~2mm]]
70 pth: [shift (0,~15cm)][][upsample_bends 20° ../pth]
71 •dst << @stroking:Traits..RGB..RED | [cstroke pth]
72 •dst << [Debug..log_after `4´ ...][][Graphics..stroke [method pth 2mm]]
73 •dst << [Debug..log_after `4´ ...][][Graphics..stroke [method pth ~2mm]]
78 [Debug..log_before `sidepath´+"{n} ...][][test IO..•page testPth sidepath]
79 |**[Debug..log_before `sidepath2´+"{n} ...][][test IO..•page [shift (9cm,0)][]testPth sidepath2]