||
前面介绍过固定边界的网格参数化方法,而不固定边界的所谓自然边界的参数化方法也比较常用,比如 Lévy等人的LSCM方法(Blender软件中使用的方法),Desbrun等人的DCP,还有刘利刚老师的基于As-rigid-as-possible的方法。还有下面介绍的基于稀疏矩阵eigenvector的谱方法,论文Spectral Conformal Parameterization。
文中2.2节能量公式离散化,除了计算网格cotangent参数矩阵LD(2V*2V维离散Laplacian矩阵,V是网格点个数),还要计算网格展开到平面后的2D边界u包围的面积表达式A(u)=1/2*uT*A*u中的矩阵A(多边形面积表达成边界坐标u的二次多项式形式),A是2V*2V维的对称稀疏矩阵,矩阵非0项个数是边界点个数的4倍。
[L,w] = cal_mesh_laplacian( meanshape,facetri,'conformal'); LD = [L,sparse(numv,numv); sparse(numv,numv), L]; %u = [u1,u2,u3...,v1,v2,v3...] % construct A(u) = sum(1/2*|ui*vj-uj*vi|) = u'*A*u to A from idcon % id_ij = index of [u,v] % pos part uivj: id_ij = [idcon, [idcon(2:end);idcon(1)]]; % neg part ujvi: id_ij = [id_ij;fliplr(id_ij)]; % add Num to v part id_ij(:,2) = id_ij(:,2) + numv ; s = ones(numel(idcon),1); s = [s;-s]; A = sparse(id_ij(:,1),id_ij(:,2),s,2*numv,2*numv) ; % copy symetry part,note the values for i==j in A is always 0 A = A + A'; LC = LD - A;
3.2节计算LC的Fiedler Vector,即矩阵LC=LD-A的eigenvector(似乎就是Lc矩阵的null-space):
eignum = 3; [V,D] = eigs(LC,eignum,'sm'); %diag(D) is [smallest-non-neg-value,0,0] k = 1; vx = V(1:numv,k); vy = V(1+numv:end,k); %align ptm to vertical line vx = vx - mean(vx(idm)); vy = vy - mean(vy(idm)); theta = -atan2(vx(idm(2)),vy(idm(2)));%upper one vall = [vx*cos(theta)+vy*sin(theta), -vx*sin(theta)+vy*cos(theta)]; vx = vall(:,1); vy = vall(:,2); %contour pcon = [vx(idcon),vy(idcon),zeros(numel(idcon),1)]; ptm = [vx(idm),vy(idm),zeros(2,1)]; figure, trimesh( facetri,vx, vy, zeros(numv,1), ... 'EdgeColor', 'none', ... 'FaceVertexCData', meantex/255, 'FaceColor', 'interp', ... 'FaceLighting', 'phong' ); zlabel('Z'); view(2); axis equal hold on, plot3(pcon(:,1),pcon(:,2),pcon(:,3),'.-');
第3.3节又弄出一个关于边界点的矩阵B,同样使用matlab的函数eigs计算LC的广义本征向量u,满足LC*u = lambda*B*u。
id_ii = [idcon,idcon+numv]; B = sparse(id_ii,id_ii,1,2*numv,2*numv); eignum = 3; [V,D] = eigs(LC , B, eignum ,'sm'); vx = V(1:numv,k); vy = V(1+numv:end,k); pcon = [vx(idcon),vy(idcon),zeros(numel(idcon),1)]; ptm = [vx(idm),vy(idm),zeros(2,1)]; figure,trimesh( facetri,vx, vy, zeros(numv,1), ... 'EdgeColor', 'none', ... 'FaceVertexCData', meantex/255, 'FaceColor', 'interp', ... 'FaceLighting', 'phong' ); zlabel('Z'); view(2); axis equal hold on, plot3(pcon(:,1),pcon(:,2),pcon(:,3),'.-');
实际上,根据实验,有B参与就会在边缘有重叠现象发生:
参考文章:
[Levy02] Least Squares Conformal Maps for Automatic Texture Atlas Generation
[Desbrun02]Intrinsic Parameterizations of Surface Meshes
[Liu08]A Local/Global Approach to Mesh Parameterization
[Mullen08]Spectral Conformal Parameterization
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-25 13:06
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社