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 Henrik Tidefelt
19 MetaPostArrow: \ p ahLength:void ahAngle:30° fillAsStroking:true .>
23 theLength: [if [typeof ahLength]==§Void @width*6 ahLength]
24 l: [min theLength 0.9*[abs p]]
27 picture: @nonstroking:[if fillAsStroking @stroking @nonstroking]
29 [fill [[shift z]*[rotate ahAngle*0.5]*[shift ~z] e]--[reverse [[shift z]*[rotate ~ahAngle*0.5]*[shift ~z] e]]--cycle]
35 triangleArrow: \ p ahLength:void ahAngle:30° fillAsStroking:true .>
41 theLength: [if [typeof ahLength]==§Void @width*6 ahLength]
43 picture: @nonstroking:[if fillAsStroking @stroking @nonstroking]
45 [fill (z+[dir d - ahAngle/2]*theLength)--z--(z+[dir d + ahAngle/2]*theLength)--cycle]
60 [affinetransform3D x y z (0cm,0cm,0cm)]
63 \ p ahLength:void ahAngle:30° .>
65 theLength: [if [typeof ahLength]==§Void @width*6 ahLength]
66 l: [min theLength*[cos ahAngle] 0.9*[abs p]]
69 picture: [stroke [[shift [p 0.5*theLength*[cos ahAngle]].p]*[ztf [p 0.5*theLength*[cos ahAngle]].T] [immerse [circle 0.5*theLength*[sin ahAngle]]]]]
71 [stroke [[shift [p theLength*[cos ahAngle]].p]*[ztf [p theLength*[cos ahAngle]].T] [immerse [circle theLength*[sin ahAngle]]]]]
77 MetaPostArrow3D: \ normal p ahLength:void ahAngle:30° .>
79 theLength: [if [typeof ahLength]==§Void @width*6 ahLength]
80 l: [min theLength 0.9*[abs p]]
82 rev: [reverse [[shift z]*[rotate3D dir:normal angle: ~ahAngle*0.5]*[shift ~z] e]]
84 picture: [fill [[shift z]*[rotate3D dir:normal angle:ahAngle*0.5]*[shift ~z] e]--rev--cycle]
86 [fill [[shift z]*[rotate3D dir:normal angle:ahAngle*0.5]*[shift ~z] e]--[reverse [[shift z]*[rotate3D dir:normal angle: ~ahAngle*0.5]*[shift ~z] e]]--cycle]
87 cut: 0.8*[cos ahAngle*0.5]*theLength
91 triangleArrow3D: \ p normal:(0,0,1) ahLength:void ahAngle:30° .>
94 l: [if [typeof ahLength]==§Void @width*6 ahLength]
95 rotDir1: [cross sl.T [orthogonal sl.T]]
99 fill [] [shift z] [] ( (0m,0m,0m)--([rotate3D dir:rotDir angle:ahAngle*0.5][](l*sl.T))--([rotate3D dir:rotDir angle:~ahAngle*0.5][](l*sl.T))--cycle ) }
101 { rotDir: [cross sl.T rotDir1]
102 fill [] [shift z] [] ( (0m,0m,0m)--([rotate3D dir:rotDir angle:ahAngle*0.5][](l*sl.T))--([rotate3D dir:rotDir angle:~ahAngle*0.5][](l*sl.T))--cycle ) }