Removed superfluous normalizations
This commit is contained in:
parent
8e14f3ccae
commit
37753f96af
3 changed files with 6 additions and 6 deletions
|
@ -27,10 +27,10 @@ bool InfinitePlane::intersect(Ray &ray) const {
|
|||
return false;
|
||||
|
||||
// Set the normal
|
||||
if (std::acos(dotProduct(ray.direction, this->normal)) > 0) {
|
||||
ray.normal = normalized(this->normal);
|
||||
if (dotProduct(normalized(ray.direction), normalized(this->normal)) > 0) {
|
||||
ray.normal = this->normal;
|
||||
} else {
|
||||
ray.normal = normalized((-1.0f * this->normal));
|
||||
ray.normal = -1.0f * this->normal;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ bool Sphere::intersect(Ray &ray) const {
|
|||
// Calculate the normal
|
||||
auto intersectPoint = ray.origin + ray.direction * t;
|
||||
auto normalDirection = intersectPoint - this->center; // Point of intersect - origin of sphere creates a line along the normal, pointing outwards
|
||||
ray.normal = normalized(normalDirection);
|
||||
ray.normal = (normalDirection);
|
||||
|
||||
// Calculate the surface position and tangent vector
|
||||
float const phi = std::acos(ray.normal.y);
|
||||
|
|
|
@ -18,7 +18,7 @@ Color RefractionShader::shade(Scene const &scene, Ray const &ray) const {
|
|||
float eta2 = indexInside;
|
||||
|
||||
|
||||
Vector3d v = normalized(ray.direction);
|
||||
Vector3d v = (ray.direction);
|
||||
Vector3d n = normalized(ray.normal);
|
||||
|
||||
// Check whether we are entering or leaving the object
|
||||
|
@ -43,7 +43,7 @@ Color RefractionShader::shade(Scene const &scene, Ray const &ray) const {
|
|||
}
|
||||
|
||||
// Calculate refracted ray direction t
|
||||
Vector3d t = normalized(
|
||||
Vector3d t = (
|
||||
eta1 / eta2 *
|
||||
(v - dotProduct(v, n) * n) -
|
||||
n * std::sqrt(denominator));
|
||||
|
|
Loading…
Reference in a new issue