/** This file is part of Shapes. ** ** Shapes is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** any later version. ** ** Shapes is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with Shapes. If not, see . ** ** Copyright 2008, 2010, 2013, 2014 Henrik Tidefelt **/ ##lookin ..Shapes ##lookin ..Shapes..Geometry pathpoints: { helper: \ sl → [if sl.looped Data..nil [Data..cons sl [helper sl+1]]] \ pth → [helper pth.begin] } sstroke: \ pth → ( (Traits..@stroking:Traits..RGB..RED & Traits..@width:(0.5*Traits..@width) | [[pathpoints pth].foldl \ p sl → ( p & [Graphics..stroke [shift sl.p][]( (sl.N*3*Traits..@width)--(sl.N*~3*Traits..@width) )] ) Graphics..null]) & [Graphics..stroke pth] ) cstroke: \ pth → ( (Traits..@stroking:Traits..RGB..GREEN & Traits..@width:(2*Traits..@width) | [Graphics..stroke [Geometry..controlling pth]] ) & (Traits..@stroking:Traits..RGB..RED & Traits..@width:(0.5*Traits..@width) | [[pathpoints pth].foldl \ p sl → ( p & [Graphics..stroke [shift sl.p][]( (sl.N*3*Traits..@width)--(sl.N*~3*Traits..@width) )] ) Graphics..null]) & [Graphics..stroke pth] ) { pth: (~2cm,0cm)<(0cm,0cm)>(2cm,~1cm)--(1cm,3cm)<(2cm,1cm)>(3cm,1cm) IO..•page << [sstroke pth] IO..•page << [cstroke [upsample_balance [shift (~5cm,0)][]pth]] IO..•page << [sstroke [upsample_inflections [shift (5cm,0)][]pth]] IO..•page << [sstroke [upsample_bends 60° [shift (10cm,0)][]pth]] IO..•page << [sstroke [upsample_every 1cm [shift (15cm,0)][]pth]] } { pth: [[shift (0,~2cm)] (0cm,0cm)>(~2cm,0.2cm)--(3cm,~0.2cm)<(2cm,0cm)] IO..•page << [sstroke pth] IO..•page << [cstroke [upsample_balance [shift (~5cm,0)][]pth]] IO..•page << [sstroke [upsample_inflections [shift (5cm,0cm)][]pth]] IO..•page << [sstroke [upsample_bends 60° [shift (10cm,0)][]pth]] IO..•page << [sstroke [upsample_every 1cm [shift (15cm,0)][]pth]] } { pth: [[shift (0,~3cm)] (0cm,0cm)>(~2cm,0.2cm)--(3cm,0.2cm)<(2cm,0.1cm)] IO..•page << [sstroke pth] IO..•page << [cstroke [upsample_balance [shift (~5cm,0)][]pth]] IO..•page << [sstroke [upsample_inflections [shift (5cm,0cm)][]pth]] IO..•page << [sstroke [upsample_bends 60° [shift (10cm,0)][]pth]] IO..•page << [sstroke [upsample_every 1cm [shift (15cm,0)][]pth]] } { pth: [[shift (0,~4cm)] (0cm,0cm)>(~2cm,0cm)--(3cm,0cm)<(2cm,0cm)] IO..•page << [sstroke pth] IO..•page << [cstroke [upsample_balance [shift (~5cm,0)][]pth]] IO..•page << [sstroke [upsample_inflections [shift (5cm,0cm)][]pth]] IO..•page << [sstroke [upsample_bends 60° [shift (10cm,0)][]pth]] IO..•page << [sstroke [upsample_every 1cm [shift (15cm,0)][]pth]] } { pth: [[shift (0,~7cm)] (~1cm,~0.5cm)--(2cm,1cm)] IO..•page << [sstroke pth] IO..•page << [cstroke [upsample_balance [shift (~5cm,0)][]pth]] IO..•page << [sstroke [upsample_inflections [shift (5cm,0cm)][]pth]] IO..•page << [sstroke [upsample_bends 60° [shift (10cm,0)][]pth]] IO..•page << [sstroke [upsample_every 1cm [shift (15cm,0)][]pth]] } { pth: [[shift (0,~10cm)] (~2cm,0cm)<(0cm,0cm)>(2cm,~1cm)--(1cm,3cm)<(2cm,1cm)>(3cm,1cm)--cycle] IO..•page << [sstroke pth] IO..•page << [cstroke [upsample_balance [shift (~5cm,0)][]pth]] IO..•page << [sstroke [upsample_inflections [shift (5cm,0)][]pth]] IO..•page << [sstroke [upsample_bends 60° [shift (10cm,0)][]pth]] IO..•page << [sstroke [upsample_every 1cm [shift (15cm,0)][]pth]] } { pth: [[shift (0,~13cm)] [circle 2cm]] IO..•page << [sstroke pth] IO..•page << [cstroke [upsample_balance [shift (~5cm,0)][]pth]] IO..•page << [sstroke [upsample_bends 40° [shift (10cm,0)][]pth]] IO..•page << [sstroke [upsample_every 1cm [shift (15cm,0)][]pth]] } { pth: [[shift (0,~17cm)] (0cm,0cm)>(2.5cm^45°)--(2.5cm^135°)<(2cm,0cm)] IO..•page << [sstroke pth] IO..•page << [cstroke [upsample_balance [shift (~5cm,0)][]pth]] IO..•page << [sstroke [upsample_inflections [shift (5cm,0cm)][]pth]] IO..•page << [sstroke [upsample_bends 60° [shift (10cm,0)][]pth]] IO..•page << [sstroke [upsample_every 1cm [shift (15cm,0)][]pth]] } { pth: [[shift (0,~19cm)] (0cm,0cm)>(2cm,2cm)--(0cm,2cm)<(2cm,0cm)] IO..•page << [sstroke pth] IO..•page << [cstroke [upsample_balance [shift (~5cm,0)][]pth]] IO..•page << [sstroke [upsample_inflections [shift (5cm,0cm)][]pth]] IO..•page << [sstroke [upsample_bends 60° [shift (10cm,0)][]pth]] IO..•page << [sstroke [upsample_every 1cm [shift (15cm,0)][]pth]] } { pth: [[shift (0,~21cm)] (0cm,0cm)>(4cm^45°)--(4cm^135°)<(2cm,0cm)] IO..•page << [sstroke pth] IO..•page << [cstroke [upsample_balance [shift (~5cm,0)][]pth]] IO..•page << [sstroke [upsample_inflections [shift (5cm,0cm)][]pth]] IO..•page << [sstroke [upsample_bends 60° [shift (10cm,0)][]pth]] IO..•page << [sstroke [upsample_every 1cm [shift (15cm,0)][]pth]] }