Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Volumes/OrientedVolumeBoundingBox.h @ 1574:fb5e620430ae
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 21 Sep 2020 18:29:53 +0200 |
parents | 85e117739eca |
children | 4fb8fdf03314 |
rev | line source |
---|---|
140 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
742
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
140 | 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 | |
742
fa5febe0f0c2
moved OrientedBoundingBox in the Volumes folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
735
diff
changeset
|
24 #include "../Toolbox/CoordinateSystem3D.h" |
fa5febe0f0c2
moved OrientedBoundingBox in the Volumes folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
735
diff
changeset
|
25 #include "../Toolbox/Extent2D.h" |
fa5febe0f0c2
moved OrientedBoundingBox in the Volumes folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
735
diff
changeset
|
26 #include "../Toolbox/LinearAlgebra.h" |
735
c3bbb130abc4
removing dependencies in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
27 #include "VolumeImageGeometry.h" |
140 | 28 |
29 namespace OrthancStone | |
30 { | |
742
fa5febe0f0c2
moved OrientedBoundingBox in the Volumes folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
735
diff
changeset
|
31 class OrientedVolumeBoundingBox : public boost::noncopyable |
140 | 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: | |
1571 | 43 explicit OrientedVolumeBoundingBox(const VolumeImageGeometry& geometry); |
140 | 44 |
146
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
45 const Vector& GetCenter() const |
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
46 { |
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
47 return c_; |
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
48 } |
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
49 |
140 | 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 | |
146
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
70 bool ComputeExtent(Extent2D& extent, |
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
71 const CoordinateSystem3D& plane) const; |
140 | 72 }; |
73 } | |
74 |