35 #define NORMALATTRIBT_CC 39 #include "NormalAttrib.hh" 41 #include "../Core/GeometryKernel.hh" 45 template <
class GeomKernelT>
46 NormalAttrib<GeomKernelT>::NormalAttrib(GeomKernelT& _kernel) :
48 v_normals_(_kernel.template request_vertex_property<typename GeomKernelT::PointT>(
"vertex_normals", typename GeomKernelT::PointT(0.0))),
49 f_normals_(_kernel.template request_face_property<typename GeomKernelT::PointT>(
"face_normals", typename GeomKernelT::PointT(0.0)))
54 template <
class GeomKernelT>
55 NormalAttrib<GeomKernelT>::~NormalAttrib() {
59 template <
class GeomKernelT>
62 if(!kernel_.has_face_bottom_up_incidences()) {
63 std::cerr <<
"Error: update_vertex_normals() needs bottom-up incidences!" << std::endl;
70 for(
const auto &_vh: kernel_.vertices())
72 compute_vertex_normal(_vh);
76 template <
class GeomKernelT>
79 if(!kernel_.has_face_bottom_up_incidences()) {
80 std::cerr <<
"Error: update_normals() needs bottom-up incidences!" << std::endl;
84 for (
const auto &_fh: kernel_.faces()) {
85 f_normals_[_fh] = kernel_.normal(kernel_.halfface_handle(_fh, 0));
89 template <
class GeomKernelT>
92 std::set<HalfFaceHandle> halffaces;
94 voh_it.valid(); ++voh_it) {
97 hehf_it.valid(); ++hehf_it) {
98 if(kernel_.is_boundary(*hehf_it)) {
99 halffaces.insert(*hehf_it);
103 typename GeomKernelT::PointT normal =
typename GeomKernelT::PointT(0.0);
104 for(std::set<HalfFaceHandle>::const_iterator hf_it = halffaces.begin();
105 hf_it != halffaces.end(); ++hf_it) {
106 normal += (*this)[*hf_it];
void update_vertex_normals()
A simple heuristic to estimate the vertex normals.
void update_face_normals()
Compute face normals.