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