Home > bioelectromagnetism > sphere_tri_testscript.m

sphere_tri_testscript

PURPOSE ^

script to test the sphere triangulation

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 script to test the sphere triangulation
 order of vertices in faces is illustrated with RGB

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % script to test the sphere triangulation
0002 % order of vertices in faces is illustrated with RGB
0003 
0004 % radius = 1, clockwise vertices in faces
0005 FV = sphere_tri('ico',3,[],0);
0006 % radius = 1, counterclockwise vertices in faces
0007 %FV = sphere_tri('ico',3,[],1);
0008 
0009 facecolor = [.7 .7 .7];
0010 figure
0011 Hp = patch('faces',FV.faces,'vertices',FV.vertices,...
0012     'facecolor',facecolor,'facealpha',0.8,'edgecolor',[.8 .8 .8]); 
0013 camlight('headlight','infinite'); daspect([1 1 1]); axis vis3d; axis off
0014 material dull; rotate3d
0015 hold on
0016 
0017 f = 10;
0018 vertex_index1 = FV.faces(f,1);
0019 vertex_index2 = FV.faces(f,2);
0020 vertex_index3 = FV.faces(f,3);
0021 vertex1 = FV.vertices(vertex_index1,:);
0022 vertex2 = FV.vertices(vertex_index2,:);
0023 vertex3 = FV.vertices(vertex_index3,:);
0024 
0025 plot3(vertex1(1),vertex1(2),vertex1(3),'ro')
0026 plot3(vertex2(1),vertex2(2),vertex2(3),'go')
0027 plot3(vertex3(1),vertex3(2),vertex3(3),'bo')
0028 
0029 vertNormals = get(Hp,'vertexnormals');
0030 
0031 quiver3(vertex1(1),vertex1(2),vertex1(3),...
0032     vertNormals(vertex_index1,1),vertNormals(vertex_index1,2),vertNormals(vertex_index1,3));
0033 
0034 view(3)
0035 rotate3d

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003