How to create coordinate system given only a vector? (left-handed, right-handed, local or different space)
I'm searching calculate a local coordiante system algorithm given only one vector:
Reason:
1) Maybe Z is surface normal, then X and Y vector would be tangent and bitangent vector
2) Another reason is for ray tracing: sampling a light source. Given a intersection point construct local coordinate system from that point then trace ray to light shape.
Vector3 Z = {0.0f, 0.0f, 1.0f}; // given
// fill x and y
CreateXHandedCoordinateSystem(Vector3* X, Vector3* Y, const Vector3& Z) {
// implementation goes here..
// evaluate algorithm
// calculate X
// Y = cross(X, Z) or something ..
}