Home > vbmeg > external > iso2mesh > mesheuler.m

mesheuler

PURPOSE ^

SYNOPSIS ^

function [X,V,E,F]=mesheuler(face)

DESCRIPTION ^

 [X,V,E,F]=mesheuler(face)

 Euler's charastistics of a mesh

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
   face: a closed surface mesh

 output:
   X: Euler's charastistics
   V: number of vertices 
   E: number of edges
   F: number of faces

 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [X,V,E,F]=mesheuler(face)
0002 %
0003 % [X,V,E,F]=mesheuler(face)
0004 %
0005 % Euler's charastistics of a mesh
0006 %
0007 % author: Qianqian Fang, <q.fang at neu.edu>
0008 %
0009 % input:
0010 %   face: a closed surface mesh
0011 %
0012 % output:
0013 %   X: Euler's charastistics
0014 %   V: number of vertices
0015 %   E: number of edges
0016 %   F: number of faces
0017 %
0018 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0019 %
0020 
0021 % mesh vertices
0022 V=length(unique(face));
0023 
0024 % mesh total edges
0025 E=face(:,[1,end]);
0026 for i=1:size(face,2)-1
0027     E=[E;face(:,[i,i+1])];
0028 end
0029 E=size(unique(sortrows(sort(E,2)),'rows'),1);
0030 
0031 % mesh faces
0032 F=size(face,1);
0033 
0034 % Euler's formula, X=2-2*g and g is genus
0035 X=V-E+F;

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005