How to select the front triangles of a stl model or a triangular mesh?

淺唱寂寞╮ 提交于 2019-12-09 23:01:13

问题


There is a stl model(triangular mesh). I want to use a adjustable, rectangular shape to make selections. Like below picture.

But I don't want the triangles on the other side are selected. That's to say only the visible triangles in the rectangular can be selected.

AFAIK, there is a method to do this. First render each triangle with a specific and unique color. Then, retrieve the color of the pixels in the select rectangular, and convert those colors back to the original identifier. The triangle own the id is selected. I think this method is workable but inefficient.

So is there any other better method to do this selection? More elegant and efficient one?


回答1:


This process is called 'picking' and you will have better luck if you search for that. Basically the selected rectangle creates an intersection volume with the view frustum. Primitives outside that intersection volume can be trivially discarded. Primitives inside the volume need to be tested somehow to see which ones are "visible". There are various ways to implement picking, of which color-based picking is just one option.



来源:https://stackoverflow.com/questions/24532158/how-to-select-the-front-triangles-of-a-stl-model-or-a-triangular-mesh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!