in calc_normal for EdgeHandle average incident face normals instead of incident vertex normals
This commit is contained in:
@@ -456,13 +456,7 @@ public:
|
||||
}
|
||||
|
||||
/// calculated and returns the average of the two vertex normals
|
||||
Normal calc_normal(EdgeHandle _eh) const
|
||||
{
|
||||
HalfedgeHandle _heh = this->halfedge_handle(_eh, 0);
|
||||
VertexHandle vh0 = this->from_vertex_handle(_heh);
|
||||
VertexHandle vh1 = this->to_vertex_handle(_heh);
|
||||
return 0.5 * (this->calc_normal(vh0) + this->calc_normal(vh1));
|
||||
}
|
||||
Normal calc_normal(EdgeHandle _eh) const;
|
||||
|
||||
/** defines a consistent representation of a sector geometry:
|
||||
the halfedge _in_heh defines the sector orientation
|
||||
|
||||
@@ -424,6 +424,28 @@ calc_normal(HalfedgeHandle _heh, const double _feature_angle) const
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
template <class Kernel>
|
||||
typename PolyMeshT<Kernel>::Normal
|
||||
PolyMeshT<Kernel>::
|
||||
calc_normal(EdgeHandle _eh) const
|
||||
{
|
||||
Normal n(0);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
const auto heh = this->halfedge_handle(_eh, i);
|
||||
const auto fh = this->face_handle(heh);
|
||||
if (fh.is_valid())
|
||||
n += calc_normal(fh);
|
||||
}
|
||||
const auto length = norm(n);
|
||||
if (length != 0)
|
||||
n /= length;
|
||||
return n;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
template <class Kernel>
|
||||
bool
|
||||
PolyMeshT<Kernel>::
|
||||
|
||||
Reference in New Issue
Block a user