From: Mikko Rasa Date: Tue, 21 May 2013 13:19:56 +0000 (+0300) Subject: Transform normals correctly X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=fe9d42c7cb18bc1db6d278bdc2f8372822d025bf;p=libs%2Fmath.git Transform normals correctly --- diff --git a/source/geometry/transformedshape.h b/source/geometry/transformedshape.h index 90c37b0..bf508f9 100644 --- a/source/geometry/transformedshape.h +++ b/source/geometry/transformedshape.h @@ -115,7 +115,7 @@ inline unsigned TransformedShape::get_intersections(const Ray &ray, points[i].position = transformation.transform(points[i].position); /* XXX This is not correct for nonuniform scaling. Inverse of the transpose of the upper DxD part of the matrix should be used. */ - points[i].normal = transformation.transform(points[i].normal); + points[i].normal = transformation.transform_linear(points[i].normal); points[i].distance = inner_product(points[i].position-ray.get_start(), ray.get_direction()); } }