Mercurial > hg > orthanc-stone
comparison 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 |
comparison
equal
deleted
inserted
replaced
156:441cfe8e7440 | 157:2309e8d86efe |
---|---|
51 { | 51 { |
52 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); | 52 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); |
53 } | 53 } |
54 | 54 |
55 GeometryToolbox::CrossProduct(normal_, axisX_, axisY_); | 55 GeometryToolbox::CrossProduct(normal_, axisX_, axisY_); |
56 | |
57 d_ = -(normal_[0] * origin_[0] + normal_[1] * origin_[1] + normal_[2] * origin_[2]); | |
56 | 58 |
57 // Just a sanity check, it should be useless by construction | 59 // Just a sanity check, it should be useless by construction |
58 assert(GeometryToolbox::IsNear(boost::numeric::ublas::norm_2(normal_), 1.0)); | 60 assert(GeometryToolbox::IsNear(boost::numeric::ublas::norm_2(normal_), 1.0)); |
59 } | 61 } |
60 | 62 |
172 | 174 |
173 bool CoordinateSystem3D::IntersectSegment(Vector& p, | 175 bool CoordinateSystem3D::IntersectSegment(Vector& p, |
174 const Vector& edgeFrom, | 176 const Vector& edgeFrom, |
175 const Vector& edgeTo) const | 177 const Vector& edgeTo) const |
176 { | 178 { |
177 double d = -(normal_[0] * origin_[0] + normal_[1] * origin_[1] + normal_[2] * origin_[2]); | 179 return GeometryToolbox::IntersectPlaneAndSegment(p, normal_, d_, edgeFrom, edgeTo); |
178 return GeometryToolbox::IntersectPlaneAndSegment(p, normal_, d, edgeFrom, edgeTo); | 180 } |
181 | |
182 | |
183 bool CoordinateSystem3D::IntersectLine(Vector& p, | |
184 const Vector& origin, | |
185 const Vector& direction) const | |
186 { | |
187 return GeometryToolbox::IntersectPlaneAndLine(p, normal_, d_, origin, direction); | |
179 } | 188 } |
180 } | 189 } |