|
Post by trejkaz on Mar 22, 2022 7:00:36 GMT
Is there a nice geometric argument for why the direction of refraction is calculated the way it is?
In the book it has it as:
The context:
In my new code I can't use n_ratio = n1 / n2 anymore because it's a complex number. So I started wondering whether I could still use sin_t / sin_i in place of it, and it sort of seems like I probably can, but I can't figure out why this formula works in the first place.
It definitely looks like I should be able to compute the refraction direction by combining normalv and eyev in some amounts, but from a diagram on paper I can't figure out how to derive this formula.
|
|
|
Post by trejkaz on Mar 22, 2022 9:58:30 GMT
Looks like I ended up figuring it out after a couple more hours. Then we have some similar triangles. First part: Similar triangles: b / sinθt = cosθi / sinθi ∴ b = cosθi sinθt / sinθi a = cosθt - b ∴ vt1 = a n = (cosθt - (cosθi sinθt / sinθi)) (-n) = ((cosθi sinθt / sinθi) - cosθt) n
Second part: Similar triangles: c / sinθt = 1 / sinθi ∴ c = sinθt / sinθi ∴ vt2 = c vi = (sinθt / sinθi) vi
∴ v = vt1 + vt2 = ((cosθi sinθt / sinθi) - cosθt) n + (sinθt / sinθi) vi
|
|
|
Post by Jamis on Mar 23, 2022 0:08:10 GMT
Well done! That's a much better answer than I'd have been able to provide. Thanks for sharing your work!
|
|