Commit a96ca67b authored by Jan Möbius's avatar Jan Möbius
Browse files

Improved block for update_normals if properties don't exist. Documentation for...

Improved block for update_normals if properties don't exist. Documentation for update normals improved

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@575 fdac6126-5c0c-442c-9429-916003d36597
parent dd0cd46e
...@@ -184,9 +184,13 @@ void ...@@ -184,9 +184,13 @@ void
PolyMeshT<Kernel>:: PolyMeshT<Kernel>::
update_normals() update_normals()
{ {
if (Kernel::has_face_normals()) update_face_normals(); // Face normals are required to compute the vertex and the halfedge normals
if (Kernel::has_vertex_normals()) update_vertex_normals(); if (Kernel::has_face_normals() ) {
if (Kernel::has_halfedge_normals()) update_halfedge_normals(); update_face_normals();
if (Kernel::has_vertex_normals() ) update_vertex_normals();
if (Kernel::has_halfedge_normals()) update_halfedge_normals();
}
} }
......
...@@ -205,16 +205,24 @@ public: ...@@ -205,16 +205,24 @@ public:
*/ */
//@{ //@{
/** Calls update_face_normals() and update_vertex_normals() if /** \brief Compute normals for all primitives
these normals (i.e. the properties) exist */ *
* Calls update_face_normals() , update_halfedge_normals() and update_vertex_normals() if
* the normals (i.e. the properties) exist.
*
* \note Face normals are required to compute vertex and halfedge normals!
*/
void update_normals(); void update_normals();
/// Update normal for face _fh /// Update normal for face _fh
void update_normal(FaceHandle _fh) void update_normal(FaceHandle _fh)
{ this->set_normal(_fh, calc_face_normal(_fh)); } { this->set_normal(_fh, calc_face_normal(_fh)); }
/** Update normal vectors for all faces. /** \brief Update normal vectors for all faces.
\attention Needs the Attributes::Normal attribute for faces. */ *
* \attention Needs the Attributes::Normal attribute for faces.
* Call request_face_normals() before using it!
*/
void update_face_normals(); void update_face_normals();
/** Calculate normal vector for face _fh. */ /** Calculate normal vector for face _fh. */
...@@ -223,20 +231,36 @@ public: ...@@ -223,20 +231,36 @@ public:
/** Calculate normal vector for face (_p0, _p1, _p2). */ /** Calculate normal vector for face (_p0, _p1, _p2). */
Normal calc_face_normal(const Point& _p0, const Point& _p1, Normal calc_face_normal(const Point& _p0, const Point& _p1,
const Point& _p2) const; const Point& _p2) const;
// calculates the average of the vertices defining _fh /// calculates the average of the vertices defining _fh
void calc_face_centroid(FaceHandle _fh, Point& _pt) const; void calc_face_centroid(FaceHandle _fh, Point& _pt) const;
/// Update normal for halfedge _heh /// Update normal for halfedge _heh
void update_normal(HalfedgeHandle _heh, const double _feature_angle = 0.8) void update_normal(HalfedgeHandle _heh, const double _feature_angle = 0.8)
{ this->set_normal(_heh, calc_halfedge_normal(_heh)); } { this->set_normal(_heh, calc_halfedge_normal(_heh)); }
/** Update normal vectors for all halfedges. /** \brief Update normal vectors for all halfedges.
\attention Needs the Attributes::Normal attribute for faces. */ *
* Uses the existing face normals to compute halfedge normals
*
* \note Face normals have to be computed first!
*
* \attention Needs the Attributes::Normal attribute for faces and halfedges.
* Call request_face_normals() and request_halfedge_normals() before using it!
*/
void update_halfedge_normals(const double _feature_angle = 0.8); void update_halfedge_normals(const double _feature_angle = 0.8);
/** Calculate normal vector for halfedge _heh. */ /** \brief Calculate halfedge normal for one specific halfedge
/** requires valid face normals!!! */ *
virtual Normal calc_halfedge_normal(HalfedgeHandle _fh, const double _feature_angle = 0.8) const; * Calculate normal vector for halfedge _heh.
*
* \note Face normals have to be computed first!
*
* \attention Needs the Attributes::Normal attribute for faces and vertices.
* Call request_face_normals() and request_halfedge_normals() before using it!
*
* @param _heh Handle of the halfedge
*/
virtual Normal calc_halfedge_normal(HalfedgeHandle _heh, const double _feature_angle = 0.8) const;
/** identifies feature edges w.r.t. the minimal dihedral angle for feautre edges (in radians) */ /** identifies feature edges w.r.t. the minimal dihedral angle for feautre edges (in radians) */
...@@ -247,15 +271,29 @@ public: ...@@ -247,15 +271,29 @@ public:
void update_normal(VertexHandle _vh) void update_normal(VertexHandle _vh)
{ this->set_normal(_vh, calc_vertex_normal(_vh)); } { this->set_normal(_vh, calc_vertex_normal(_vh)); }
/** \brief Update normal vectors for all vertices. /** \brief Update normal vectors for all vertices.
*
Uses existing face normals to calculate new vertex normals. * Uses existing face normals to calculate new vertex normals.
\attention Needs the Attributes::Normal attribute for faces and vertices. */ *
* \note Face normals have to be computed first!
*
* \attention Needs the Attributes::Normal attribute for faces and vertices.
* Call request_face_normals() and request_vertex_normals() before using it!
*/
void update_vertex_normals(); void update_vertex_normals();
/** Calculate normal vector for vertex _vh by averaging normals /** \brief Calculate vertex normal for one specific vertex
of adjacent faces. Face normals have to be computed first. *
\attention Needs the Attributes::Normal attribute for faces. */ * Calculate normal vector for vertex _vh by averaging normals
* of adjacent faces.
*
* \note Face normals have to be computed first!
*
* \attention Needs the Attributes::Normal attribute for faces and vertices.
* Call request_face_normals() and request_vertex_normals() before using it!
*
* @param _vh Handle of the vertex
*/
Normal calc_vertex_normal(VertexHandle _vh) const; Normal calc_vertex_normal(VertexHandle _vh) const;
/** Different methods for calculation of the normal at _vh: /** Different methods for calculation of the normal at _vh:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment