Commit a1a82331 authored by Max Lyon's avatar Max Lyon

add calc_centroid methods for all elements returning calc_face_centroid,...

add calc_centroid methods for all elements returning calc_face_centroid, calc_edge_midpoint and point respectively
parent d322acfb
......@@ -276,9 +276,24 @@ public:
_pt = calc_face_centroid(_fh);
}
/// Computes and returns the average of the vertices defining _gh
/// Computes and returns the average of the vertices defining _fh
Point calc_face_centroid(FaceHandle _fh) const;
/// Computes and returns the average of the vertices defining _fh (same as calc_face_centroid)
Point calc_centroid(FaceHandle _fh) const;
/// Computes and returns the average of the vertices defining _eh (same as calc_edge_midpoint)
Point calc_centroid(EdgeHandle _eh) const;
/// Computes and returns the average of the vertices defining _heh (same as calc_edge_midpoint for edge of halfedge)
Point calc_centroid(HalfedgeHandle _heh) const;
/// Returns the point of _vh
Point calc_centroid(VertexHandle _vh) const;
/// Computes and returns the average of the vertices defining the mesh
Point calc_centroid(MeshHandle _mh) const;
/// Update normal for halfedge _heh
void update_normal(HalfedgeHandle _heh, const double _feature_angle = 0.8)
{ this->set_normal(_heh, calc_halfedge_normal(_heh,_feature_angle)); }
......
......@@ -250,8 +250,58 @@ calc_face_centroid(FaceHandle _fh) const
_pt /= valence;
return _pt;
}
//-----------------------------------------------------------------------------
template<class Kernel>
typename PolyMeshT<Kernel>::Point
PolyMeshT<Kernel>::
calc_centroid(FaceHandle _fh) const
{
return calc_face_centroid(_fh);
}
//-----------------------------------------------------------------------------
template<class Kernel>
typename PolyMeshT<Kernel>::Point
PolyMeshT<Kernel>::
calc_centroid(EdgeHandle _eh) const
{
return this->calc_edge_midpoint(_eh);
}
//-----------------------------------------------------------------------------
template<class Kernel>
typename PolyMeshT<Kernel>::Point
PolyMeshT<Kernel>::
calc_centroid(HalfedgeHandle _heh) const
{
return this->calc_edge_midpoint(this->edge_handle(_heh));
}
//-----------------------------------------------------------------------------
template<class Kernel>
typename PolyMeshT<Kernel>::Point
PolyMeshT<Kernel>::
calc_centroid(VertexHandle _vh) const
{
return this->point(_vh);
}
//-----------------------------------------------------------------------------
template<class Kernel>
typename PolyMeshT<Kernel>::Point
PolyMeshT<Kernel>::
calc_centroid(MeshHandle /*_mh*/) const
{
return this->vertices().avg(getPointsProperty(*this));
}
//-----------------------------------------------------------------------------
template <class Kernel>
void
......
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