diff options
| author | gingerBill <bill@gingerbill.org> | 2023-03-17 11:48:04 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-03-17 11:48:04 +0000 |
| commit | b7f953b2eeb8561509bc516cc87b416684cd89cb (patch) | |
| tree | d764021cae540fe96a08c88a797c900a99d9535a | |
| parent | 0b064765c913aeb4e6938e7fa3094f2d60507181 (diff) | |
| parent | eb3ddce706c15692ec5239b5913a74c6f1910ef4 (diff) | |
Merge branch 'master' of https://github.com/odin-lang/Odin
| -rw-r--r-- | core/math/linalg/extended.odin | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/math/linalg/extended.odin b/core/math/linalg/extended.odin index b78697cbd..9dee12eb9 100644 --- a/core/math/linalg/extended.odin +++ b/core/math/linalg/extended.odin @@ -429,11 +429,11 @@ reflect :: proc(I, N: $T) -> (out: T) where IS_ARRAY(T), IS_FLOAT(ELEM_TYPE(T)) b := N * (2 * dot(N, I)) return I - b } -refract :: proc(I, N: $T) -> (out: T) where IS_ARRAY(T), IS_FLOAT(ELEM_TYPE(T)) { - dv := dot(N, I) - k := 1 - eta*eta - (1 - dv*dv) +refract :: proc(I, Normal: $V/[$N]$E, eta: E) -> (out: V) where IS_ARRAY(V), IS_FLOAT(ELEM_TYPE(V)) { + dv := dot(Normal, I) + k := 1 - eta*eta * (1 - dv*dv) a := I * eta - b := N * eta*dv*math.sqrt(k) + b := Normal * (eta*dv+math.sqrt(k)) return (a - b) * E(int(k >= 0)) } |