I have a vector in space. I want to make a ring of vectors that are offset from the original by a certain angle, so that they form a cone shape. I realize this can have multiple solutions. That’s okay, as long as the resulting vectors form a cone around the original. How can this be done?
I’ve got it mostly working by converting one vector to a mat3 and multiplying the other vector by this matrix. Can anyone see anything wrong with this function?:
mat3 vec3tomat3( in vec3 z ) {
mat3 mat;
mat[2]=z;
vec3 v=vec3(z.y,z.z,z.x);//make a random vector that isn't the same as vector z
mat[0]=cross(z,v);//cross product is the x axis
mat[1]=cross(mat[0],z);//cross product is the y axis
return mat;
}