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

查看:257
本文介绍了如何选择一个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天全站免登陆