Permalink
Browse files

avoid using math.Pow; using **4 instead (thanks to tip from Michael J…

…ones)
  • Loading branch information...
kidoman committed Sep 26, 2013
1 parent 7520b00 commit 527e08317c9307316e2a7a8e9379cf40778eeaa1
Showing with 4 additions and 1 deletion.
  1. +4 −1 main.go
View
@@ -139,7 +139,10 @@ func sampler(orig, dir vector.Vector) vector.Vector {
st, dist, bounce := tracer(orig, dir)
if st == missUpward {
return vector.Vector{X: 0.7, Y: 0.6, Z: 1}.Scale(math.Pow(1-dir.Z, 4))
p := 1 - dir.Z
p = p * p
p = p * p
return vector.Vector{X: 0.7, Y: 0.6, Z: 1}.Scale(p)
}
h := orig.Add(dir.Scale(dist))

0 comments on commit 527e083

Please sign in to comment.