38 #ifndef FCL_BV_FITTER_INL_H
39 #define FCL_BV_FITTER_INL_H
50 template <
typename BV>
57 template <
typename S,
typename BV>
61 template <
typename BV>
71 template <
typename BV>
79 *
this, vertices_, prev_vertices_, tri_indices_, type_);
83 template <
typename S,
typename BV>
87 template <
typename BV>
91 *
this, primitive_indices, num_primitives);
95 template <
typename BV>
99 prev_vertices =
nullptr;
100 tri_indices =
nullptr;
105 template <
typename S,
typename BV>
135 template <
typename S>
144 fitter.vertices = vertices_;
145 fitter.prev_vertices =
nullptr;
146 fitter.tri_indices = tri_indices_;
157 fitter.vertices = vertices_;
158 fitter.prev_vertices = prev_vertices_;
159 fitter.tri_indices = tri_indices_;
165 template <
typename S>
174 fitter.vertices = vertices_;
175 fitter.prev_vertices =
nullptr;
176 fitter.tri_indices = tri_indices_;
187 fitter.vertices = vertices_;
188 fitter.prev_vertices = prev_vertices_;
189 fitter.tri_indices = tri_indices_;
195 template <
typename S>
204 fitter.vertices = vertices_;
205 fitter.prev_vertices =
nullptr;
206 fitter.tri_indices = tri_indices_;
217 fitter.vertices = vertices_;
218 fitter.prev_vertices = prev_vertices_;
219 fitter.tri_indices = tri_indices_;
225 template <
typename S>
234 fitter.vertices = vertices_;
235 fitter.prev_vertices =
nullptr;
236 fitter.tri_indices = tri_indices_;
247 fitter.vertices = vertices_;
248 fitter.prev_vertices = prev_vertices_;
249 fitter.tri_indices = tri_indices_;
255 template <
typename S,
typename BV>
260 unsigned int* primitive_indices,
267 for(
int i = 0; i < num_primitives; ++i)
284 for(
int i = 0; i < num_primitives; ++i)
286 bv += fitter.
vertices[primitive_indices[i]];
300 template <
typename S>
305 unsigned int* primitive_indices,
314 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
315 primitive_indices, num_primitives, M);
321 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
322 primitive_indices, num_primitives,
330 template <
typename S>
335 unsigned int* primitive_indices,
344 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
345 primitive_indices, num_primitives, M);
351 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
352 primitive_indices, num_primitives, bv.
axis, bv.
To, bv.
l, bv.
r);
359 template <
typename S>
364 unsigned int* primitive_indices,
373 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
374 primitive_indices, num_primitives, M);
380 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
386 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
387 primitive_indices, num_primitives, center);
404 bv.
spheres[1].o = center - delta;
405 bv.
spheres[2].o = center + delta;
408 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
409 primitive_indices, num_primitives, bv.
spheres[1].o);
411 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
412 primitive_indices, num_primitives, bv.
spheres[2].o);
424 Vector3<S> delta = bv.
obb.
axis.col(1) * (sqrt(r10 * r10 - extent[0] * extent[0] - extent[2] * extent[2]) - extent[1]);
430 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
431 primitive_indices, num_primitives, bv.
spheres[3].o);
433 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
434 primitive_indices, num_primitives, bv.
spheres[4].o);
448 template <
typename S>
453 unsigned int* primitive_indices,
461 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
462 primitive_indices, num_primitives, M);
468 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
472 fitter.vertices, fitter.prev_vertices, fitter.tri_indices,
473 primitive_indices, num_primitives,