Mercurial > hg > orthanc-stone
diff 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 |
line wrap: on
line diff
--- a/Framework/Toolbox/OrientedBoundingBox.cpp Mon Jan 22 16:44:52 2018 +0100 +++ b/Framework/Toolbox/OrientedBoundingBox.cpp Mon Jan 22 17:30:34 2018 +0100 @@ -264,4 +264,28 @@ GeometryToolbox::AssignVector(target, x, y, z); } + + + bool OrientedBoundingBox::ComputeExtent(Extent2D& extent, + const CoordinateSystem3D& plane) const + { + extent.Reset(); + + std::vector<Vector> points; + if (HasIntersection(points, plane)) + { + for (size_t i = 0; i < points.size(); i++) + { + double x, y; + plane.ProjectPoint(x, y, points[i]); + extent.AddPoint(x, y); + } + + return true; + } + else + { + return false; + } + } }