55 #ifndef OPENMESH_DECIMATER_MODNORMALFLIPPING_HH 56 #define OPENMESH_DECIMATER_MODNORMALFLIPPING_HH 79 template <
typename MeshT>
92 const bool mesh_has_normals = _mesh.has_face_normals();
93 _mesh.request_face_normals();
95 if (!mesh_has_normals)
97 omerr() <<
"Mesh has no face normals. Compute them automatically." << std::endl;
98 _mesh.update_face_normals();
105 Base::mesh().release_face_normals();
128 Base::mesh().set_point(_ci.
v0, _ci.
p1);
132 typename Mesh::FaceHandle fh;
135 for (; vf_it.is_valid(); ++vf_it)
138 if (fh != _ci.
fl && fh != _ci.
fr)
141 typename Mesh::Normal n2 = Base::mesh().calc_face_normal(fh);
151 Base::mesh().set_point(_ci.
v0, _ci.
p0);
153 return float( (c < min_cos_) ? Base::ILLEGAL_COLLAPSE : Base::LEGAL_COLLAPSE );
158 if (_factor >= 0.0 && _factor <= 1.0) {
162 double max_normal_deviation_value = (max_deviation_ * 180.0/M_PI) * _factor / this->error_tolerance_factor_;
164 this->error_tolerance_factor_ = _factor;
180 max_deviation_ = _d / 180.0 * M_PI;
181 min_cos_ = cos(max_deviation_);
187 void set_binary(
bool _b) {}
192 double max_deviation_, min_cos_;
200 #endif // OPENMESH_DECIMATER_MODNORMALFLIPPING_HH defined Mesh::Point p1
Positions of remaining vertex.
ModNormalFlippingT(MeshT &_mesh)
Constructor.
Kernel::ConstVertexFaceIter ConstVertexFaceIter
Circulator.
Mesh::FaceHandle fl
Left face.
Mesh::FaceHandle fr
Right face.
Kernel::Normal Normal
Normal type.
void set_error_tolerance_factor(double _factor) override
set the percentage of maximum normal deviation
double max_normal_deviation() const
get normal deviation
void set_max_normal_deviation(double _d)
float collapse_priority(const CollapseInfo &_ci) override
Kernel::Scalar Scalar
Scalar type.
Mesh::VertexHandle v0
Vertex to be removed.
osg::Vec3f::ValueType dot(const osg::Vec3f &_v1, const osg::Vec3f &_v2)
Adapter for osg vector member computing a scalar product.
Mesh::Point p0
Position of removed vertex.