Updating documentation and examples with new core namespaces
[shapes.git] / examples / features / zbuflines.shape
blobcae49d89f556510ca120c625434789a4426cbba8
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 Henrik Tidefelt
17  **/
19 ##lookin ..Shapes
20 ##lookin ..Shapes..Geometry3D
22 leaf: \ a →
24   @nonstroking:[gray a / 360°]
25   |
26   [Geometry3D..rotate angle:a dir:(0,0,1)] [] [Graphics..fill (0.5cm,~4cm,0cm)--(2.5cm,~4cm,0cm)--(1.5cm,5cm,0.5cm)--cycle]
29 stick: \ a →
31   @stroking:[gray a / 360°]
32   |
33   [Geometry3D..rotate angle:a dir:(0,0,1)] [] [Graphics..stroke (1.5cm,~4cm,0cm)--(1.5cm,5cm,0.5cm)]
36 •zbuf: Graphics3D..newZBuf
38 •zbuf << [leaf 0°]
39 •zbuf << [stick 120°]
40 •zbuf << [stick 240°]
43   p: (3cm,0cm,0cm)--(7cm,0cm,2cm)
44   •zbuf << @nonstroking:[gray 0.7] | [Graphics..fill (8cm,~1cm,0cm)--(8cm,1cm,0cm)--(4cm,0cm,2cm)--cycle]
45         << @nonstroking:[gray 0.3] | [Graphics..stroke p]
46         << @nonstroking:[gray 0.3] | [shift (0.3cm,0cm,0cm)] [] [Graphics..stroke [p 2.5cm].p--p.end.p]
47         << @nonstroking:[gray 0.3] | [shift (0.6cm,0cm,0cm)] [] [Graphics..stroke p.begin.p--(p.end-1.8cm).p]
48         << @nonstroking:[gray 0.3] | [shift (0.9cm,0cm,0cm)] [] [Graphics..stroke [p 2.0cm].p--(p.end-1.8cm).p]
51 tf: [Geometry3D..rotate (1,0,0) 60°]
52 |**tf: [Geometry3D..affinetransform (0,4,7) (2,5,8) (3,6,9) (0cm,0cm,0cm)]
53 zbuf: •zbuf;
54 [view tf [] zbuf]