text: ////////////////////////////////////////////////////////////////////
  //
  // $Id: CCSub.hxx 2021/06/05 14:16:41 kanai Exp $
  //
  // Copyright (c) 2021 Takashi Kanai
  // Released under the MIT license
  //
  ////////////////////////////////////////////////////////////////////
  
  #include "envDep.h"
  
  #include <vector>
  using namespace std;
  
  #include "MeshL.hxx"
  #include "VertexL.hxx"
  #include "EdgeL.hxx"
  #include "FaceL.hxx"
  
  class CCSub {
  
    // original mesh
    MeshL* mesh_;
  
    // subdivided mesh
    MeshL* submesh_;
  
    // vertices pointer
    std::vector<VertexL*> even_;  // even vertex
    std::vector<VertexL*> edvt_;  // edge vertex
    std::vector<VertexL*> fcvt_;  // face vertex
    
  public:
  
    CCSub () : mesh_(NULL), submesh_(NULL) {};
    CCSub( MeshL& mesh ) : submesh_(NULL) { setMesh( mesh ); };
    CCSub( MeshL& mesh, MeshL& submesh ) {
      setMesh( mesh );
      setSubMesh( submesh );
    };
    ~CCSub() {};
  
    void setMesh( MeshL& mesh ) { mesh_ = &mesh; };
    void setSubMesh( MeshL& mesh ) { submesh_ = &mesh; };
  
    bool emptyMesh() const { return (mesh_ != NULL) ? false : true; };
    bool emptySubMesh() const { return (submesh_ != NULL) ? false : true; };
    
    void apply() {
      if ( init() == false ) return;
      setSplit();
      setStencil();
      submesh_->calcAllFaceNormals();
    };
  
    bool init();
    void setSplit();
    void setStencil();
    void setStencilEven( VertexL*, Point3f& );
    void setStencilEdge( EdgeL*, Point3f& );
    void setStencilFace( FaceL*, Point3f& );
    
  };
  
  // masks
  
  #define CC_MASK_EVEN_VV 1.5  // connected vertex
  #define CC_MASK_EVEN_VA .25  // diagonal vertex
  #define CC_MASK_EVEN_VC 1.75 // center vertex
  
  #define CC_MASK_EDGE_VA .0625
  #define CC_MASK_EDGE_VV .375
  
  #define CC_MASK_FACE_VV .25
  
  
  