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, 2014 Henrik Tidefelt
21 pathStyle: @width: 1bp
22 controlStyle: @width: 0.3bp & @dash:[dashpattern 2mm 2mm] & @stroking:[gray 0.5]
23 onPathMark: @nonstroking:RGB_RED | [fill [circle 1mm]]
24 controlHead: \ p → (> cut:0bp
25 picture: @width:1bp & @stroking:RGB_RED & @dash:[dashpattern] | ([shift p.begin.p]*[rotate [angle p.begin.T]])[][stroke (~1.5mm,~1.5mm)--(1.5mm,1.5mm) & (~1.5mm,1.5mm)--(1.5mm,~1.5mm)]
28 twoHandlesHelper: \ p0 p1 p2 p3 →
30 [[shift p0] onPathMark]
32 [[shift p3] onPathMark]
34 ( controlStyle | [stroke p0--p1 head:controlHead] )
36 ( controlStyle | [stroke p3--p2 head:controlHead] )
38 ( pathStyle | [stroke p0>p1--p2<p3] )
41 frontHandlesHelper: \ p0 p1 p3 →
43 [[shift p0] onPathMark]
45 [[shift p3] onPathMark]
47 ( controlStyle | [stroke p0--p1 head:controlHead] )
49 ( pathStyle | [stroke p0>p1--p3] )
52 rearHandlesHelper: \ p0 p2 p3 →
54 [[shift p0] onPathMark]
56 [[shift p3] onPathMark]
58 ( controlStyle | [stroke p3--p2 head:controlHead] )
60 ( pathStyle | [stroke p0--p2<p3] )
63 noHandlesHelper: \ p0 p3 →
65 [[shift p0] onPathMark]
67 [[shift p3] onPathMark]
69 ( pathStyle | [stroke p0--p3] )
76 p1: p0+s1*1.5cm*[dir 60°]
77 p2: p3+s2*3cm*[dir ~165°]
80 [noHandlesHelper p0 p3]
81 [rearHandlesHelper p0 p2 p3]]
83 [frontHandlesHelper p0 p1 p3]
84 [twoHandlesHelper p0 p1 p2 p3]]]
90 •page << [shift (0dx,0dy)] [] [twoHandles 1 1]
91 << [shift (0dx,~1dy)] [] [twoHandles 1 1/2]
92 << [shift (0dx,~2dy)] [] [twoHandles 1 1/4]
93 << [shift (0dx,~3dy)] [] [twoHandles 1 0.001]
94 << [shift (0dx,~4dy)] [] [twoHandles 1 0]
96 << [shift (1dx,~4dy)] [] [twoHandles 1/2 0]
97 << [shift (2dx,~4dy)] [] [twoHandles 1/4 0]
98 << [shift (3dx,~4dy)] [] [twoHandles 0.001 0]
99 << [shift (4dx,~4dy)] [] [twoHandles 0 0]
101 << [shift (1dx,0dy)] [] [twoHandles 1/2 1]
102 << [shift (2dx,0dy)] [] [twoHandles 1/4 1]
103 << [shift (3dx,0dy)] [] [twoHandles 0.001 1]
104 << [shift (4dx,0dy)] [] [twoHandles 0 1]
106 << [shift (4dx,~1dy)] [] [twoHandles 0 1/2]
107 << [shift (4dx,~2dy)] [] [twoHandles 0 1/4]
108 << [shift (4dx,~3dy)] [] [twoHandles 0 0.001]