refactor quadratic patch code
This commit is contained in:
@ -2,69 +2,7 @@
|
||||
#define CURVATURE_H
|
||||
|
||||
#include "my_mesh.h"
|
||||
|
||||
|
||||
class MyQuad {
|
||||
double _coefs[5] ; // a_0 x^2 + a1 xy + a2 y^2 + a3 x + a4 y + a5
|
||||
public:
|
||||
Eigen::AngleAxisd _r ;
|
||||
Eigen::Translation3d _t ;
|
||||
|
||||
MyQuad(double *data,
|
||||
const Eigen::AngleAxisd &r = Eigen::AngleAxisd(0, Eigen::Vector3d(0,0,1)),
|
||||
const Eigen::Translation3d &t = Eigen::Translation3d(0,0,0))
|
||||
: _r(r), _t(t)
|
||||
{
|
||||
for (size_t i=0; i<5; i++)
|
||||
_coefs[i] = data[i] ;
|
||||
}
|
||||
MyQuad(const Eigen::VectorXd &v,
|
||||
const Eigen::AngleAxisd &r = Eigen::AngleAxisd(0, Eigen::Vector3d(0,0,1)),
|
||||
const Eigen::Translation3d &t = Eigen::Translation3d(0,0,0))
|
||||
: _r(r), _t(t)
|
||||
{
|
||||
for (size_t i=0; i<5; i++)
|
||||
_coefs[i] = v[i] ;
|
||||
}
|
||||
MyQuad(double a0=0, double a1=0, double a2=0, double a3=0, double a4=0,
|
||||
const Eigen::AngleAxisd &r = Eigen::AngleAxisd(0, Eigen::Vector3d(0,0,1)),
|
||||
const Eigen::Translation3d &t = Eigen::Translation3d(0,0,0))
|
||||
: _r(r), _t(t)
|
||||
{
|
||||
_coefs[0] = a0 ;
|
||||
_coefs[1] = a1 ;
|
||||
_coefs[2] = a2 ;
|
||||
_coefs[3] = a3 ;
|
||||
_coefs[4] = a4 ;
|
||||
}
|
||||
MyQuad(const MyQuad &q) : _r(q._r), _t(q._t)
|
||||
{
|
||||
for (size_t i=0; i<5; i++)
|
||||
_coefs[i] = q._coefs[i] ;
|
||||
}
|
||||
|
||||
MyQuad &operator=(const MyQuad &q) {
|
||||
_r = q._r;
|
||||
_t = q._t;
|
||||
for (size_t i=0; i<5; i++)
|
||||
_coefs[i] = q._coefs[i] ;
|
||||
return *this;
|
||||
}
|
||||
|
||||
double & operator[] (size_t i) {return _coefs[i] ; }
|
||||
|
||||
double quad_fun (double x, double y)
|
||||
{
|
||||
return _coefs[0] * x*x + _coefs[1] * x*y + _coefs[2] * y*y + _coefs[3] * x + _coefs[4] * y ;
|
||||
}
|
||||
|
||||
double quad_fun (const OpenMesh::Vec2d &v)
|
||||
{
|
||||
|
||||
return quad_fun(v[0], v[1]) ;
|
||||
}
|
||||
|
||||
};
|
||||
#include "quad_patch.h"
|
||||
|
||||
|
||||
template <typename T>
|
||||
@ -145,16 +83,16 @@ private:
|
||||
MyMesh &_mesh ;
|
||||
|
||||
public:
|
||||
OpenMesh::VPropHandleT<double> vprop_K;
|
||||
OpenMesh::VPropHandleT<double> vprop_H;
|
||||
OpenMesh::VPropHandleT<MyQuad> vprop_quad;
|
||||
OpenMesh::VPropHandleT<double> vprop_K;
|
||||
OpenMesh::VPropHandleT<double> vprop_H;
|
||||
OpenMesh::VPropHandleT<QuadPatch> vprop_quad;
|
||||
|
||||
Courbures(MyMesh &mesh) : _mesh(mesh) {}
|
||||
|
||||
void set_fixed_colors() ;
|
||||
void normales_locales() ;
|
||||
std::vector<MyMesh::VertexHandle> get_two_neighborhood(MyMesh::VertexHandle vh);
|
||||
MyQuad fit_quad(MyMesh::VertexHandle vh) ;
|
||||
QuadPatch fit_quad(MyMesh::VertexHandle vh);
|
||||
void compute_KH() ;
|
||||
void set_K_colors() ;
|
||||
};
|
||||
|
Reference in New Issue
Block a user