/** 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, 2014 Henrik Tidefelt **/ ##lookin ..Shapes ##lookin ..Shapes..Geometry3D rot: [rotate (1,1,1) 30°] screwSeg: (~1cm,1cm,~1cm)<(~1cm,0cm,~1cm)>(~1cm,~1cm,~1cm)--(1cm,~1cm,~2cm)<(1cm,0cm,~2cm)>(1cm,1cm,~2cm) deeper: \ n → [shift (0cm,0cm,n*~2cm)] screw: [scale 1.5] [] (1cm,~1cm,0cm)<(1cm,0cm,0cm)>(1cm,1cm,0cm)--screwSeg--[[deeper 1] screwSeg]--[[deeper 2] screwSeg]--cycle •world: Graphics3D..newGroup •world << Traits..@width:0.3bp & Traits..@stroking:[Traits..gray 0.5] | [Graphics..stroke screw] markStart: 0.15 markCount: '5 paintLeg: \ pth → ( [Graphics..stroke pth] & ( Traits..@nonstroking:Traits..RGB..BLACK | [Graphics..fill [shift pth.end.p][][immerse [Geometry..circle 1.5bp]]] ) ) •world << [[Data..range '0 markCount-'1].foldl \ p i → { sl: [screw (markStart + i*(1/markCount))*[Numeric..Math..abs screw]] len: 2.5cm p & ( Graphics3D..newGroup << Traits..@stroking:Traits..RGB..RED | [paintLeg sl.p--(+(len*sl.T))] << Traits..@stroking:Traits..RGB..GREEN | [paintLeg sl.p--(+(len*sl.N))] << Traits..@stroking:Traits..RGB..BLUE | [paintLeg sl.p--(+([if i = '0 ~1 1]*len*sl.B))] << [shift sl.p+(~2mm,3mm,0mm)] [] [Graphics3D..facing [Layout..center_x [Graphics..TeX [String..sprintf `\textbf{%d}´ i+'1]]]] ) } Graphics3D..null] •world << [shift (~1.5cm,~1.5cm,0cm)] [] [Graphics3D..facing [Layout..center_x [Graphics..TeX `Odd one out!´]]] world: freeze •world { world: [rotate (1,1,1) 30°] [] ../world eyew: 5.0cm IO..•page << view [] world IO..•page << world >> [shift (~eyew,0cm,0cm)] >> view >> [Geometry..shift (2*eyew,0cm)] }