示例#1
0
        public MorseVertice ComputeMorseVertice(TriMesh mesh, double[] function)
        {
            EnumMorseVertexType[] morseType = ComputeMorse(mesh, function);

            MorseVertice morseVertice = new MorseVertice();

            for (int i = 0; i < morseType.Length; i++)
            {
                switch (morseType[i])
                {
                case EnumMorseVertexType.Saddle:
                    morseVertice.SaddleList.Add(mesh.Vertices[i]);
                    break;

                case EnumMorseVertexType.Maxium:
                    morseVertice.MaxList.Add(mesh.Vertices[i]);
                    break;

                case EnumMorseVertexType.Minum:
                    morseVertice.MinList.Add(mesh.Vertices[i]);
                    break;
                }
            }

            return(morseVertice);
        }
示例#2
0
        public MorseComplex(TriMesh mesh)
        {
           
            this.mesh = mesh;

            morseVertice = RetrieveMorseVertice(mesh);
        }
示例#3
0
        private void Init()
        {
            TriMeshModify.RepairSimpleHoles(this.mesh);
            AdjustFunction(mesh, ref function);


            morseType    = ComputeMorse(mesh, function);
            morseVertice = ComputeMorseVertice(morseType);
        }
示例#4
0
        public string BuildMorseTheory(TriMesh mesh, double[] function)
        {
            morseVertice = ComputeMorseVertice(mesh, function);
            string morseinfo = "   Vertices - Edges + Faces= ";

            morseinfo += TriMeshUtil.CountEulerCharacteristic(mesh) + "\r\n";

            morseinfo += "   Saddle: " + morseVertice.SaddleList.Count + "\r\n";
            morseinfo += "   Maxima: " + morseVertice.MaxList.Count + "\r\n";
            morseinfo += "   Minima: " + morseVertice.MinList.Count + "\r\n";
            morseinfo += "   Minima - Saddle + Maxima = ";
            morseinfo += morseVertice.MinList.Count - morseVertice.SaddleList.Count + morseVertice.MaxList.Count + "\r\n";

            return(morseinfo);
        }
示例#5
0
        public void DrawSaddleToMax(TriMesh mesh, double[] function)
        {
            MorseVertice morseVertice = ComputeMorseVertice(mesh, function);

            foreach (TriMesh.Vertex saddle in morseVertice.SaddleList)
            {
                foreach (TriMesh.HalfEdge[] path in FindPath(saddle, true))
                {
                    foreach (TriMesh.HalfEdge hf in path)
                    {
                        hf.Edge.Traits.SelectedFlag = 1;
                        hf.Edge.Traits.Color        = Color4.Purple;
                    }
                }
            }
        }
示例#6
0
        public MorseVertice ComputeMorseVertice(EnumMorseVertexType[] morseType)
        {
            MorseVertice morseVertice = new MorseVertice();

            for (int i = 0; i < morseType.Length; i++)
            {
                switch (morseType[i])
                {
                case EnumMorseVertexType.Saddle:
                    morseVertice.SaddleList.Add(mesh.Vertices[i]);
                    break;

                case EnumMorseVertexType.Maxium:
                    morseVertice.MaxList.Add(mesh.Vertices[i]);
                    break;

                case EnumMorseVertexType.Minum:
                    morseVertice.MinList.Add(mesh.Vertices[i]);
                    break;
                }
            }
            return(morseVertice);
        }
示例#7
0
        public MorseVertice RetrieveMorseVertice(TriMesh mesh)
        {
            MorseVertice morse = new MorseVertice();
            foreach (TriMesh.Vertex v in mesh.Vertices)
            {
                if (v.Traits.SelectedFlag == 1)
                {
                    morse.MinList.Add(v);
                }

                if (v.Traits.SelectedFlag == 2)
                {
                    morse.MaxList .Add(v);
                }

                if (v.Traits.SelectedFlag >=3)
                {
                    morse.SaddleList.Add(v);
                }

            }
            return morse;
        } 
示例#8
0
        public MorseVertice RetrieveMorseVertice(TriMesh mesh)
        {
            MorseVertice morse = new MorseVertice();

            foreach (TriMesh.Vertex v in mesh.Vertices)
            {
                if (v.Traits.SelectedFlag == 1)
                {
                    morse.MinList.Add(v);
                }

                if (v.Traits.SelectedFlag == 2)
                {
                    morse.MaxList.Add(v);
                }

                if (v.Traits.SelectedFlag >= 3)
                {
                    morse.SaddleList.Add(v);
                }
            }
            return(morse);
        }
示例#9
0
        public MorseComplex(TriMesh mesh)
        {
            this.mesh = mesh;

            morseVertice = RetrieveMorseVertice(mesh);
        }
示例#10
0
        public string BuildMorseTheory(TriMesh mesh, double[] function)
        {
            morseVertice = ComputeMorseVertice(mesh, function);
            string morseinfo = "   Vertices - Edges + Faces= ";
            morseinfo += TriMeshUtil.CountEulerCharacteristic(mesh)+"\r\n";
            
            morseinfo += "   Saddle: " + morseVertice.SaddleList.Count+"\r\n";
            morseinfo += "   Maxima: " + morseVertice.MaxList.Count + "\r\n";
            morseinfo += "   Minima: " + morseVertice.MinList.Count + "\r\n";
            morseinfo += "   Minima - Saddle + Maxima = ";
            morseinfo += morseVertice.MinList.Count - morseVertice.SaddleList.Count + morseVertice.MaxList.Count + "\r\n";

            return morseinfo;

        }
示例#11
0
        public MorseVertice ComputeMorseVertice(EnumMorseVertexType[] morseType)
        {
 

            MorseVertice morseVertice = new MorseVertice();
            for (int i = 0; i < morseType.Length; i++)
            {
                switch (morseType[i])
                {
                    case EnumMorseVertexType.Saddle:
                        morseVertice.SaddleList.Add(mesh.Vertices[i]);
                        break;

                    case EnumMorseVertexType.Maxium:
                        morseVertice.MaxList.Add(mesh.Vertices[i]);
                        break;

                    case EnumMorseVertexType.Minum:
                        morseVertice.MinList.Add(mesh.Vertices[i]);
                        break;


                }

            }
            return morseVertice;
        }
示例#12
0
        public MorseVertice ComputeMorseVertice(TriMesh mesh, double[] function)
        {

            EnumMorseVertexType[] morseType = ComputeMorse(mesh,function);

            MorseVertice morseVertice= new MorseVertice();
            for(int i=0;i<morseType.Length ;i++)
            {
                switch (morseType[i])
                {
                    case EnumMorseVertexType.Saddle: 
                    morseVertice.SaddleList.Add(mesh.Vertices[i]);
                    break;

                    case EnumMorseVertexType.Maxium:
                    morseVertice.MaxList.Add(mesh.Vertices[i]);
                    break;
                  
                    case EnumMorseVertexType.Minum:
                    morseVertice.MinList.Add(mesh.Vertices[i]);
                    break;

                   
                }
                
            }
           
            return morseVertice;
        }
示例#13
0
        private void Init()
        {
            TriMeshModify.RepairSimpleHoles(this.mesh);
            AdjustFunction(mesh,ref function);


            morseType=ComputeMorse(mesh, function); 
            morseVertice = ComputeMorseVertice(morseType);
        }