Plot3d surface color wrongly oriented if surface is directed along x,y or z axis
Reported by Pierre Payen
plot3d_surface_color_bug_Scilab.6.0.0.png (18.64 KB, image/png)
output of the script attached in bug report
BUG DESCRIPTION:
----------------
Happens is 6.0.0 : When a polygone is defined such that an axis (x,y or z) is orthogonal to it, then the 'outside' is always the side facing the increasing values of this axis. Meaning that two plygones defined by nodes but in opposite order will show the same outside surface, when they should be inverted. Rotating the polygone by a small angle fix the bug: it only happens when with faces perfectly orthogonal to the axis.
ERROR LOG:
----------
None: graphical
HOW TO REPRODUCE THE BUG:
-------------------------
figure(1)
set(gcf(),'background',-2)
cr=color('red') // color of the outside surface
P1 = [0,0,0] //
P2 = [0,1,0]
P3 = [1,0,0]
F1 = [P1;P2;P3] // defining surface clockwise
F2 = [P1;P3;P2] // counterclockwise
subplot(2,2,1)
plot3d(F1(:,1),F1(:,2),list(F1(:,3),cr*ones(F1(:,3))))
xstring(F1(:,1),F1(:,2),['P1','P2','P3'])
title('surface is [P1,P2,P3] with z_P3=0')
set(gca(),'data_bounds',[0,1,0,1,-1,1])
subplot(2,2,2)
plot3d(F2(:,1),F2(:,2),list(F2(:,3),cr*ones(F2(:,3))))
xstring(F2(:,1),F2(:,2),['P1','P3','P2'])
title('Error: surface is [P1,P3,P2] with z_P3=0')
set(gca(),'data_bounds',[0,1,0,1,-1,1])
subplot(2,2,3)
plot3d(F2(:,1),F2(:,2),list(F2(:,3)+[0;0;10^-7],cr*ones(F2(:,3))))
xstring(F2(:,1),F2(:,2),['P1','P3','P2'])
title('surface is [P1,P3,P2] with 10^-7 <= |z_P3|')
set(gca(),'data_bounds',[0,1,0,1,-1,1])
subplot(2,2,4)
plot3d(F2(:,1),F2(:,2),list(F2(:,3)+[0;0;10^-8],cr*ones(F2(:,3))))
xstring(F2(:,1),F2(:,2),['P1','P3','P2'])
title('Error: surface is [P1,P3,P2] with |z_P3| <= 10^-8')
set(gca(),'data_bounds',[0,1,0,1,-1,1])
OTHER INFORMATION:
------------------
If the tilt is too small, surface has no color.