Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Toolbox/Internals/RectanglesIntegerProjection.h @ 2052:d77fea5934fb
cleanup todo
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 30 Mar 2023 17:20:01 +0200 |
parents | 08f2476e8f5e |
children | 07964689cb0b |
rev | line source |
---|---|
1874
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * the License, or (at your option) any later version. |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * Lesser General Public License for more details. |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * License along with this program. If not, see |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #pragma once |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #include "../Extent2D.h" |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 #include <boost/noncopyable.hpp> |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 #include <list> |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 #include <vector> |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 namespace OrthancStone |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 { |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 namespace Internals |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 { |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 class RectanglesIntegerProjection : public boost::noncopyable |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 { |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 private: |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 class Endpoint; |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 std::vector<double> endpointsToDouble_; |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 std::vector<size_t> intervalsLow_; |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 std::vector<size_t> intervalsHigh_; |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 public: |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 RectanglesIntegerProjection(const std::list<Extent2D>& rectangles, |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 bool isHorizontal); |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 size_t GetEndpointsCount() const |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 { |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 return endpointsToDouble_.size(); |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 } |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 double GetEndpointCoordinate(size_t index) const; |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 size_t GetProjectedRectanglesCount() const; |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 size_t GetProjectedRectangleLow(size_t index) const; |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 size_t GetProjectedRectangleHigh(size_t index) const; |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 }; |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 } |
08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 } |