108int main( 
int argc, 
char* argv[] )
 
  116  using namespace DGtal;
 
  123  std::string input = argv[ 1 ];
 
  124  const double    R = argc > 2 ? atof( argv[ 2 ] ) : 0.0; 
 
  125  const double Hmax = argc > 3 ? atof( argv[ 3 ] ) : 5.0; 
 
  126  const double Gmax = argc > 4 ? atof( argv[ 4 ] ) : 0.5*Hmax*Hmax; 
 
  129  std::ifstream obj_stream( input.c_str() );
 
  130  bool ok = SMR::readOBJ( obj_stream, smesh );
 
  133      trace.error() <<  
"Unable to read file <" << input.c_str() << 
">" << std::endl;
 
  138  for ( 
const auto& p : smesh.positions() )
 
  139    lo = lo.
inf( p ), up = up.
sup( p );
 
  140  const auto diameter = (up - lo).norm();
 
  141  trace.info() << 
"Mesh=" << smesh
 
  142               << 
" diameter=" << diameter
 
  143               << 
" radius=" << R << std::endl;
 
  150  if ( smesh.vertexNormals().empty() )
 
  152      if ( smesh.faceNormals().empty() )
 
  153        smesh.computeFaceNormalsFromPositions();
 
  154      smesh.computeVertexNormalsFromFaceNormals();
 
  157  auto mu0 = cnc.computeMu0();
 
  158  auto mu1 = cnc.computeMu1();
 
  159  auto mu2 = cnc.computeMu2();
 
  164  std::vector< double > 
H( smesh.nbFaces() );
 
  165  std::vector< double > G( smesh.nbFaces() );
 
  166  for ( 
auto f = 0; f < smesh.nbFaces(); ++f )
 
  168      const auto b    = smesh.faceCentroid( f );
 
  169      const auto area = mu0.measure( b, R, f );
 
  170      H[ f ] = cnc.meanCurvature    ( area, mu1.measure( b, R, f ) );
 
  171      G[ f ] = cnc.GaussianCurvature( area, mu2.measure( b, R, f ) );
 
  176  auto H_min_max = std::minmax_element( 
H.cbegin(), 
H.cend() );
 
  177  auto G_min_max = std::minmax_element( G.cbegin(), G.cend() );
 
  178  std::cout << 
"Computed mean curvatures:" 
  179            << 
" min=" << *H_min_max.first << 
" max=" << *H_min_max.second
 
  181  std::cout << 
"Computed Gaussian curvatures:" 
  182            << 
" min=" << *G_min_max.first << 
" max=" << *G_min_max.second
 
  190  auto colorsH = SMW::Colors( smesh.nbFaces() );
 
  191  auto colorsG = SMW::Colors( smesh.nbFaces() );
 
  192  for ( 
auto i = 0; i < smesh.nbFaces(); i++ )
 
  194      colorsH[ i ] = colormapH( 
H[ i ] );
 
  195      colorsG[ i ] = colormapG( G[ i ] );
 
  197  SMW::writeOBJ( 
"example-cnc-H", smesh, colorsH );
 
  198  SMW::writeOBJ( 
"example-cnc-G", smesh, colorsG );
 
 
auto inf(const PointVector< dim, OtherComponent, OtherStorage > &aPoint) const -> decltype(DGtal::inf(*this, aPoint))
Implements the infimum (or greatest lower bound).
 
auto sup(const PointVector< dim, OtherComponent, OtherStorage > &aPoint) const -> decltype(DGtal::sup(*this, aPoint))
Implements the supremum (or least upper bound).