// Last edited on 2011-05-08 09:38:26 by stolfi // COORDINATE AXES #macro coord_axis(tip,rad,cor,tag) // Coordinate axis from origin to {tip}, with // stem radius {rad}, color {cor}, and name {tag} (unused). #local L_full = vlength(tip); #local L_head = 20*rad; #local b_head = ((L_full - L_head)/L_full)*tip; union{ sphere{ <0,0,0>, rad } cylinder{ <0,0,0>, 1.01*b_head, rad } cone{ b_head, 3*rad, tip, 0.00 } texture{ pigment{ color rgb cor } finish{ ambient 0.5 diffuse 0.5 } } } #end #macro coord_axes(L) // The three coordinate axes, each with length {L} // Axis X is red, Y is green, Z is blue. #local rad = 0.0040*L; union{ object{ coord_axis( , rad, <1.0,0.2,0.2>, "X") } object{ coord_axis( <0,L,0>, rad, <0.0,0.8,0.0>, "Y") } object{ coord_axis( <0,0,L>, rad, <0.3,0.3,1.0>, "Z") } } #end