src/types/boundingbox.h

Wed, 22 Jan 2020 00:23:29 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 22 Jan 2020 00:23:29 +0200
changeset 26
3a9e761e4faa
parent 22
6da867fa5429
child 33
4c41bfe2ec6e
permissions
-rw-r--r--

at least VAOs work now

19
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 /*
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 * Copyright (C) 2013 - 2018 Teemu Piippo
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 *
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 * (at your option) any later version.
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 *
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 * GNU General Public License for more details.
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 *
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 */
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 #pragma once
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 #include "vertex.h"
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 class BoundingBox
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 {
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 public:
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 void consider(const Point3D& vertex);
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 Point3D minimum {math::infinity, math::infinity, math::infinity};
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27 Point3D maximum {-math::infinity, -math::infinity, -math::infinity};
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 BoundingBox& operator<<(const Point3D& v);
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 };
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 static constexpr BoundingBox emptyBoundingBox = {};
22
6da867fa5429 commit work on GL rendering
Teemu Piippo <teemu@hecknology.net>
parents: 20
diff changeset
32 Point3D boxCenter(const BoundingBox& box);
19
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 double longestMeasure(const BoundingBox& box);
ed9685f44ab3 added missing files
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34 double spaceDiagonal(const BoundingBox& box);
22
6da867fa5429 commit work on GL rendering
Teemu Piippo <teemu@hecknology.net>
parents: 20
diff changeset
35
6da867fa5429 commit work on GL rendering
Teemu Piippo <teemu@hecknology.net>
parents: 20
diff changeset
36 bool operator==(const BoundingBox& box_1, const BoundingBox& box_2);
6da867fa5429 commit work on GL rendering
Teemu Piippo <teemu@hecknology.net>
parents: 20
diff changeset
37 bool operator!=(const BoundingBox& box_1, const BoundingBox& box_2);

mercurial