comparison OrthancStone/Sources/Toolbox/Internals/RectanglesIntegerProjection.h @ 1874:08f2476e8f5e

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