Beispiel #1
0
        public double[] ColorVertexByGaussin(TriMesh mesh, double min, double max)
        {
            double[] gaussin = TriMeshUtil.ComputeGaussianCurvatureIntegrated(mesh);

            ColorVertex(mesh, gaussin, min, max);

            return(gaussin);
        }
Beispiel #2
0
        private double[] BuildRightB(TriMesh Mesh)
        {
            double[] b = TriMeshUtil.ComputeGaussianCurvatureIntegrated(Mesh);

            for (int i = 0; i < b.Length; i++)
            {
                b[i] = -(b[i] * b[i]);
            }
            return(b);
        }
Beispiel #3
0
        public void InitProcess()
        {
            SparseMatrixDouble d0 = DECDouble.Instance.BuildExteriorDerivative0Form(mesh);
            SparseMatrixDouble d1 = DECDouble.Instance.BuildExteriorDerivative1Form(mesh);

            //SparseMatrixDouble d1 = SparseMatrixDouble.ReadFromFile("d1.mat");

            double[] guassianCurvatures = TriMeshUtil.ComputeGaussianCurvatureIntegrated(mesh);

            //Seize all singularities
            if (Singularities.Count == 0)
            {
                Singularities.Add(new KeyValuePair <TriMesh.Vertex, double>(mesh.Vertices[0], 2.0f));
            }

            x = ComputeTrivaialConnection(d0, d1, guassianCurvatures);
        }
Beispiel #4
0
        public void SetRange(TriMesh mesh, EnumColorItem item, ref CriteriaRange criteriaRange)
        {
            double[] range = null;
            switch (item)
            {
            case EnumColorItem.DihedralAngle:
                range = TriMeshUtil.ComputeDihedralAngle(mesh);
                break;

            case EnumColorItem.Gaussian:
                range = TriMeshUtil.ComputeGaussianCurvatureIntegrated(mesh);
                break;

            case EnumColorItem.Mean:
                range = TriMeshUtil.ComputeMeanCurvature(mesh);
                break;
            }

            criteriaRange.Max = TriMeshFunction.Instance.ComputeMax(range);
            criteriaRange.Min = TriMeshFunction.Instance.ComputeMin(range);
        }
Beispiel #5
0
        public DenseMatrixDouble InitWithTrivalHolonmy(SparseMatrixDouble Laplace, TriMesh mesh)
        {
            DenseMatrixDouble b = new DenseMatrixDouble(mesh.Vertices.Count, 1);

            double[] tempSingularities = new double[mesh.Vertices.Count];
            for (int i = 0; i < tempSingularities.Length; i++)
            {
                tempSingularities[i] = 0;
            }

            foreach (KeyValuePair <TriMesh.Vertex, double> pair in Singularities)
            {
                int    index = pair.Key.Index;
                double value = pair.Value;

                tempSingularities[index] = value;
            }

            double[] GuassianCurvs = TriMeshUtil.ComputeGaussianCurvatureIntegrated(mesh);

            foreach (TriMesh.Vertex v in mesh.Vertices)
            {
                double value = 0;
                if (!v.OnBoundary)
                {
                    value -= GuassianCurvs[v.Index];
                    value += 2 * Math.PI * tempSingularities[v.Index];
                }

                b[v.Index, 0] = value;
            }

            DenseMatrixDouble u = LinearSystemGenericByLib.Instance.SolveLinerSystem(ref Laplace, ref b);

            return(u);
        }
Beispiel #6
0
        public double[] ComputeFunction(TriMesh mesh)
        {
            double[] function = null;
            switch (FunctionType)
            {
            case EnumFunction.X:
                function = ComputeX(mesh);
                break;

            case EnumFunction.Y:
                function = ComputeY(mesh);
                break;

            case EnumFunction.Z:
                function = ComputeZ(mesh);
                break;

            case EnumFunction.CosX:

                function = ComputeCosX(mesh, ConfigFunction.Instance.Cos);
                break;

            case EnumFunction.CosY:

                function = ComputeCosY(mesh, ConfigFunction.Instance.Cos);
                break;

            case EnumFunction.CosZ:

                function = ComputeCosZ(mesh, ConfigFunction.Instance.Cos);
                break;

            case EnumFunction.Harmonic:

                function = ComputeHarmonic(mesh);
                break;

            case EnumFunction.SmoothedCurvature:

                function = ComputeSmoothedCurvature(mesh);
                break;

            case EnumFunction.DiffusionDistance:

                function = ComputeDistanceDiffusion(mesh, ConfigFunction.Instance.Diffustion);
                break;

            case EnumFunction.CommuteTime:

                function = ComputeDistanceCommuteTime(mesh);
                break;


            case EnumFunction.BiharmonicDistance:

                function = ComputeDistanceBiharmonic(mesh);
                break;

            case EnumFunction.ADFDistance:

                function = ComputeDistanceADF(mesh, ConfigFunction.Instance.ADF);
                break;

            case EnumFunction.Gaussian:

                function = TriMeshUtil.ComputeGaussianCurvatureIntegrated(mesh);
                break;

            case EnumFunction.MeanCurvature:

                function = TriMeshUtil.ComputeMeanCurvature(mesh);
                break;

            case EnumFunction.GaussianVertex:
                CurvatureLib.Init(mesh);
                function = CurvatureLib.ComputeGaussianCurvature();

                break;

            case EnumFunction.MeanCurvatureVertex:

                CurvatureLib.Init(mesh);
                function = CurvatureLib.ComputeMeanCurvature();
                break;

            case EnumFunction.PrincipalMaxAbs:

                CurvatureLib.Init(mesh);
                function = CurvatureLib.ComputePrincipalMaxAbs();
                break;

            case EnumFunction.PrincipalMinAbs:

                CurvatureLib.Init(mesh);
                function = CurvatureLib.ComputePrincipalMinAbs();
                break;

            case EnumFunction.PrincipalMax:

                CurvatureLib.Init(mesh);
                function = CurvatureLib.ComputePrincipalMax();
                break;

            case EnumFunction.PrincipalMin:

                CurvatureLib.Init(mesh);
                function = CurvatureLib.ComputePrincipalMin();
                break;

            case EnumFunction.EigenVector:

                function = ComputeEigenVector(mesh, ConfigFunction.Instance.EigenIndex);
                break;

            case EnumFunction.External:

                function = Function;
                break;
            }

            this.Function = function;

            return(function);
        }