Skip to content
Snippets Groups Projects
Commit 06fcfbb7 authored by Sebastien Herbert's avatar Sebastien Herbert
Browse files

Corrects curve loading function to always face upward

Ensures that the majority of the faces are facing upward
parent fa78468e
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,15 @@ end
% Calculate normals of the faces
[dataCurv.normalV,dataCurv.normalF] = compute_normal(dataCurv.vertices,dataCurv.faces);
% enforce that the normals are upward, by ensuring that most normals are
% upward
if sum( dataCurv.normalF( 3 , : ) < 0 ) > size( dataCurv.normalF , 2 ) / 2
% flip
dataCurv.normalV = -dataCurv.normalV;
dataCurv.normalF = -dataCurv.normalF;
end
end
......@@ -51,10 +60,6 @@ dataCurv = {};
dataCurv.faces = tri;
dataCurv.vertices = pointMat; % => vertices are pushed in 3D
dataCurv = reducepatch(dataCurv,PARAMS.maxFaces,'verbose'); % reduce mesh size to a more
[dataCurv.normalV,dataCurv.normalF] = compute_normal(dataCurv.vertices,dataCurv.faces);
% patch('Faces', fv.faces, 'Vertices', fv.vertices, 'FaceVertexCData', fv.vertices(:,3), ...
% 'FaceColor', 'interp', 'LineStyle', 'None');
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment