bbox.h

Fri, 12 Apr 2013 02:54:25 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Fri, 12 Apr 2013 02:54:25 +0300
changeset 102
cacd4681ccb4
parent 71
c9f02d2dd9eb
child 104
6e29bb0e83c5
permissions
-rw-r--r--

Added basic object moving with MLCAD-like controls.

30
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
1 /*
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
2 * LDForge: LDraw parts authoring CAD
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
3 * Copyright (C) 2013 Santeri `arezey` Piippo
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
4 *
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
5 * This program is free software: you can redistribute it and/or modify
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
6 * it under the terms of the GNU General Public License as published by
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
8 * (at your option) any later version.
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
9 *
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
10 * This program is distributed in the hope that it will be useful,
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
13 * GNU General Public License for more details.
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
14 *
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
15 * You should have received a copy of the GNU General Public License
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
17 */
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
18
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #ifndef __BBOX_H__
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #define __BBOX_H__
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "common.h"
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23
60
961663d05463 Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
24 // =============================================================================
961663d05463 Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
25 // The bounding box, bbox for short, is the
961663d05463 Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
26 // box that encompasses the model we have open.
961663d05463 Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
27 // v0 is the minimum vertex, v1 is the maximum vertex.
961663d05463 Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
28 // =============================================================================
961663d05463 Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
961663d05463 Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
30 // =============================================================================
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 class bbox {
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 public:
60
961663d05463 Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
33 vertex v0, v1;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 bbox ();
60
961663d05463 Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
36
961663d05463 Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
37 void reset ();
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 void calculate ();
60
961663d05463 Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
39 double calcSize ();
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 private:
71
c9f02d2dd9eb Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 60
diff changeset
42 void checkObject (LDObject* obj);
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 void checkVertex (vertex v);
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 };
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 #endif

mercurial