如何选择stl模型或三角形网格的前三角形? [英] How to select the front triangles of a stl model or a triangular mesh?

查看:57
本文介绍了如何选择stl模型或三角形网格的前三角形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个stl模型(三角网格).我想使用可调整的矩形来进行选择.如下图.

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,有一个 方法来做到这一点.首先使用特定且独特的颜色渲染每个三角形.然后,检索所选矩形中像素的颜色,并将这些颜色转换回原始标识符.选择了拥有 id 的三角形.我认为这种方法可行但效率低下.

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?

推荐答案

这个过程被称为挑选",如果你去搜索它,你的运气会更好.基本上,选定的矩形与视锥体创建了一个相交体积.相交体积之外的基元可以被轻易丢弃.需要以某种方式测试体积内的基元,以查看哪些是可见的".实现拣选的方式有多种,其中基于颜色的拣选只是一种选择.

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.

这篇关于如何选择stl模型或三角形网格的前三角形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆