comparison Framework/Toolbox/OrientedBoundingBox.h @ 140:2115530d3703 wasm

OrientedBoundingBox
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 18 Jan 2018 14:42:33 +0100
parents
children fb7d602e7025
comparison
equal deleted inserted replaced
139:22628d37ef5c 140:2115530d3703
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Affero General Public License
9 * as published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/
20
21
22 #pragma once
23
24 #include "GeometryToolbox.h"
25 #include "../Volumes/ImageBuffer3D.h"
26
27 namespace OrthancStone
28 {
29 class OrientedBoundingBox : public boost::noncopyable
30 {
31 private:
32 Vector c_; // center
33 Vector u_; // normalized width vector
34 Vector v_; // normalized height vector
35 Vector w_; // normalized depth vector
36 double hu_; // half width
37 double hv_; // half height
38 double hw_; // half depth
39
40 public:
41 OrientedBoundingBox(const ImageBuffer3D& image);
42
43 bool HasIntersectionWithPlane(std::vector<Vector>& points,
44 const Vector& normal,
45 double d) const;
46
47 bool HasIntersection(std::vector<Vector>& points,
48 const CoordinateSystem3D& plane) const;
49
50 bool Contains(const Vector& p) const;
51
52 void FromInternalCoordinates(Vector& target,
53 double x,
54 double y,
55 double z) const;
56
57 void FromInternalCoordinates(Vector& target,
58 const Vector& source) const;
59
60 void ToInternalCoordinates(Vector& target,
61 const Vector& source) const;
62
63 const Vector& GetCenter() const
64 {
65 return c_;
66 }
67 };
68 }
69