|
1 /* |
|
2 * LDForge: LDraw parts authoring CAD |
|
3 * Copyright (C) 2013 - 2017 Teemu Piippo |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation, either version 3 of the License, or |
|
8 * (at your option) any later version. |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License |
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 */ |
|
18 |
|
19 #pragma once |
|
20 #include "vertex.h" |
|
21 |
|
22 // |
|
23 // Defines a bounding box that encompasses a given set of objects. |
|
24 // vertex0 is the minimum vertex, vertex1 is the maximum vertex. |
|
25 // |
|
26 class BoundingBox |
|
27 { |
|
28 public: |
|
29 BoundingBox(); |
|
30 |
|
31 void calcVertex(const Vertex& vertex); |
|
32 Vertex center() const; |
|
33 bool isEmpty() const; |
|
34 double longestMeasurement() const; |
|
35 void reset(); |
|
36 const Vertex& vertex0() const; |
|
37 const Vertex& vertex1() const; |
|
38 |
|
39 BoundingBox& operator<<(const Vertex& v); |
|
40 |
|
41 private: |
|
42 bool m_isEmpty; |
|
43 Vertex m_vertex0; |
|
44 Vertex m_vertex1; |
|
45 }; |