Mercurial > hg > orthanc-stone
annotate Framework/Toolbox/OrientedBoundingBox.h @ 146:fb7d602e7025 wasm
OrientedBoundingBox::ComputeExtent
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 22 Jan 2018 17:30:34 +0100 |
parents | 2115530d3703 |
children | 0a73d76333db |
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 | |
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 | |
146
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
24 #include "Extent2D.h" |
140 | 25 #include "GeometryToolbox.h" |
26 #include "../Volumes/ImageBuffer3D.h" | |
27 | |
28 namespace OrthancStone | |
29 { | |
30 class OrientedBoundingBox : public boost::noncopyable | |
31 { | |
32 private: | |
33 Vector c_; // center | |
34 Vector u_; // normalized width vector | |
35 Vector v_; // normalized height vector | |
36 Vector w_; // normalized depth vector | |
37 double hu_; // half width | |
38 double hv_; // half height | |
39 double hw_; // half depth | |
40 | |
41 public: | |
42 OrientedBoundingBox(const ImageBuffer3D& image); | |
43 | |
146
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
44 const Vector& GetCenter() const |
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
45 { |
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
46 return c_; |
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
47 } |
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
48 |
140 | 49 bool HasIntersectionWithPlane(std::vector<Vector>& points, |
50 const Vector& normal, | |
51 double d) const; | |
52 | |
53 bool HasIntersection(std::vector<Vector>& points, | |
54 const CoordinateSystem3D& plane) const; | |
55 | |
56 bool Contains(const Vector& p) const; | |
57 | |
58 void FromInternalCoordinates(Vector& target, | |
59 double x, | |
60 double y, | |
61 double z) const; | |
62 | |
63 void FromInternalCoordinates(Vector& target, | |
64 const Vector& source) const; | |
65 | |
66 void ToInternalCoordinates(Vector& target, | |
67 const Vector& source) const; | |
68 | |
146
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
69 bool ComputeExtent(Extent2D& extent, |
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
70 const CoordinateSystem3D& plane) const; |
140 | 71 }; |
72 } | |
73 |