function out=unitvec(v) out=v/veclength(v);