Namespaces | |
namespace | detail |
Classes | |
class | BaseInterpolator |
class | PolynomialInterpolator |
class | SplineInterpolator |
Functions | |
template<typename iterator > | |
detail::ImplicitFunction < typename iterator::value_type > | variational_interpolator (iterator point_begin, iterator point_end, iterator normal_begin, iterator normal_end) |
detail::ImplicitFunction<typename iterator::value_type> OpenTissue::interpolation::variational_interpolator | ( | iterator | point_begin, | |
iterator | point_end, | |||
iterator | normal_begin, | |||
iterator | normal_end | |||
) | [inline] |
Variational Interpolation. This implementation is based on the paper:
Greg Turk and James O'Brien, "Shape Transformation Using Variational Implicit Functions," SIGGRAPH 99, August 1999, pp. 335-342.
This can be obtained from: http://www-static.cc.gatech.edu/~turk/my_papers/schange.pdf
Intended usage:
typedef .... vector3_type; typedef ... grid_type;
points[0] = vector3_type( 0.008337971754, -0.393710464239, 0.163935899734 ); ... points[...] = vector3_type( -0.060189183801, -0.305664300919, -0.289155662060 );
normals[0] = vector3_type( 0.121994487941, -0.001839586534, 0.992529094219 ); ... normals[...] = vector3_type( -0.021462006494, 0.442783534527, -0.896371662617 );
grid_type phi;
phi.create( vector3_type(-2,-2,-2), vector3_type(2,2,2), 64,64,64); detail::implicit_function<vector3_type> F = variational_interpolator(m_points.begin(),m_points.end(),m_normals.begin(),m_normals.end()); for(unsigned int k=0;k<64;++k) for(unsigned int j=0;j<64;++j) for(unsigned int i=0;i<64;++i) { vector3_type coord; OpenTissue::grid::idx2coord(m_phi,i,j,k,coord); m_phi(i,j,k) = F(coord); }
This is a bit nitty-griffty, so it may be better to use the variational-interpolator function to create a implicit function functor on the fly. That is create some function like
template<typename grid_type,typename functor_type> void doit(grid_type & phi, functor_type & F) { typedef typename functor_type::return_type vector3_type; for(unsigned int k=0;k<phi.K();++k) for(unsigned int j=0;j<phi.J();++j) for(unsigned int i=0;i<phi.I();++i) { vector3_type coord; OpenTissue::grid::idx2coord(phi,i,j,k,coord); phi(i,j,k) = F(coord); } }
and then simply write
typedef .... vector3_type; typedef ... grid_type; points[0] = vector3_type( 0.008337971754, -0.393710464239, 0.163935899734 ); ... points[...] = vector3_type( -0.060189183801, -0.305664300919, -0.289155662060 ); normals[0] = vector3_type( 0.121994487941, -0.001839586534, 0.992529094219 ); ... normals[...] = vector3_type( -0.021462006494, 0.442783534527, -0.896371662617 ); grid_type phi; phi.create( vector3_type(-2,-2,-2), vector3_type(2,2,2), 64,64,64); doit( phi, variational_interpolator(points.begin(),points.end(),normals.begin(),normals.end()) );
That's it.
point_begin | ||
point_end | ||
normal_begin | ||
normal_end |