5.0

5.0 | 1 rating Rate this file 7 Downloads (last 30 days) File Size: 2.86 KB File ID: #28277
image thumbnail

subtri

by Kevin Moerman

 

23 Jul 2010 (Updated 30 Sep 2010)

Sub-triangulates patch format data. Can be used to increase the density of triangulated data

| Watch this File

File Information
Description

[Fs,Vs]=subtri(F,V,n)

Sub-triangulates the triangles defined by the patch format data F (faces) and V (vertices). Can be used to increase the density of triangulated data or to triangulate the icosahedron to create geodesic sphere triangulations with desired density.

Creates n addition points on the edges of the initial triangles, thus it creates (n+1).^2 triangles per original triangle. No double points are introduced.

%% EXAMPLE
[X,Y] = meshgrid(linspace(-10,10,15));
Z = sinc(sqrt((X/pi).^2+(Y/pi).^2));
F = delaunay(X,Y); V=[X(:) Y(:) Z(:)]; C=mean(Z(F),2);

n=2;
[Fs,Vs]=subtri(F,V,n);
Vs(:,3)=sinc(sqrt((Vs(:,1)/pi).^2+(Vs(:,2)/pi).^2)); Z=Vs(:,3);Cs=mean(Z(Fs),2);

figure('units','normalized','Position',[0 0 1 1],'Color','w'); colordef('white');
subplot(1,2,1);patch('Faces',F,'Vertices',V,'FaceColor','flat','CData',C,'FaceAlpha',0.5,'EdgeColor','k','LineWidth',2); hold on;
axis tight; axis square; grid on; hold on; view(3); axis off;
title('Original','FontSize',20);
subplot(1,2,2);patch('Faces',Fs,'Vertices',Vs,'FaceColor','flat','CData',Cs,'FaceAlpha',0.5,'EdgeColor','k','LineWidth',0.5); hold on;
axis tight; axis square; grid on; hold on; view(3); axis off;
title(['n=',num2str(n)],'FontSize',20);

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
28 Jul 2010 Kevin Moerman

Will be updated shortly. Currently requires missing function and filtering of double points using "unique" is not reliable.

29 Jul 2010 Kevin Moerman

Updated 28/07/2010

28 Sep 2010 M P  
Please login to add a comment or rating.
Updates
28 Jul 2010

Fixed instability due to "unique" function. Removed dependency on linspacen function which I did not upload.

30 Sep 2010

Fixed normal direction and reference to missing function

Tag Activity for this File
Tag Applied By Date/Time
triangulation Kevin Moerman 23 Jul 2010 10:17:46
signal processing Kevin Moerman 23 Jul 2010 10:17:46
data exploration Kevin Moerman 23 Jul 2010 10:17:46
geodesic Kevin Moerman 23 Jul 2010 10:17:46
interpolation Kevin Moerman 23 Jul 2010 10:17:46

Contact us at files@mathworks.com