patiludayv
(Uday Patil)
January 10, 2023, 7:35am
1
Hi all,
I have an STL file. When I open it in STLReader live example (vtk.js ), 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
finetjul
(Julien Finet)
January 10, 2023, 7:46am
2
You can flip the normals, e.g. facet normal -1 0 0 → facet normal 1 0 0
patiludayv
(Uday Patil)
January 10, 2023, 9:31am
3
Thanks for the reply.
But what is the decision criteria? How do I know whether I need to flip the normal or not?
finetjul
(Julien Finet)
January 10, 2023, 9:46am
4
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]