added swap function to vec3d