Always getting STL surface color as black

Hi all,

I have an STL file. When I open it in STLReader live example (https://kitware.github.io/vtk-js/examples/STLReader.html), It always shows in black color. Because of which, I am not able to apply color on that surface.

Is there is any VTK function is available which will return it’s actual color (which is black). So that I will pop up warning message to the users.

Any help is highly appreciated.
Thanks

STL file content:

solid xmax
facet normal -1 0 0
outer loop
vertex 11.5 -4.5 1
vertex 11.5 -4.5 0
vertex 11.5 4.5 1
endloop
endfacet
facet normal -1 0 0
outer loop
vertex 11.5 4.5 0
vertex 11.5 4.5 1
vertex 11.5 -4.5 0
endloop
endfacet
endsolid xmax

You can flip the normals, e.g. facet normal -1 0 0facet normal 1 0 0

Thanks for the reply.

But what is the decision criteria? How do I know whether I need to flip the normal or not?

It depends on your point ordering, the normal should follow trigonometric ordering of the points.
So:

vertex 11.5 -4.5 1
vertex 11.5 -4.5 0
vertex 11.5 4.5 1

→ normal = [1, 0, 0]

But

vertex 11.5 -4.5 1
vertex 11.5 4.5 1
vertex 11.5 -4.5 0

→ normal = [-1, 0, 0]