From b24aea4dba9efa4c7169c9751e39c89cdfbec298 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 12 Oct 2010 15:50:00 +0000 Subject: [PATCH] minor Vector::refract() sign changes git-svn-id: svn://anubis/fart/trunk@377 7f9b0f55-74a9-4bce-be96-3c2cd072584d --- util/Vector.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/Vector.h b/util/Vector.h index ebc944f..5fc9450 100644 --- a/util/Vector.h +++ b/util/Vector.h @@ -73,11 +73,11 @@ class Vector Vector refract(const Vector & target, double n1, double n2) const { const double n = n1 / n2; - const double cosI = dot(target); + const double cosI = -dot(target); const double sinT2 = n * n * (1.0 - cosI * cosI); if (sinT2 > 1.0) return Vector(0.0, 0.0, 0.0); - return (*this) * n - target * (n * cosI + sqrt(1.0 - sinT2)); + return (*this) * n + target * (n * cosI - sqrt(1.0 - sinT2)); } Vector getPerpendicular() const