54 #define OPENMESH_DECIMATER_MODQUADRIC_CC
70 template<
class DecimaterType>
77 if (!quadrics_.is_valid())
78 Base::mesh().add_property( quadrics_ );
82 v_end = Base::mesh().vertices_end();
84 for (; v_it != v_end; ++v_it)
85 Base::mesh().property(quadrics_, *v_it).
clear();
89 f_end = Base::mesh().faces_end();
95 for (; f_it != f_end; ++f_it)
97 fv_it = Base::mesh().fv_iter(*f_it);
98 vh0 = *fv_it; ++fv_it;
99 vh1 = *fv_it; ++fv_it;
106 v0 = vector_cast<Vec3>(Base::mesh().point(vh0));
107 v1 = vector_cast<Vec3>(Base::mesh().point(vh1));
108 v2 = vector_cast<Vec3>(Base::mesh().point(vh2));
111 Vec3 n = (v1-v0) % (v2-v0);
112 double area = n.norm();
119 const double a = n[0];
120 const double b = n[1];
121 const double c = n[2];
122 const double d = -(vector_cast<Vec3>(Base::mesh().point(vh0))|n);
124 Quadricd q(a, b, c, d);
127 Base::mesh().property(quadrics_, vh0) += q;
128 Base::mesh().property(quadrics_, vh1) += q;
129 Base::mesh().property(quadrics_, vh2) += q;
135 template<
class MeshT>
137 if (this->is_binary()) {
138 if (_factor >= 0.0 && _factor <= 1.0) {
142 double max_err = max_err_ * _factor / this->error_tolerance_factor_;
143 set_max_err(max_err);
144 this->error_tolerance_factor_ = _factor;
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
/class QuadricT Geometry/QuadricT.hh
Definition: QuadricT.hh:83
void clear()
set all entries to zero
Definition: QuadricT.hh:166
Definition: Vector11T.hh:83
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:136
Kernel::FaceIter FaceIter
Scalar type.
Definition: PolyMeshT.hh:146
Kernel::FaceVertexIter FaceVertexIter
Circulator.
Definition: PolyMeshT.hh:167
Kernel::VertexIter VertexIter
Scalar type.
Definition: PolyMeshT.hh:143
void set_error_tolerance_factor(double _factor) override
set the percentage of maximum quadric error
Definition: ModQuadricT_impl.hh:136
virtual void initialize(void) override
Initalize the module and prepare the mesh for decimation.
Definition: ModQuadricT_impl.hh:73