Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/CoordinateSystem3D.cpp @ 152:2e023be0563c wasm
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 01 Feb 2018 18:42:34 +0100 |
parents | c5044bbfc303 |
children | 2309e8d86efe |
comparison
equal
deleted
inserted
replaced
151:c5044bbfc303 | 152:2e023be0563c |
---|---|
168 offsetX = boost::numeric::ublas::inner_prod(axisX_, projection - origin_); | 168 offsetX = boost::numeric::ublas::inner_prod(axisX_, projection - origin_); |
169 offsetY = boost::numeric::ublas::inner_prod(axisY_, projection - origin_); | 169 offsetY = boost::numeric::ublas::inner_prod(axisY_, projection - origin_); |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 bool CoordinateSystem3D::IntersectSegment(double& x, | 173 bool CoordinateSystem3D::IntersectSegment(Vector& p, |
174 double& y, | |
175 const Vector& edgeFrom, | 174 const Vector& edgeFrom, |
176 const Vector& edgeTo) const | 175 const Vector& edgeTo) const |
177 { | 176 { |
178 Vector p; | |
179 double d = -(normal_[0] * origin_[0] + normal_[1] * origin_[1] + normal_[2] * origin_[2]); | 177 double d = -(normal_[0] * origin_[0] + normal_[1] * origin_[1] + normal_[2] * origin_[2]); |
180 if (GeometryToolbox::IntersectPlaneAndSegment(p, normal_, d, edgeFrom, edgeTo)) | 178 return GeometryToolbox::IntersectPlaneAndSegment(p, normal_, d, edgeFrom, edgeTo); |
181 { | |
182 ProjectPoint(x, y, p); // TODO could be optimized, as the point | |
183 // is on the plane by construction | |
184 return true; | |
185 } | |
186 else | |
187 { | |
188 return false; | |
189 } | |
190 } | 179 } |
191 } | 180 } |