Commit 52d3ad93 authored by Max Lyon's avatar Max Lyon

templatize NormalConeT over Vector instead of Scalar to allow for other types of vectors (eg Eigen)

parent 9c9ea158
......@@ -60,6 +60,7 @@
#include <OpenMesh/Core/Geometry/VectorT.hh>
#include <OpenMesh/Core/Utils/vector_traits.hh>
//== NAMESPACES ===============================================================
......@@ -77,13 +78,14 @@ namespace OpenMesh {
the center normal and the opening angle.
**/
template <typename Scalar>
template <typename Vector>
class NormalConeT
{
public:
// typedefs
typedef VectorT<Scalar, 3> Vec3;
typedef typename vector_traits<Vector>::value_type Scalar;
typedef Vector Vec3;
//! default constructor (not initialized)
......
......@@ -70,8 +70,8 @@ namespace OpenMesh {
//== IMPLEMENTATION ==========================================================
template <typename Scalar>
NormalConeT<Scalar>::
template <typename Vector>
NormalConeT<Vector>::
NormalConeT(const Vec3& _center_normal, Scalar _angle)
: center_normal_(_center_normal), angle_(_angle)
{
......@@ -81,9 +81,9 @@ NormalConeT(const Vec3& _center_normal, Scalar _angle)
//----------------------------------------------------------------------------
template <typename Scalar>
Scalar
NormalConeT<Scalar>::
template <typename Vector>
typename NormalConeT<Vector>::Scalar
NormalConeT<Vector>::
max_angle(const Vec3& _norm) const
{
Scalar dotp = (center_normal_ | _norm);
......@@ -95,9 +95,9 @@ max_angle(const Vec3& _norm) const
//----------------------------------------------------------------------------
template <typename Scalar>
Scalar
NormalConeT<Scalar>::
template <typename Vector>
typename NormalConeT<Vector>::Scalar
NormalConeT<Vector>::
max_angle(const NormalConeT& _cone) const
{
Scalar dotp = (center_normal_ | _cone.center_normal_);
......@@ -112,12 +112,12 @@ max_angle(const NormalConeT& _cone) const
//----------------------------------------------------------------------------
template <typename Scalar>
template <typename Vector>
void
NormalConeT<Scalar>::
NormalConeT<Vector>::
merge(const NormalConeT& _cone)
{
Scalar dotp = (center_normal_ | _cone.center_normal_);
Scalar dotp = dot(center_normal_, _cone.center_normal_);
if (fabs(dotp) < 0.99999f)
{
......
......@@ -97,7 +97,7 @@ public:
typedef typename Mesh::VertexHandle VertexHandle;
typedef typename Mesh::FaceHandle FaceHandle;
typedef typename Mesh::EdgeHandle EdgeHandle;
typedef NormalConeT<Scalar> NormalCone;
typedef NormalConeT<Normal> NormalCone;
......
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