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
19 ##echo This example illustrates that a z sorter does a bad job with cyclic overlaps.
22 ##lookin ..Shapes..Geometry3D
26 Traits..@nonstroking:[Traits..gray a / 360°]
28 [Geometry3D..rotate angle:a dir:(0,0,1)] [] [Graphics..fill (0.5cm,~4cm,0cm)--(2.5cm,~4cm,0cm)--(1.5cm,5cm,0.5cm)--cycle]
31 •zbuf: Graphics3D..newZSorter
34 [[Data..range 0° 359° 120°].foldl
38 •zbuf << Traits..@nonstroking:[Traits..gray 0.3] | [Graphics..fill (3cm,~2cm,0cm)--(3cm,2cm,0cm)--(7cm,0cm,2cm)--cycle]
39 << Traits..@nonstroking:[Traits..gray 0.7] | [Graphics..fill (8cm,~1cm,0cm)--(8cm,1cm,0cm)--(4cm,0cm,2cm)--cycle]
44 tf: [Geometry3D..rotate (1,0,0) 60°]
45 |**tf: [Geometry3D..affinetransform (0,4,7) (2,5,8) (3,6,9) (0cm,0cm,0cm)]