If your model gives you appearance-oriented normals, you can re-sort the faces of your model so that Matlab can correctly calculate its own normals. The following function works if you have triangular faces and external oriented normals:
function [FaceCor,nnew]=SortFaces(Faces,Normals,Vertices) FaceCor=Faces; nnew=Normals*0; for jj=1:size(Faces,1) v1=Vertices(Faces(jj,3),:)-Vertices(Faces(jj,2),:); v2=Vertices(Faces(jj,2),:)-Vertices(Faces(jj,1),:); nvek=cross(v2,v1); %calculate normal vectors nvek=nvek/norm(nvek); nnew(jj,:)=nvek; if dot(nvek,Normals(jj,:))<0 FaceCor(jj,:)=[Faces(jj,3) Faces(jj,2) Faces(jj,1)]; nnew(jj,:)=-nvek; end end
If your FEM model does not give you outward oriented normals, one way would be to reconstruct the surface using, for example, a peel algorithm that gives you directionally directed or correctly oriented patches.
EDIT: Since you have no normals, the only solution that comes to my mind is to restore the surface. This implementation of the cortex algorithm worked well for me in the past. All you have to do is:
[FacesNew,NormalsNew]=MyRobustCrust(Vertices);
If I remember correctly, FacesNew is not counterclockwise oriented yet, but you can use the SortFaces algorithm that I wrote above to fix this, since now you have correctly oriented face normals, i.e. run:
[FaceCor,~]=SortFaces(FacesNew,NormalsNew,Vertices)
If you use Matlab reducepatch (e.g. reducedmodel=reducepatch(fullmodel,reduction); ) to reduce the number of vertices, you will have to restore the surface again, since reducepatch does not seem to maintain the correct orientation of the patches.