54 #define OPENMESH_DECIMATER_MODQUADRIC_CC 70 template<
class DecimaterType>
77 if (!quadrics_.is_valid())
78 Base::mesh().add_property( quadrics_ );
81 typename Mesh::VertexIter v_it = Base::mesh().vertices_begin(),
82 v_end = Base::mesh().vertices_end();
84 for (; v_it != v_end; ++v_it)
85 Base::mesh().property(quadrics_, *v_it).
clear();
88 typename Mesh::FaceIter f_it = Base::mesh().faces_begin(),
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;
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;
void vector_cast(const src_t &_src, dst_t &_dst, GenProg::Int2Type< n >)
Cast vector type to another vector type by copying the vector elements.
Kernel::FaceVertexIter FaceVertexIter
Circulator.
void set_error_tolerance_factor(double _factor)
set the percentage of maximum quadric error
virtual void initialize(void)
Initalize the module and prepare the mesh for decimation.
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
void clear()
set all entries to zero