comparison Framework/Toolbox/OrientedBoundingBox.cpp @ 146:fb7d602e7025 wasm

OrientedBoundingBox::ComputeExtent
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 22 Jan 2018 17:30:34 +0100
parents 2115530d3703
children c5044bbfc303
comparison
equal deleted inserted replaced
145:6941b98cf0fd 146:fb7d602e7025
262 double y = boost::numeric::ublas::inner_prod(q, v_) / (2.0 * hv_) + 0.5; 262 double y = boost::numeric::ublas::inner_prod(q, v_) / (2.0 * hv_) + 0.5;
263 double z = boost::numeric::ublas::inner_prod(q, w_) / (2.0 * hw_) + 0.5; 263 double z = boost::numeric::ublas::inner_prod(q, w_) / (2.0 * hw_) + 0.5;
264 264
265 GeometryToolbox::AssignVector(target, x, y, z); 265 GeometryToolbox::AssignVector(target, x, y, z);
266 } 266 }
267
268
269 bool OrientedBoundingBox::ComputeExtent(Extent2D& extent,
270 const CoordinateSystem3D& plane) const
271 {
272 extent.Reset();
273
274 std::vector<Vector> points;
275 if (HasIntersection(points, plane))
276 {
277 for (size_t i = 0; i < points.size(); i++)
278 {
279 double x, y;
280 plane.ProjectPoint(x, y, points[i]);
281 extent.AddPoint(x, y);
282 }
283
284 return true;
285 }
286 else
287 {
288 return false;
289 }
290 }
267 } 291 }