Esempio n. 1
0
        public TriMesh Recon(TriMesh mesh, int reconNum)
        {
            Eigen eigen = EigenManager.Instance.ComputeEigen(mesh,
                                                             EnumLaplaceMatrix.LapalceCot, reconNum + 10);

            List <double> X = TriMeshUtil.GetX(mesh);
            List <double> Y = TriMeshUtil.GetY(mesh);
            List <double> Z = TriMeshUtil.GetZ(mesh);

            List <double> factorX = new List <double>(reconNum);
            List <double> factorY = new List <double>(reconNum);
            List <double> factorZ = new List <double>(reconNum);

            for (int i = 0; i < reconNum; i++)
            {
                List <double> eigenVector = eigen.GetEigenVector(i);
                double        valueX      = TriMeshUtil.Multiply(eigenVector, X);
                double        valueY      = TriMeshUtil.Multiply(eigenVector, Y);
                double        valueZ      = TriMeshUtil.Multiply(eigenVector, Z);
                factorX.Add(valueX);
                factorY.Add(valueY);
                factorZ.Add(valueZ);
            }


            double[] reconX = new double[mesh.Vertices.Count];
            double[] reconY = new double[mesh.Vertices.Count];
            double[] reconZ = new double[mesh.Vertices.Count];
            for (int i = 0; i < reconNum; i++)
            {
                List <double> eigenVector = eigen.GetEigenVector(i);
                List <double> tempX       = TriMeshUtil.Multiply(eigenVector, factorX[i]);
                reconX = TriMeshUtil.Add(reconX, tempX);

                List <double> tempY = TriMeshUtil.Multiply(eigenVector, factorY[i]);
                reconY = TriMeshUtil.Add(reconY, tempY);
                List <double> tempZ = TriMeshUtil.Multiply(eigenVector, factorZ[i]);
                reconZ = TriMeshUtil.Add(reconZ, tempZ);
            }

            for (int i = 0; i < mesh.Vertices.Count; i++)
            {
                mesh.Vertices[i].Traits.Position.x = reconX[i];
                mesh.Vertices[i].Traits.Position.y = reconY[i];
                mesh.Vertices[i].Traits.Position.z = reconZ[i];
            }


            return(mesh);
        }
Esempio n. 2
0
        private void InitEigenVector(Eigen eigen,int index)
        {
            this.dataGridViewEigenVector.Rows.Clear();

            double[] vector = eigen.GetEigenVector(index).ToArray();

            for (int i = 0; i < vector.Length ; i++)
            {
                this.dataGridViewEigenVector.Rows.Add(i.ToString(), vector[i].ToString());
            }
        }
Esempio n. 3
0
        private void InitEigenVector(Eigen eigen, int index)
        {
            this.dataGridViewEigenVector.Rows.Clear();

            double[] vector = eigen.GetEigenVector(index).ToArray();

            for (int i = 0; i < vector.Length; i++)
            {
                this.dataGridViewEigenVector.Rows.Add(i.ToString(), vector[i].ToString());
            }
        }
Esempio n. 4
0
        public double[] ColorEigenVector(TriMesh mesh, int index)
        {
            if (eigen == null)
            {
                eigen = EigenManager.Instance.ComputeEigen(mesh, eigenCount);
            }

            if (eigenIndex > eigenCount)
            {
                eigen = EigenManager.Instance.ComputeEigen(mesh, eigenCount);
            }
            return(eigen.GetEigenVector(eigenIndex).ToArray());
        }
Esempio n. 5
0
        public static double[] ComputeEigenVector(TriMesh mesh, int i)
        {
            SparseMatrix matrix = null;

            if (LaplaceManager.Instance.CurrentMatrix == null)
            {
                matrix = LaplaceManager.Instance.BuildMatrixCot(mesh);
            }
            else
            {
                matrix = LaplaceManager.Instance.CurrentMatrix;
            }

            Eigen eigen = EigenManager.Instance.ComputeEigen(matrix, "test", i + 2);

            return(eigen.GetEigenVector(i).ToArray());;
        }
Esempio n. 6
0
 public static double[] ComputeEigenVector(Eigen eigen, int i)
 {
     return(eigen.GetEigenVector(i).ToArray());;
 }
Esempio n. 7
0
        public static double[] ComputeEigenVector(SparseMatrix matrix, int i)
        {
            Eigen eigen = EigenManager.Instance.ComputeEigen(matrix, "test", i + 20);

            return(eigen.GetEigenVector(i).ToArray());;
        }
Esempio n. 8
0
 public static double[] ComputeEigenVector(Eigen eigen, int i)
 {  
     return eigen.GetEigenVector(i).ToArray(); ;
 }