Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            TreeCoTree treeCotree = new TreeCoTree(Mesh);

            List <List <TriMesh.HalfEdge> > loops = treeCotree.ExtractHonologyGenerator(Mesh);

            HarmonicBasis basis = new HarmonicBasis(Mesh);

            basis.BuildHarmonicBasis(loops);

            GlobalData.Instance.Generators           = loops;
            GlobalSetting.DisplaySetting.DisplayMode = EnumDisplayMode.Generator;
            OnChanged(EventArgs.Empty);
        }
Пример #2
0
        public void InitProcess(TriMesh mesh)
        {
            TreeCoTree treeCotree = new TreeCoTree(mesh);

            generatorLoops = treeCotree.ExtractHonologyGenerator(mesh);

            HarmonicBasis basis = new HarmonicBasis(mesh);

            HarmonicBasis = basis.BuildHarmonicBasis(generatorLoops);
            int numberOfHarmBases = basis.NumberOfHarmonicBases(generatorLoops);

            //Still need to built
            u = InitWithTrivalHolonmy(Laplace, mesh);

            HarmonicCoffition = new double[numberOfHarmBases];


            if (numberOfHarmBases == 0)
            {
                return;
            }

            DenseMatrixDouble  b = new DenseMatrixDouble(numberOfHarmBases, 1);
            SparseMatrixDouble H = new SparseMatrixDouble(numberOfHarmBases, numberOfHarmBases);

            int row = 0;

            bool skipBoundaryLoop = true;

            for (int i = 0; i < generatorLoops.Count; i++)
            {
                List <TriMesh.HalfEdge> cycle = generatorLoops[i];

                if (skipBoundaryLoop && treeCotree.IsBoundaryGenerator(cycle))
                {
                    skipBoundaryLoop = false;
                    continue;
                }

                foreach (TriMesh.HalfEdge hf in cycle)
                {
                    for (int col = 0; col < numberOfHarmBases; col++)
                    {
                        H[row, col] += HarmonicBasis[hf.Index][col];
                    }
                }

                double value = -GeneratorHolomy(cycle, HarmonicBasis, HarmonicCoffition, u);

                b[row, 0] = value;
                row++;
            }

            DenseMatrixDouble x = null;

            if (b.F_Norm() > 1.0e-8)
            {
                x = LinearSystemGenericByLib.Instance.SolveLinerSystem(ref H, ref b);
            }
            else
            {
                x = new DenseMatrixDouble(numberOfHarmBases, 1);
            }

            for (int i = 0; i < numberOfHarmBases; i++)
            {
                HarmonicCoffition[i] = x[i, 0];
            }
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            TreeCoTree treeCotree = new TreeCoTree(Mesh);

            List<List<TriMesh.HalfEdge>> loops = treeCotree.ExtractHonologyGenerator(Mesh);

            HarmonicBasis basis = new HarmonicBasis(Mesh);
            basis.BuildHarmonicBasis(loops);

            GlobalData.Instance.Generators = loops;
            GlobalSetting.DisplaySetting.DisplayMode = EnumDisplayMode.Generator;
            OnChanged(EventArgs.Empty);

        }
Пример #4
0
        public void InitProcess(TriMesh mesh)
        {

            TreeCoTree treeCotree = new TreeCoTree(mesh);

            generatorLoops = treeCotree.ExtractHonologyGenerator(mesh);

            HarmonicBasis basis = new HarmonicBasis(mesh);
            HarmonicBasis = basis.BuildHarmonicBasis(generatorLoops);
            int numberOfHarmBases = basis.NumberOfHarmonicBases(generatorLoops);

            //Still need to built
            u = InitWithTrivalHolonmy(Laplace, mesh);

            HarmonicCoffition = new double[numberOfHarmBases];


            if (numberOfHarmBases == 0)
            {
                return;
            }

            DenseMatrixDouble b = new DenseMatrixDouble(numberOfHarmBases, 1);
            SparseMatrixDouble H = new SparseMatrixDouble(numberOfHarmBases, numberOfHarmBases);

            int row = 0;

            bool skipBoundaryLoop = true;
            for (int i = 0; i < generatorLoops.Count; i++)
            {
                List<TriMesh.HalfEdge> cycle = generatorLoops[i];

                if (skipBoundaryLoop && treeCotree.IsBoundaryGenerator(cycle))
                {
                    skipBoundaryLoop = false;
                    continue;
                }

                foreach (TriMesh.HalfEdge hf in cycle)
                {
                    for (int col = 0; col < numberOfHarmBases; col++)
                    {
                        H[row, col] += HarmonicBasis[hf.Index][col];
                    }
                }

                double value = -GeneratorHolomy(cycle, HarmonicBasis, HarmonicCoffition, u);

                b[row, 0] = value;
                row++;
            }

            DenseMatrixDouble x = null;

            if (b.F_Norm() > 1.0e-8)
            {
                x = LinearSystemGenericByLib.Instance.SolveLinerSystem(ref H, ref b);
            }
            else
            {
                x = new DenseMatrixDouble(numberOfHarmBases, 1);
            }

            for (int i = 0; i < numberOfHarmBases; i++)
            {
                HarmonicCoffition[i] = x[i, 0];
            }

        }