fall back to dummy implementation for calc_face_normal on meshes with non-3D points
This commit is contained in:
@@ -61,6 +61,7 @@
|
|||||||
|
|
||||||
#include <OpenMesh/Core/Mesh/PolyMeshT.hh>
|
#include <OpenMesh/Core/Mesh/PolyMeshT.hh>
|
||||||
#include <OpenMesh/Core/Geometry/LoopSchemeMaskT.hh>
|
#include <OpenMesh/Core/Geometry/LoopSchemeMaskT.hh>
|
||||||
|
#include <OpenMesh/Core/Utils/GenProg.hh>
|
||||||
#include <OpenMesh/Core/Utils/vector_cast.hh>
|
#include <OpenMesh/Core/Utils/vector_cast.hh>
|
||||||
#include <OpenMesh/Core/System/omstream.hh>
|
#include <OpenMesh/Core/System/omstream.hh>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -97,8 +98,18 @@ uint PolyMeshT<Kernel>::find_feature_edges(Scalar _angle_tresh)
|
|||||||
|
|
||||||
template <class Kernel>
|
template <class Kernel>
|
||||||
typename PolyMeshT<Kernel>::Normal
|
typename PolyMeshT<Kernel>::Normal
|
||||||
PolyMeshT<Kernel>::
|
PolyMeshT<Kernel>::calc_face_normal(FaceHandle _fh) const
|
||||||
calc_face_normal(FaceHandle _fh) const
|
{
|
||||||
|
return calc_face_normal_impl(_fh, typename GenProg::IF<
|
||||||
|
PolyMeshT<Kernel>::Point::size() == 3,
|
||||||
|
PointIs3DTag,
|
||||||
|
PointIsNot3DTag
|
||||||
|
>::Result());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Kernel>
|
||||||
|
typename PolyMeshT<Kernel>::Normal
|
||||||
|
PolyMeshT<Kernel>::calc_face_normal_impl(FaceHandle _fh, PointIs3DTag) const
|
||||||
{
|
{
|
||||||
assert(this->halfedge_handle(_fh).is_valid());
|
assert(this->halfedge_handle(_fh).is_valid());
|
||||||
ConstFaceVertexIter fv_it(this->cfv_iter(_fh));
|
ConstFaceVertexIter fv_it(this->cfv_iter(_fh));
|
||||||
@@ -139,8 +150,15 @@ calc_face_normal(FaceHandle _fh) const
|
|||||||
: Normal(0, 0, 0);
|
: Normal(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
template <class Kernel>
|
||||||
|
typename PolyMeshT<Kernel>::Normal
|
||||||
|
PolyMeshT<Kernel>::calc_face_normal_impl(FaceHandle, PointIsNot3DTag) const
|
||||||
|
{
|
||||||
|
// Dummy fallback implementation
|
||||||
|
return Normal(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
template <class Kernel>
|
template <class Kernel>
|
||||||
typename PolyMeshT<Kernel>::Normal
|
typename PolyMeshT<Kernel>::Normal
|
||||||
@@ -148,6 +166,21 @@ PolyMeshT<Kernel>::
|
|||||||
calc_face_normal(const Point& _p0,
|
calc_face_normal(const Point& _p0,
|
||||||
const Point& _p1,
|
const Point& _p1,
|
||||||
const Point& _p2) const
|
const Point& _p2) const
|
||||||
|
{
|
||||||
|
return calc_face_normal_impl(_p0, _p1, _p2, typename GenProg::IF<
|
||||||
|
PolyMeshT<Kernel>::Point::size() == 3,
|
||||||
|
PointIs3DTag,
|
||||||
|
PointIsNot3DTag
|
||||||
|
>::Result());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Kernel>
|
||||||
|
typename PolyMeshT<Kernel>::Normal
|
||||||
|
PolyMeshT<Kernel>::
|
||||||
|
calc_face_normal_impl(const Point& _p0,
|
||||||
|
const Point& _p1,
|
||||||
|
const Point& _p2,
|
||||||
|
PointIs3DTag) const
|
||||||
{
|
{
|
||||||
#if 1
|
#if 1
|
||||||
// The OpenSG <Vector>::operator -= () does not support the type Point
|
// The OpenSG <Vector>::operator -= () does not support the type Point
|
||||||
@@ -174,6 +207,14 @@ calc_face_normal(const Point& _p0,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class Kernel>
|
||||||
|
typename PolyMeshT<Kernel>::Normal
|
||||||
|
PolyMeshT<Kernel>::
|
||||||
|
calc_face_normal_impl(const Point&, const Point&, const Point&, PointIsNot3DTag) const
|
||||||
|
{
|
||||||
|
return Normal(0);
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
template <class Kernel>
|
template <class Kernel>
|
||||||
|
|||||||
@@ -520,6 +520,13 @@ public:
|
|||||||
inline void split(EdgeHandle _eh, VertexHandle _vh)
|
inline void split(EdgeHandle _eh, VertexHandle _vh)
|
||||||
{ Kernel::split_edge(_eh, _vh); }
|
{ Kernel::split_edge(_eh, _vh); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct PointIs3DTag {};
|
||||||
|
struct PointIsNot3DTag {};
|
||||||
|
Normal calc_face_normal_impl(FaceHandle, PointIs3DTag) const;
|
||||||
|
Normal calc_face_normal_impl(FaceHandle, PointIsNot3DTag) const;
|
||||||
|
Normal calc_face_normal_impl(const Point&, const Point&, const Point&, PointIs3DTag) const;
|
||||||
|
Normal calc_face_normal_impl(const Point&, const Point&, const Point&, PointIsNot3DTag) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user