38 #ifndef COAL_BV_FITTER_H
39 #define COAL_BV_FITTER_H
50 template <
typename BV>
52 for (
unsigned int i = 0; i < n; ++i)
75 template <
typename BV>
85 tri_indices = tri_indices_;
94 prev_vertices = prev_vertices_;
95 tri_indices = tri_indices_;
100 virtual BV
fit(
unsigned int* primitive_indices,
101 unsigned int num_primitives) = 0;
106 prev_vertices = NULL;
120 template <
typename BV>
128 BV
fit(
unsigned int* primitive_indices,
unsigned int num_primitives) {
133 for (
unsigned int i = 0; i < num_primitives; ++i) {
134 Triangle t = tri_indices[primitive_indices[i]];
135 bv += vertices[t[0]];
136 bv += vertices[t[1]];
137 bv += vertices[t[2]];
141 bv += prev_vertices[t[0]];
142 bv += prev_vertices[t[1]];
143 bv += prev_vertices[t[2]];
148 for (
unsigned int i = 0; i < num_primitives; ++i) {
149 bv += vertices[primitive_indices[i]];
153 bv += prev_vertices[primitive_indices[i]];
162 using Base::prev_vertices;
163 using Base::tri_indices;
165 using Base::vertices;
175 OBB fit(
unsigned int* primitive_indices,
unsigned int num_primitives);
185 RSS fit(
unsigned int* primitive_indices,
unsigned int num_primitives);
195 kIOS fit(
unsigned int* primitive_indices,
unsigned int num_primitives);
205 OBBRSS fit(
unsigned int* primitive_indices,
unsigned int num_primitives);
215 AABB fit(
unsigned int* primitive_indices,
unsigned int num_primitives);
A class describing the AABB collision structure, which is a box in 3D space determined by two diagona...
Definition: AABB.h:55
The class for the default algorithm fitting a bounding volume to a set of points.
Definition: BV_fitter.h:76
BVHModelType type
Definition: BV_fitter.h:115
Vec3s * prev_vertices
Definition: BV_fitter.h:113
Triangle * tri_indices
Definition: BV_fitter.h:114
void clear()
Clear the geometry primitive data.
Definition: BV_fitter.h:104
void set(Vec3s *vertices_, Triangle *tri_indices_, BVHModelType type_)
Prepare the geometry primitive data for fitting.
Definition: BV_fitter.h:82
virtual BV fit(unsigned int *primitive_indices, unsigned int num_primitives)=0
Compute the fitting BV.
void set(Vec3s *vertices_, Vec3s *prev_vertices_, Triangle *tri_indices_, BVHModelType type_)
Prepare the geometry primitive data for fitting, for deformable mesh.
Definition: BV_fitter.h:91
Vec3s * vertices
Definition: BV_fitter.h:112
virtual ~BVFitterTpl()
default deconstructor
Definition: BV_fitter.h:79
AABB fit(unsigned int *primitive_indices, unsigned int num_primitives)
Compute a bounding volume that fits a set of primitives (points or triangles). The primitive data was...
OBB fit(unsigned int *primitive_indices, unsigned int num_primitives)
Compute a bounding volume that fits a set of primitives (points or triangles). The primitive data was...
kIOS fit(unsigned int *primitive_indices, unsigned int num_primitives)
Compute a bounding volume that fits a set of primitives (points or triangles). The primitive data was...
The class for the default algorithm fitting a bounding volume to a set of points.
Definition: BV_fitter.h:121
BV fit(unsigned int *primitive_indices, unsigned int num_primitives)
Compute a bounding volume that fits a set of primitives (points or triangles). The primitive data was...
Definition: BV_fitter.h:128
Triangle with 3 indices for points.
Definition: data_types.h:121
A class describing the kIOS collision structure, which is a set of spheres.
Definition: kIOS.h:52
#define COAL_DLLAPI
Definition: config.hh:88
Main namespace.
Definition: broadphase_bruteforce.h:44
BVHModelType
BVH model type.
Definition: BVH_internal.h:79
@ BVH_MODEL_POINTCLOUD
triangle model
Definition: BVH_internal.h:82
@ BVH_MODEL_TRIANGLES
unknown model type
Definition: BVH_internal.h:81
@ BVH_MODEL_UNKNOWN
Definition: BVH_internal.h:80
void fit< OBB >(Vec3s *ps, unsigned int n, OBB &bv)
void fit< kIOS >(Vec3s *ps, unsigned int n, kIOS &bv)
void fit< RSS >(Vec3s *ps, unsigned int n, RSS &bv)
void fit(Vec3s *ps, unsigned int n, BV &bv)
Compute a bounding volume that fits a set of n points.
Definition: BV_fitter.h:51
Eigen::Matrix< Scalar, 3, 1 > Vec3s
Definition: data_types.h:70
void fit< AABB >(Vec3s *ps, unsigned int n, AABB &bv)
void fit< OBBRSS >(Vec3s *ps, unsigned int n, OBBRSS &bv)
Oriented bounding box class.
Definition: OBB.h:51