Mercurial > hg > orthanc-stone
annotate Framework/Toolbox/OrientedBoundingBox.h @ 611:e3f21a265be5
Added version directive to GLSL shader code + glew init function in sample code
AND commented-out glew init function in StoneInitialize
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 30 Apr 2019 16:07:48 +0200 |
parents | b70e9be013e4 |
children | c3bbb130abc4 |
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 | |
439 | 5 * Copyright (C) 2017-2019 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 | |
146
fb7d602e7025
OrientedBoundingBox::ComputeExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
24 #include "Extent2D.h" |
159
0a73d76333db
populating LinearAlgebra
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
146
diff
changeset
|
25 #include "LinearAlgebra.h" |
140 | 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 |