MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / deformMesh

Function deformMesh

Tools/MeshSkinning/main.cpp:728–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

726
727
728void deformMesh()
729{
730 const int numVertices = (int)mesh.numVertices();
731 auto& meshX0 = mesh.getVertices();
732
733 #pragma omp parallel default(shared)
734 {
735 #pragma omp for schedule(static)
736 for (int i = 0; i < numVertices; i++)
737 {
738 Vector3r &mesh_xi = meshX[i];
739 const Vector3r& mesh_xi0 = meshX0[i];
740 const Vector3f8 xi0_avx(mesh_xi0);
741
742 const unsigned int numNeighbors = (unsigned int)initialMeshNeighbors[i].size();
743
744 Vector3f8 xNew;
745 xNew.setZero();
746 for (unsigned int j = 0; j < numNeighbors; j += 8)
747 {
748 const unsigned int count = std::min(numNeighbors - j, 8u);
749
750 const Vector3f8 xj_avx = convertVec_zero(&initialMeshNeighbors[i][j], &x[0], count);
751 const Vector3f8 xj0_avx = convertVec_zero(&initialMeshNeighbors[i][j], &x0[0], count);
752 const Matrix3f8 Fj_avx = convertMat_zero(&initialMeshNeighbors[i][j], &F[0], count);
753
754 const Vector3f8 xi_xj_0 = xi0_avx - xj0_avx;
755 const Scalarf8 restVolume_j_avx = convert_zero(&initialMeshNeighbors[i][j], &restVolumes[0], count);
756 const Scalarf8 W = CubicKernel_AVX::W(xi_xj_0);
757
758 xNew += (Fj_avx * xi_xj_0 + xj_avx) * restVolume_j_avx * W;
759 }
760 mesh_xi = xNew.reduce();
761 mesh_xi *= shepard[i];
762 }
763 }
764}
765
766#else
767

Callers 1

meshSkinningFunction · 0.85

Calls 8

minFunction · 0.85
convertVec_zeroFunction · 0.85
convertMat_zeroFunction · 0.85
convert_zeroFunction · 0.85
numVerticesMethod · 0.80
sizeMethod · 0.45
setZeroMethod · 0.45
reduceMethod · 0.45

Tested by

no test coverage detected