Permalink
Browse files

go: lazy compute bounce vector

  • Loading branch information...
kidoman committed Oct 3, 2013
1 parent f6b3ad1 commit efa1672ad5c8fa41550a611217ec3fe239cfd3c6
Showing with 5 additions and 1 deletion.
  1. +5 −1 main.go
View
@@ -223,11 +223,15 @@ func tracer(orig, dir vector.Vector) (st status, dist float64, bounce vector.Vec
if s < dist && s > 0.01 {
dist = s
bounce = p.Add(dir.Scale(dist)).Normalize()
bounce = p // We can lazy compute bounce based on value of p
st = hit
}
}
}
if st == hit {
bounce = bounce.Add(dir.Scale(dist)).Normalize()
}
return
}

0 comments on commit efa1672

Please sign in to comment.