minor Vector::refract() sign changes
git-svn-id: svn://anubis/fart/trunk@377 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
22f4a79671
commit
b24aea4dba
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user