If I have two normals (i and j) and the angle between them (theta), and I want to compute cos(theta) and sin(theta), is it faster or more accurate to compute cos(theta) = dot(i, j) and sin(theta) = length(cross(i, j))?
If you’re wondering about the math, the former is derived from dot(i, j) = length(i) * length(j) * cos(theta) and the latter from length(cross(i, j)) = length(i) * length(j) * sin(theta). For normals length(i) = length(j) = 1, of course.
I doubt your sin equation will perform faster than a regular sin() instruction. Dot product for cos may be faster though.
I’m pretty sure that trigonometric functions are highly optimized on GPU these days.
Still, it’s not clear for me how your input can be so redundant: angle and to normalized vectors are obviously more than needed.
Note that I said “In this case…” The angle between 2 vectors ranges from 0 to PI, then the sin is positive. Sin would be negative with angles between PI and 2PI.