Exemplo n.º 1
0
        public static double ComputeVertexDualArea(TriMesh.Vertex v)
        {
            double sum = 0;

            foreach (TriMesh.Face face in v.Faces)
            {
                sum += TriMeshUtil.ComputeAreaFaceTwo(face);
            }

            return(sum / 3);
        }
Exemplo n.º 2
0
        protected Vector3D[] ComputeVectorField(DenseMatrixDouble u, TriMesh mesh)
        {
            Vector3D[] vectors = new Vector3D[mesh.Faces.Count];

            foreach (TriMesh.Face f in mesh.Faces)
            {
                if (f.OnBoundary)
                {
                    continue;
                }

                TriMesh.HalfEdge hij = f.HalfEdge;
                TriMesh.HalfEdge hjk = hij.Next;
                TriMesh.HalfEdge hki = hjk.Next;

                TriMesh.Vertex vi = hij.FromVertex;
                TriMesh.Vertex vj = hjk.FromVertex;
                TriMesh.Vertex vk = hki.FromVertex;

                double ui = u[vi.Index, 0];
                double uj = u[vj.Index, 0];
                double uk = u[vk.Index, 0];

                Vector3D eijL = RotatedEdge(hij);
                Vector3D ejkL = RotatedEdge(hjk);
                Vector3D ekiL = RotatedEdge(hki);

                double area = TriMeshUtil.ComputeAreaFaceTwo(f);

                Vector3D x = 0.5 * (ui * ejkL + uj * ekiL + uk * eijL) / area;

                vectors[f.Index] = -x.Normalize();
            }

            return(vectors);
        }