//general vector drawing macro
#macro Make_Vector(vec,head_length,post_diameter,head_diameter)
  #local vec_length = vlength(vec);
  #if(vec_length>head_length)   //draw entire vector 
    #local vec_post = (vec_length-head_length)/vec_length*vec;
    union{
      cylinder{0,vec_post,post_diameter}
      cone{vec_post,head_diameter,vec,0}
    }
  #else                         //vec too small, draw cone tip for vec
    #local this_diam=vec_length*head_diameter/head_length;
    cone{0,this_diam,vec,0}
  #end
#end

// a "smoothly turning on" function
//(0 off to 1 on transitions)
//tt is "current time"
//tt0 is turn on time start
//dtt is turn on time duration
#declare transitor=function(tt,tt0,dtt) { .5*(1-cos(min(max(tt-tt0,0),dtt)/dtt*pi))}
