static void heat_laplacian_create(LaplacianSystem *sys) { MFace *mface = sys->heat.mface, *mf; int totface= sys->heat.totface; int totvert= sys->heat.totvert; int a; /* heat specific definitions */ sys->heat.mindist= MEM_callocN(sizeof(float)*totvert, "HeatMinDist"); sys->heat.H= MEM_callocN(sizeof(float)*totvert, "HeatH"); sys->heat.p= MEM_callocN(sizeof(float)*totvert, "HeatP"); /* add verts and faces to laplacian */ for(a=0; a<totvert; a++) laplacian_add_vertex(sys, sys->heat.verts[a], 0); for(a=0, mf=mface; a<totface; a++, mf++) { laplacian_add_triangle(sys, mf->v1, mf->v2, mf->v3); if(mf->v4) laplacian_add_triangle(sys, mf->v1, mf->v3, mf->v4); } /* for distance computation in set_H */ heat_calc_vnormals(sys); for(a=0; a<totvert; a++) heat_set_H(sys, a); }
static void heat_laplacian_create(LaplacianSystem *sys) { const MLoopTri *mlooptri = sys->heat.mlooptri, *lt; const MLoop *mloop = sys->heat.mloop; int tottri = sys->heat.tottri; int totvert = sys->heat.totvert; int a; /* heat specific definitions */ sys->heat.mindist = MEM_callocN(sizeof(float) * totvert, "HeatMinDist"); sys->heat.H = MEM_callocN(sizeof(float) * totvert, "HeatH"); sys->heat.p = MEM_callocN(sizeof(float) * totvert, "HeatP"); /* add verts and faces to laplacian */ for (a = 0; a < totvert; a++) laplacian_add_vertex(sys, sys->heat.verts[a], 0); for (a = 0, lt = mlooptri; a < tottri; a++, lt++) { int vtri[3]; vtri[0] = mloop[lt->tri[0]].v; vtri[1] = mloop[lt->tri[1]].v; vtri[2] = mloop[lt->tri[2]].v; laplacian_add_triangle(sys, UNPACK3(vtri)); } /* for distance computation in set_H */ heat_calc_vnormals(sys); for (a = 0; a < totvert; a++) heat_set_H(sys, a); }
static void rigid_laplacian_create(LaplacianSystem *sys) { EditMesh *em = sys->rigid.mesh; EditVert *eve; EditFace *efa; int a; /* add verts and faces to laplacian */ for(a=0, eve=em->verts.first; eve; eve=eve->next, a++) { laplacian_add_vertex(sys, eve->co, eve->pinned); eve->tmp.l= a; } for(efa=em->faces.first; efa; efa=efa->next) { laplacian_add_triangle(sys, efa->v1->tmp.l, efa->v2->tmp.l, efa->v3->tmp.l); if(efa->v4) laplacian_add_triangle(sys, efa->v1->tmp.l, efa->v3->tmp.l, efa->v4->tmp.l); } }