src/bbox.cpp

Sat, 13 Jul 2013 19:02:48 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 13 Jul 2013 19:02:48 +0300
changeset 377
271d1da66b7e
parent 359
bcdfc801658b
child 379
f5f3faac60cd
permissions
-rw-r--r--

Appended 'Object' to the names of all LDObject derivatives so even though the LD prefix isn't reserved for just LDObjects anymore, these classes remain distinct

183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
4 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
9 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
14 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include "common.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include "bbox.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include "ldtypes.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "file.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
27 bbox::bbox()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
28 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
29 reset();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
35 void bbox::calculate()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
36 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
37 reset();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
39 if( !g_curfile )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
42 for( LDObject* obj : g_curfile->objs() )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
43 calcObject( obj );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
49 void bbox::calcObject( LDObject* obj )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
50 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
51 switch( obj->getType() )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
52 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 case LDObject::Line:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 case LDObject::Triangle:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 case LDObject::Quad:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 case LDObject::CondLine:
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
57 for( short i = 0; i < obj->vertices(); ++i )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
58 calcVertex( obj->getVertex( i ) );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
59
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 break;
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
61
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 case LDObject::Subfile:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 {
377
271d1da66b7e Appended 'Object' to the names of all LDObject derivatives so even though the LD prefix isn't reserved for just LDObjects anymore, these classes remain distinct
Santeri Piippo <crimsondusk64@gmail.com>
parents: 359
diff changeset
64 LDSubfileObject* ref = static_cast<LDSubfileObject*>( obj );
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
65 vector<LDObject*> objs = ref->inlineContents( true, true );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
67 for( LDObject * obj : objs )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
68 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
69 calcObject( obj );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 delete obj;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 break;
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
74
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 default:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 break;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
83 void bbox::calcVertex( const vertex& v )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
84 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
85 for( const Axis ax : g_Axes )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
86 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
87 if( v[ax] < m_v0[ax] )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88 m_v0[ax] = v[ax];
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
90 if( v[ax] > m_v1[ax] )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 m_v1[ax] = v[ax];
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94 m_empty = false;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
100 void bbox::reset()
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
101 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
102 m_v0[X] = m_v0[Y] = m_v0[Z] = 0x7FFFFFFF;
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
103 m_v1[X] = m_v1[Y] = m_v1[Z] = 0xFFFFFFFF;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105 m_empty = true;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
111 double bbox::size() const
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
112 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
113 double xscale = ( m_v0[X] - m_v1[X] );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
114 double yscale = ( m_v0[Y] - m_v1[Y] );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
115 double zscale = ( m_v0[Z] - m_v1[Z] );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
116 double size = zscale;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
118 if( xscale > yscale )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
119 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
120 if( xscale > zscale )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
121 size = xscale;
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
122 }
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
123 elif( yscale > zscale )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
124 size = yscale;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
126 if( abs( size ) >= 2.0f )
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
127 return abs( size / 2 );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129 return 1.0f;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
130 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
131
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
132 // =============================================================================
359
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
133 vertex bbox::center() const
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
134 {
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
135 return vertex(
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
136 ( m_v0[X] + m_v1[X] ) / 2,
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
137 ( m_v0[Y] + m_v1[Y] ) / 2,
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
138 ( m_v0[Z] + m_v1[Z] ) / 2 );
bcdfc801658b more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 319
diff changeset
139 }

mercurial