Improvements to namespaces and file inclusion
[shapes.git] / examples / features / arclength.shape
blobc35e82dcdccc71acea7cbc1866a0102cc3068e9c
1 /** This file is part of Shapes.
2  **
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
6  ** any later version.
7  **
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.
12  **
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/>.
15  **
16  ** Copyright 2008, 2014, 2015 Henrik Tidefelt
17  **/
19 ##lookin ..Shapes
20 ##lookin ..Shapes..Geometry
22 |** pth: (0cm,0cm)--(2cm,3cm)--(3cm,2cm)
24 |** •page << [stroke pth]
25 |** •page << [[range '0 '10].foldl \ p e → ( p & [stroke [[shift [point pth [arctime pth e*0.1*[abs pth]]]] [circle 2mm]]] ) null]
27 @dash:[dashpattern 2.5cm 3mm 8mm 1cm]
30   r: 15cm
31   viewRot: [rotate3D dir:(~1,0,0) angle:30°]
32   •page << [view [stroke [viewRot [immerse [[rotate 10°] (~r,~r)--(~r,r)--(r,r)--(r,~r)--cycle]]]]]
33   •page << [view @dash:[dashpattern]|[stroke [viewRot [immerse [[rotate 10°]*[shift (~r,~r)] [circle 7mm]]]]]]
34   a: 5°
35   •page << [view [stroke [viewRot [immerse @defaultunit:1%c|[[rotate 10°] (^~a)<(~r,~r)>(^90°+a)--(^~90°-a)<(~r,r)>(^a)--(^180°-a)<(r,r)>(^~90°+a)--(^90°-a)<(r,~r)>(^~180°+a)--cycle]]]]]
36   •page << [circle 5mm] >> immerse >> viewRot >> stroke >> view
37   •page << [circle 10mm] >> immerse >> viewRot >> stroke >> view
38   •page << [circle 15mm] >> immerse >> viewRot >> stroke >> view
39   •page << [circle 20mm] >> immerse >> viewRot >> stroke >> view
40   •page << [circle 25mm] >> immerse >> viewRot >> stroke >> view
41   •page << [circle 30mm] >> immerse >> viewRot >> stroke >> view