渐进插值的LOOP 曲面细分
来源:互联网 发布:快递打印软件免费版 编辑:程序博客网 时间:2024/05/21 12:41
本文的算法来源于
哈尔滨理工大学孙立镌,鞠志涛的论文——渐进插值的LOOP 曲面细分
摘要
目前很多细分方法都存在不能用同一种方法处理封闭网格和开放网格的问题。对此,一种新的基于插值技术的LOOP 曲面细分方法,其主要思想就是给定一个初始三角网格
插值细分的几何细分过程
基于渐进插值的LOOP 曲面细分在封闭网格情况下的概念如下: 给定一个三维三角网格
角网格要首先用Delaunay 三角化算法对网格进行处理。对LOOP 细分曲面的
考虑
所有顶点
所有
将这个距离与
这个过程产生了一系列控制网格
个结论。
注意到上述迭代过程的主要工作是计算
联立约束方程式(1) (2) (3) 可以求出
程序实现及效果
程序实现
我修改了之前的loop细分程序,新的程序命名为adloopsub.m
function [newVertices, newFaces] = adloopsub(vertices, faces) % Mesh subdivision using the Loop scheme. % % Dimensions: % vertices: 3xnVertices % faces: 3xnFaces % % Author: lafengxiaoyu global edgeVertice; global newIndexOfVertices; newVertices = vertices; [originver, orifaces] = origin(); nVertices = size(vertices,2); nFaces = size(faces,2); edgeVertice = zeros(nVertices, nVertices, 3); newDeff=vertices; newIndexOfVertices = nVertices; % ------------------------------------------------------------------------ % % create a matrix of edge-vertices and the new triangulation (newFaces). % computational complexity = O(3*nFaces) % % * edgeVertice(x,y,1): index of the new vertice between (x,y) % * edgeVertice(x,y,2): index of the first opposite vertex between (x,y) % * edgeVertice(x,y,3): index of the second opposite vertex between (x,y) % % 0riginal vertices: va, vb, vc, vd. % New vertices: vp, vq, vr. % % vb vb % / \ / \ % / \ vp--vq % / \ / \ / \ % va ----- vc -> va-- vr --vc % \ / \ / % \ / \ / % \ / \ / % vd vd for i=1:nFaces [vaIndex, vbIndex, vcIndex] = deal(faces(1,i), faces(2,i), faces(3,i)); addEdgeVertice(vaIndex, vbIndex, vcIndex); addEdgeVertice(vbIndex, vcIndex, vaIndex); addEdgeVertice(vaIndex, vcIndex, vbIndex); end; % ------------------------------------------------------------------------ % % adjacent vertices (using edgeVertice) adjVertice{nVertices} = []; for v=1:nVertices for vTmp=1:nVertices if (v<vTmp && edgeVertice(v,vTmp,1)~=0) || (v>vTmp && edgeVertice(vTmp,v,1)~=0) adjVertice{v}(end+1) = vTmp; end; end; end; % ------------------------------------------------------------------------ % % new positions of the original vertices for v=1:nVertices k = length(adjVertice{v}); adjBoundaryVertices = []; for i=1:k vi = adjVertice{v}(i); if (vi>v) && (edgeVertice(v,vi,3)==0) || (vi<v) && (edgeVertice(vi,v,3)==0) adjBoundaryVertices(end+1) = vi; end; end; beta = 3/(11-8*(3/8+((3/8 + 1/4*cos(2*pi/k))^2))); newVertices(:,v) = (beta)*vertices(:,v) + (1-beta)/k*sum(vertices(:,(adjVertice{v})),2); newDeff(:,v)=originver(:,v)- newVertices(:,v); newVertices(:,v)=vertices(:,v)+newDeff(:,v); end; newFaces=faces;end % ---------------------------------------------------------------------------- % function vNIndex = addEdgeVertice(v1Index, v2Index, v3Index) global edgeVertice; global newIndexOfVertices; if (v1Index>v2Index) % setting: v1 <= v2 vTmp = v1Index; v1Index = v2Index; v2Index = vTmp; end; if (edgeVertice(v1Index, v2Index, 1)==0) % new vertex newIndexOfVertices = newIndexOfVertices+1; edgeVertice(v1Index, v2Index, 1) = newIndexOfVertices; edgeVertice(v1Index, v2Index, 2) = v3Index; else edgeVertice(v1Index, v2Index, 3) = v3Index; end; vNIndex = edgeVertice(v1Index, v2Index, 1); return; end
其中origin.m用来读取数据
function [ vertices, faces ] = origin()%ORIGIN 此处显示有关此函数的摘要% 此处显示详细说明%faces =load('C:\Users\Admin\Documents\MATLAB\face.txt');%faces=faces+1;%faces=faces';%vertices =load('C:\Users\Admin\Documents\MATLAB\ver.txt');%vertices=vertices';[vertices, faces ]= obj__read( 'bunny_200.obj' );%vertices=[-1 -1 0;-1 1 0;1 1 0]';%faces=[1 2 3]';end
效果
执行以下测试代码
[ vertices, faces ]=origin();faces1=faces;vertices1=vertices;%for i=1:5%[vertices, faces] = adloopsub(vertices, faces);%endfor i=1:3[vertices, faces] = loopSubdivision(vertices, faces);endtrimesh(faces', vertices(1,:), vertices(2,:), vertices(3,:),'LineWidth',1,'EdgeColor','k');alpha(0.0); hold on;trimesh(faces1', vertices1(1,:), vertices1(2,:), vertices1(3,:),'EdgeColor','r');alpha(0.0);obj_write('bunny1.obj',vertices,faces);
读入由200个点组成的兔子模型,分别进行loop细分和渐进loop细分,效果如下
loop细分三次后的兔子模型
渐进插值后loop三次的兔子模型
可以明显看得出来效果好一些
参考文献
[1] LOOP C. Smooth subdivision surfaces based on triangles[D]. Utah:University of Utah,1987.
[2] HALSTEAD M,KASS M,DEROSE T. Efficient,fair interpolation
using Catmull-Clark surfaces[C]/ /Proc of the 20th SIGGRAPH.1993: 47-61.
[3] ZHENG Jian-min,CAI Y Yi-yu. Interpolation over arbitrary topology meshes using a two-phase subdivision scheme[J]. IEEE Trans on Visualization and Computer Graphics,2006,12( 3) : 301-310.
[4] LAI Shu-hua,CHENG F. Similarity based interpolation using Catmull-Clark subdivision surfaces[J]. The Visual Computer,2006,22( 9) : 865-873.
[5] ZORIN D,SCHRODER P,DEROSE T. Subdivision for modelingand animation[C]/ /Proc of SIGGRAPH. 2006: 30-50.
[6] CHENG Fu-hua,FAN Feng-tao,LAI Shu-hua,et al. LOOP subdivision surface based progressive interpolation[J]. Journal of Computer Science and Technology,2009,24( 1) : 39-46.
- 渐进插值的LOOP 曲面细分
- Direct2D + 曲面细分(渐进)
- Direct2D渐进曲面细分
- 几个loop细分的例子
- 二面角自适应的loop细分
- Unity3d 使用DX11的曲面细分
- 离散数据点的曲面插值Matlab示例程序
- 基于bSpline插值的直纹面和旋转曲面
- DirectX11 曲面细分阶段
- Tessellation(曲面细分技术)
- Matlab曲面拟合和插值
- B样条曲面插值算法
- Matlab曲面拟合和插值
- 函数插值生成波动率曲面
- Matlab曲面拟合和插值
- Matlab曲面拟合和插值
- OpenGL 4.0的Tessellation Shader(细分曲面着色器)
- DirectX 11 Tessellation (曲面细分)—什么是 Tessellation (曲面细分) ?它为什么能够起到如此重要的作用?
- 爱思华宝收购 Synchronoss 技术公司旗下 Mirapoint 软件业务
- Android横竖屏切换引起问题的小结
- Java多态性理解
- python精简总结
- Linux任务管理
- 渐进插值的LOOP 曲面细分
- Centos6下nmon 脚本监控服务器系统性能
- IT名企常见面试题总结之Java篇(一)
- Caffe 学习笔记(视觉层(Vision Layers)及参数)
- 什么是 TensorFlow?
- 一些资料网址 备用
- 给调皮的AssetBundle加上面向对象式加载调试管理
- JQuery获取Url参数
- Hadoop伪分布式环境搭建