// Last edited on 2019-04-17 15:24:18 by stolfilocal // COORDINATE AXIS #macro axis_arrow(bas,tip,rad,shd,cor,name) // {bas} point where arrow starts. // {tip} point at tip of arrowhead. // {rad} radius of stem. // {shd} rength of arrowhead relative to {rad}. // {cor} color of arrow. // {name} name (not used). #local ctudo = vlength(tip-bas); #local cseta = shd*rad; #local ustem = (ctudo - cseta)/ctudo; #local bseta = bas + ustem*(tip-bas); #local tstem = bas + 1.01*ustem*(tip-bas); union{ sphere{ bas, rad } cylinder{ bas, tstem, rad } cone{ bseta, 3*rad, tip, 0.00 } texture{ pigment{ color rgb cor } finish{ ambient 0.5 diffuse 0.5 } } } #end #macro axis_line(bas,tip,rad,cor,name) // {bas} point where line starts. // {tip} point at tip of line. // {rad} radius of stem. // {cor} color of arrow. // {name} name (not used). union{ sphere{ bas, rad } cylinder{ bas, tip, rad } sphere{ tip, rad } texture{ pigment{ color rgb cor } finish{ ambient 0.5 diffuse 0.5 } } } #end #macro axes(xlen,ylen,zlen) #local rad = 0.005*vlength()/sqrt(3); #local shd = 10; union{ object{ axis_arrow( <0,0,0>, , rad, shd, <1.0,0.2,0.2>, "X") } object{ axis_arrow( <0,0,0>, <0,ylen,0>, rad, shd, <0.0,0.8,0.0>, "Y") } object{ axis_arrow( <0,0,0>, <0,0,zlen>, rad, shd, <0.3,0.3,1.0>, "Z") } } #end