public CrossBoundaryBrushes(Mesh _mesh, Option _opt)
        {
            this.mesh = _mesh;
            this.opt = _opt;
            this.regionNum = opt.NumberOfIsolines;

            // initialize triareas
            int fn = mesh.FaceCount, vn = mesh.VertexCount;
            this.triArea = new double[fn];
            for (int i = 0; i < fn; ++i)
            {
                triArea[i] = mesh.ComputeFaceArea(i);
            }
            this.colorInterpolater = new ColorInterpolater();
            this.vrtDisplayColor = new double[vn * 3];
            this.triDisplayColor = new double[fn * 3];
            this.linesOnFace = new List<int>[fn];
            for (int i = 0; i < fn; ++i)
            {
                this.linesOnFace[i] = new List<int>();
            }

            // --- for patch -type --
            this.fnode = new GraphNode[fn];
            this.vnode = new GraphNode[vn];
            for (int i = 0; i < fn; ++i) fnode[i] = new GraphNode(i, -1);
            for (int i = 0; i < vn; ++i) vnode[i] = new GraphNode(i, -1);

            // --- initialize sampling ---
            this.finalFaceRec = new IsoFaceRec[fn];
            for (int i = 0; i < fn; ++i)
            {
                finalFaceRec[i] = new IsoFaceRec();
                finalFaceRec[i].index = i;
            }

            this.ShowCuts = true;
            this.patchid = new byte[fn];
            this.user_operation_stack = new Stack<bool>();
        }
 public MeshRecord(string filename, Mesh mesh)
 {
     this.filename = filename;
     this.mesh = mesh;
     this.originalVtPos = (double[])mesh.VertexPos.Clone();
 }
        public void OpenMeshFile()
        {
            openFileDialog1.FileName = "";
            openFileDialog1.Filter = "Mesh files (*.obj)|*.obj";
            openFileDialog1.CheckFileExists = true;

            DialogResult ret = openFileDialog1.ShowDialog(this);

            if (ret == DialogResult.OK)
            {
                StreamReader sr = new StreamReader(openFileDialog1.FileName);
                Mesh m = new Mesh(sr);
                sr.Close();
                MeshRecord rec = new MeshRecord(openFileDialog1.FileName, m);

                meshes.Add(rec);
                currentMeshRecord = rec;
                TabPage page = new TabPage(rec.ToString());
                page.Tag = rec;
                tabControlModelList.TabPages.Add(page);
                tabControlModelList.SelectedTab = page;
                meshView1.SetModel(rec);
                propertyGridModel.SelectedObject = rec;
                PrintText("Loaded mesh " + openFileDialog1.FileName + "\n");

                // ----------------------------------------------------------------------
                // initialize the harminic field
                // ----------------------------------------------------------------------
                CrossBoundaryBrushes.Option opt = new CrossBoundaryBrushes.Option();
                opt.Part_Type = true;
                currentMeshRecord.CrossBoundaryBrushes =
                    new CrossBoundaryBrushes(currentMeshRecord.Mesh, opt);
                currentMeshRecord.CrossBoundaryBrushes.InitialHarminicField();

                this.meshView1.Refresh();

            }
        }