scilabtopologygraphics3d

Coloring the reverse side of mesh tiles in Scilab


In plot3d2 and similar graphic functions of Scilab, is there a way to set the colour of the back (reverse, flip, inner) side of facets?

I'm trying to draw a part of a (rather crude) torus, and the result is OK except for one row of facets. I suppose that, because of the way I generate the mesh, those facets are oriented differently - whatever algorithm renders them on the screen follows their perimeter in the opposite direction compared to others.

Instead of poring over my code to try to mend the topology of my mesh, I'd rather make sure the facet orientation doesn't matter - just set both sides to my colour. It will also improve the looks of the ends of my torus, where the inside shows and, again, is in a colour I didn't ask for.

But, hard as I search the documentation, I cannot find any mention of the flip side of mesh facets.

Any clues?

In a blue torus-segment-shaped mesh, the outside of one row of facets and the inside of others are red.


Solution

  • The backface color is named "hiddencolor" in the properties of a surface entity (see https://help.scilab.org/docs/6.1.1/en_US/surface_properties.html). It can be changed a posteriori, for example:

    [X,Y]=meshgrid(-1:0.5:1);
    plot3d2(X,Y,X.^2-2*Y.^2)
    gce().hiddencolor=color("red")
    

    enter image description here You can assign -1 (instead of above) to use the same color as the front facing patches.

    However, if all your patches are facing wrongly, you can also transpose all your matrices in the plot3d2 call:

    [X,Y]=meshgrid(-1:0.5:1);
    plot3d2(X',Y',(X.^2-2*Y.^2)')
    gce().hiddencolor=color("red")
    

    enter image description here