comparison Framework/Volumes/OrientedVolumeBoundingBox.h @ 742:fa5febe0f0c2

moved OrientedBoundingBox in the Volumes folder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 May 2019 09:41:03 +0200
parents Framework/Toolbox/OrientedBoundingBox.h@c3bbb130abc4
children 2d8ab34c8c91
comparison
equal deleted inserted replaced
741:c1d6a566dfd3 742:fa5febe0f0c2
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-2019 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 "../Toolbox/CoordinateSystem3D.h"
25 #include "../Toolbox/Extent2D.h"
26 #include "../Toolbox/LinearAlgebra.h"
27 #include "VolumeImageGeometry.h"
28
29 namespace OrthancStone
30 {
31 class OrientedVolumeBoundingBox : public boost::noncopyable
32 {
33 private:
34 Vector c_; // center
35 Vector u_; // normalized width vector
36 Vector v_; // normalized height vector
37 Vector w_; // normalized depth vector
38 double hu_; // half width
39 double hv_; // half height
40 double hw_; // half depth
41
42 public:
43 OrientedVolumeBoundingBox(const VolumeImageGeometry& geometry);
44
45 const Vector& GetCenter() const
46 {
47 return c_;
48 }
49
50 bool HasIntersectionWithPlane(std::vector<Vector>& points,
51 const Vector& normal,
52 double d) const;
53
54 bool HasIntersection(std::vector<Vector>& points,
55 const CoordinateSystem3D& plane) const;
56
57 bool Contains(const Vector& p) const;
58
59 void FromInternalCoordinates(Vector& target,
60 double x,
61 double y,
62 double z) const;
63
64 void FromInternalCoordinates(Vector& target,
65 const Vector& source) const;
66
67 void ToInternalCoordinates(Vector& target,
68 const Vector& source) const;
69
70 bool ComputeExtent(Extent2D& extent,
71 const CoordinateSystem3D& plane) const;
72 };
73 }
74