templatize NormalConeT over Vector instead of Scalar to allow for other types of vectors (eg Eigen)
This commit is contained in:
@@ -60,6 +60,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <OpenMesh/Core/Geometry/VectorT.hh>
|
#include <OpenMesh/Core/Geometry/VectorT.hh>
|
||||||
|
#include <OpenMesh/Core/Utils/vector_traits.hh>
|
||||||
|
|
||||||
|
|
||||||
//== NAMESPACES ===============================================================
|
//== NAMESPACES ===============================================================
|
||||||
@@ -77,13 +78,14 @@ namespace OpenMesh {
|
|||||||
the center normal and the opening angle.
|
the center normal and the opening angle.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
template <typename Scalar>
|
template <typename Vector>
|
||||||
class NormalConeT
|
class NormalConeT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// typedefs
|
// typedefs
|
||||||
typedef VectorT<Scalar, 3> Vec3;
|
typedef typename vector_traits<Vector>::value_type Scalar;
|
||||||
|
typedef Vector Vec3;
|
||||||
|
|
||||||
|
|
||||||
//! default constructor (not initialized)
|
//! default constructor (not initialized)
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ namespace OpenMesh {
|
|||||||
|
|
||||||
//== IMPLEMENTATION ==========================================================
|
//== IMPLEMENTATION ==========================================================
|
||||||
|
|
||||||
template <typename Scalar>
|
template <typename Vector>
|
||||||
NormalConeT<Scalar>::
|
NormalConeT<Vector>::
|
||||||
NormalConeT(const Vec3& _center_normal, Scalar _angle)
|
NormalConeT(const Vec3& _center_normal, Scalar _angle)
|
||||||
: center_normal_(_center_normal), angle_(_angle)
|
: center_normal_(_center_normal), angle_(_angle)
|
||||||
{
|
{
|
||||||
@@ -81,9 +81,9 @@ NormalConeT(const Vec3& _center_normal, Scalar _angle)
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
template <typename Scalar>
|
template <typename Vector>
|
||||||
Scalar
|
typename NormalConeT<Vector>::Scalar
|
||||||
NormalConeT<Scalar>::
|
NormalConeT<Vector>::
|
||||||
max_angle(const Vec3& _norm) const
|
max_angle(const Vec3& _norm) const
|
||||||
{
|
{
|
||||||
Scalar dotp = (center_normal_ | _norm);
|
Scalar dotp = (center_normal_ | _norm);
|
||||||
@@ -95,9 +95,9 @@ max_angle(const Vec3& _norm) const
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
template <typename Scalar>
|
template <typename Vector>
|
||||||
Scalar
|
typename NormalConeT<Vector>::Scalar
|
||||||
NormalConeT<Scalar>::
|
NormalConeT<Vector>::
|
||||||
max_angle(const NormalConeT& _cone) const
|
max_angle(const NormalConeT& _cone) const
|
||||||
{
|
{
|
||||||
Scalar dotp = (center_normal_ | _cone.center_normal_);
|
Scalar dotp = (center_normal_ | _cone.center_normal_);
|
||||||
@@ -112,12 +112,12 @@ max_angle(const NormalConeT& _cone) const
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
template <typename Scalar>
|
template <typename Vector>
|
||||||
void
|
void
|
||||||
NormalConeT<Scalar>::
|
NormalConeT<Vector>::
|
||||||
merge(const NormalConeT& _cone)
|
merge(const NormalConeT& _cone)
|
||||||
{
|
{
|
||||||
Scalar dotp = (center_normal_ | _cone.center_normal_);
|
Scalar dotp = dot(center_normal_, _cone.center_normal_);
|
||||||
|
|
||||||
if (fabs(dotp) < 0.99999f)
|
if (fabs(dotp) < 0.99999f)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public:
|
|||||||
typedef typename Mesh::VertexHandle VertexHandle;
|
typedef typename Mesh::VertexHandle VertexHandle;
|
||||||
typedef typename Mesh::FaceHandle FaceHandle;
|
typedef typename Mesh::FaceHandle FaceHandle;
|
||||||
typedef typename Mesh::EdgeHandle EdgeHandle;
|
typedef typename Mesh::EdgeHandle EdgeHandle;
|
||||||
typedef NormalConeT<Scalar> NormalCone;
|
typedef NormalConeT<Normal> NormalCone;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user