text: ////////////////////////////////////////////////////////////////////
  //
  // $Id: hsphtest.cxx 2021/06/05 13:54:13 kanai Exp $
  //
  // Copyright (c) 2021 Takashi Kanai
  // Released under the MIT license
  //
  ////////////////////////////////////////////////////////////////////
  
  #include "envDep.h"
  
  #include "VSplit.hxx"
  #include "SRMesh.hxx"
  #include "PMIO.hxx"
  
  #include "MeshL.hxx"
  #include "SMFLIO.hxx"
  
  #include "SRLConv.hxx"
  #include "HSphParam.hxx"
  
  int main( int argc, char *argv[] )
  {
    if ( (argc != 3) && (argc != 8) )
      {
        std::cerr << "Usage: " << argv[0] << " in.pm out.obj (init_num prog opt_type ct cc)" << std::endl;
        return 1;
      }
  
    SRMesh srmesh;
  
    PMIO pmio( srmesh );
    pmio.inputFromFile( argv[1] );
  
    bool texture_flag = true;
    HSphParam hsph( srmesh );
  
    hsph.setType( HCONFORMAL );
  
    if ( argc == 8 )
      {
        hsph.setNum( atoi(argv[3]) );
  
        if ( atoi(argv[4]) == 1 )
          hsph.setIsProgressiveOptimize( true );
        else
          hsph.setIsProgressiveOptimize( false );
  
        if ( atoi(argv[5]) == 1 )
          hsph.setOptimizeType( OPTIMIZE_PQ );
        else
          hsph.setOptimizeType( OPTIMIZE_CONF );
  
        if ( hsph.isOptimizeType() == OPTIMIZE_CONF )
          {
            hsph.setTutteEpsilon( atof(argv[6]) );
            hsph.setConformalEpsilon( atof(argv[7]) );
          }
      }
  
    cout << "init num: " << hsph.getInitNum() << endl;
    string t;
    if ( hsph.isProgressiveOptimize() == true ) t = "yes";
    else t = "no";
    cout << "progressive optimize: " << t.c_str() << endl;
  
    string s;
    if ( hsph.isOptimizeType() == OPTIMIZE_PQ ) s = "prique opt.";
    else s = "conformal opt.";
    cout << "optimize type: " << s.c_str() << endl;
    cout << "tutte epsilon: " << hsph.tutteEpsilon() << endl;
    cout << "conformal epsilon: " << hsph.conformalEpsilon() << endl;
  
    hsph.apply( texture_flag );
  
    SMFLIO smflio_output( hsph.mesh() );
    smflio_output.outputToFile( argv[2], false, texture_flag, false );
  }
  
  
  
  