Mercurial > hg > orthanc-stone
diff Framework/Toolbox/CoordinateSystem3D.cpp @ 157:2309e8d86efe wasm
IntersectPlaneAndLine
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 09 Feb 2018 16:00:29 +0100 |
parents | 2e023be0563c |
children | a053ca7fa5c6 |
line wrap: on
line diff
--- a/Framework/Toolbox/CoordinateSystem3D.cpp Thu Feb 08 15:22:35 2018 +0100 +++ b/Framework/Toolbox/CoordinateSystem3D.cpp Fri Feb 09 16:00:29 2018 +0100 @@ -54,6 +54,8 @@ GeometryToolbox::CrossProduct(normal_, axisX_, axisY_); + d_ = -(normal_[0] * origin_[0] + normal_[1] * origin_[1] + normal_[2] * origin_[2]); + // Just a sanity check, it should be useless by construction assert(GeometryToolbox::IsNear(boost::numeric::ublas::norm_2(normal_), 1.0)); } @@ -174,7 +176,14 @@ const Vector& edgeFrom, const Vector& edgeTo) const { - double d = -(normal_[0] * origin_[0] + normal_[1] * origin_[1] + normal_[2] * origin_[2]); - return GeometryToolbox::IntersectPlaneAndSegment(p, normal_, d, edgeFrom, edgeTo); + return GeometryToolbox::IntersectPlaneAndSegment(p, normal_, d_, edgeFrom, edgeTo); + } + + + bool CoordinateSystem3D::IntersectLine(Vector& p, + const Vector& origin, + const Vector& direction) const + { + return GeometryToolbox::IntersectPlaneAndLine(p, normal_, d_, origin, direction); } }