18 location_type < NUMBER > m_origin;
19 location_type < NUMBER > m_direction;
20 dimension_type < NUMBER > m_dimension;
23 location_type < NUMBER > center()
27 location_type < NUMBER > point;
30 point = m_origin + locationd(m_dimension.cx / 2.0, m_dimension.cy / 2.0, m_dimension.cz / 2.0).rotate(m_direction);
46 void rotate(location_type < NUMBER > point, location_type < NUMBER > pointRotation)
54 m_direction += pointRotation;
55 m_origin = m_origin.rotate(pointRotation);
66 static array < ::i32_array_base > faces()
69 array < ::i32_array_base > a2;
155 array < array < location_type < NUMBER > > > faces_vertexes()
158 array < location_type < NUMBER > > v = vertexes();
159 array < ::i32_array_base > f = faces();
161 array < array < location_type < NUMBER > > > fv;
162 array < location_type < NUMBER > > vertexes;
164 for (::collection::index i = 0; i < f.get_count(); i++)
166 ::i32_array_base& ia = f[i];
167 vertexes.erase_all();
168 for (::collection::index j = 0; j < ia.get_count(); j++)
170 vertexes.add(v[ia[j]]);
179 array < location_type < NUMBER > > vertexes()
182 array < location_type < NUMBER > > point;
188 point[1] = point[0] + location_type < NUMBER >(m_dimension.x, 0, 0).rotate(m_direction);
189 point[2] = point[0] + location_type < NUMBER >(m_dimension.x, m_dimension.y, 0).rotate(m_direction);
190 point[3] = point[0] + location_type < NUMBER >(0, m_dimension.y, 0).rotate(m_direction);
192 point[4] = m_origin + location_type < NUMBER >(0, 0, m_dimension.z).rotate(m_direction);
193 point[5] = point[4] + location_type < NUMBER >(m_dimension.x, 0, 0).rotate(m_direction);
194 point[6] = point[4] + location_type < NUMBER >(m_dimension.x, m_dimension.y, 0).rotate(m_direction);
195 point[7] = point[4] + location_type < NUMBER >(0, m_dimension.y, 0).rotate(m_direction);
203 location_type < NUMBER > get_nearest_vertice(location_type < NUMBER > point)
206 array < location_type < NUMBER > > verts = vertexes();
208 ::f64 dMin = sqrt(::sqr(point.x - verts[0].x) + sqr(point.y - verts[0].y) + sqr(point.z - verts[0].z));
212 ::collection::index iFound = 0;
214 for (::collection::index i = 1; i < verts.get_count(); i++)
216 d = sqrt(::sqr(point.x - verts[i].x) + sqr(point.y - verts[i].y) + sqr(point.z - verts[i].z));
226 return verts[iFound];
230 ::collection::index find_nearest_vertice(location_type < NUMBER > point)
233 array < location_type < NUMBER > > verts = vertexes();
235 ::f64 dMin = sqrt(::sqr(point.x - verts[0].x) + sqr(point.y - verts[0].y) + sqr(point.z - verts[0].z));
239 ::collection::index iFound = 0;
241 for (::collection::index i = 1; i < verts.get_count(); i++)
243 d = sqrt(::sqr(point.x - verts[i].x) + sqr(point.y - verts[i].y) + sqr(point.z - verts[i].z));
258 ::collection::index find_nearest_vertice(::i32 x, ::i32 y)
261 array < location_type < NUMBER > > verts = vertexes();
263 ::f64 dMin = sqrt(::sqr(x - verts[0].x) + sqr(y - verts[0].y));
267 ::collection::index iFound = 0;
269 for (::collection::index i = 1; i < verts.get_count(); i++)
271 d = sqrt(::sqr(x - verts[i].x) + sqr(y - verts[i].y));
289 box_type & operator -= (
const location_type < NUMBER >& point)
299 box_type& operator += (
const location_type < NUMBER >& point)