X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgeometry%2Ftransformedshape.h;h=34fd2989f2cfeaadddcf40ef6822ae2fb37c62d0;hb=c135ff2480f4e2aaf05b0206631bb0e1b5d73fad;hp=ea7281f746067c8d0c4dcb757edd1120ee0c903b;hpb=9260eee3126731c1e6b54ce3407be757d0d71716;p=libs%2Fmath.git diff --git a/source/geometry/transformedshape.h b/source/geometry/transformedshape.h index ea7281f..34fd298 100644 --- a/source/geometry/transformedshape.h +++ b/source/geometry/transformedshape.h @@ -8,6 +8,9 @@ namespace Msp { namespace Geometry { +/** +A shape modified by an affine transformation. +*/ template class TransformedShape: public Shape { @@ -104,6 +107,7 @@ inline unsigned TransformedShape::get_intersections(const Ray &ray, /* 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].distance = inner_product(points[i].position-ray.get_start(), ray.get_direction()); } } return count;