function only works for cvec2f due to use of gencvec2f.
function only works for cvec2f due to use of gencvec2f.