关于如何从网格中计算候选三角形 [英] about how to calculate candidate triangles from a mesh

查看:107
本文介绍了关于如何从网格中计算候选三角形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试计算三角形网格中一个点和三角形之间的距离,用于CFD软件的碰撞处理。我已经编码了特定三角形和点之间的最小距离计算。现在问题是找到候选三角形(用于计算可能碰撞的给定点距离的三角形)。我可以做什么来找到候选三角形?是否有算法? CFD软件在这些情况下做了什么。他们实际上找到候选三角形还是找到了网格中所有三角形的点距离?

请帮助..

I am trying to calculate the distance between a point and the triangles in the triangular mesh for collision handling for a CFD software.I have already coded for the minimum distance calculation between a particular triangle and point.Now the problem is to find the candidate triangles(the triangles with which i calculate the distance from the given point for possible collision).What can i do to find the candidate triangles?Is there an algorithm for it? what do the CFD softwares do in these cases.Do they actually find the candidate triangles or they find the distances of the point from all the triangles in the mesh?
please help..

推荐答案

为制作三角形的三个点和粒子的中心设定x,y,z线。如果你的粒子有一个体积,那么你将半径添加到中心,找到最大值框,看看你的三角形是否在那里。
Presume x,y,z cords, for the three point that make the triangle, and the center of your particle. If your particle has a volume, then you add the radius to the center, find the maxima box, and the see if your triangle is in there.


首先,你需要检查每个三角形。您可以通过构建一个将3D空间划分为可管理网格单元的八叉树来加快检查速度。 (参见 http://en.wikipedia.org/wiki/Octree [ ^ ]或google for tutorials and code how to use it



对于每个八叉树单元格,您可以预先计算哪个三角形与其相交,哪些不相交。然后,当你想要检查一个点时,只需检查它所在的八字形单元格,然后继续检查你知道哪个三角形与同一个单元格相交:如果你很好地构建了八叉树,那么可能只有3-5个三角形你真的需要检查。



如果你想检查一个点是在实体内还是在外面,你需要在这一点上定义一条线。如果该点在移动,您可以使用当前的移动方向来定义线的方向;这将提供额外的信息。否则方向无关紧要,但如果使用其中一个轴,e的计算将更容易。 G。 (1,0,0)。



对于这一行,确定它击中的八叉树的所有单元格。然后,对于每个单元格,检查哪些三角形与单元格相交。对于这些三角形,将线与三角形相交,然后检查交点实际上是否在三角形的边界内。



计算沿线起点一侧的交点数。如果这个数字是奇数,那么你的点就在实体内。如果是偶数,则它在外面。
First, you need to check every triangle. You can speed up that check by building an octree that partitions your 3D-space into managable grid cells. (see http://en.wikipedia.org/wiki/Octree[^] or google for tutorials and code how to use it)

For each octree cell, you can precalculate which triangle intersects it and which don't. Then, when you want to check a point, just check which octree cell it is in, and then go on to check which triangles you know intersect that same cell: if you built your octree well, there may only be 3-5 triangles that you actually need to check.

If you want to check whether a point is inside a solid or outside, you need to define a line through that point. If the point is moving, you may use the current direction of movement to define the direction of the line; this will provide additional information. Otherwise the direction is irrelevant, but the calculations will be easier if you use one of the axes, e. g. (1,0,0).

For this line, determine all cells of the octree that it hits. Then, for each cell, check which triangles intersect the cell. For these triangles, intersect the line with the triangle, then check whether the point of intersection actually is inside the boundaries of the triangle.

Count the number of intersection points that lie on one side of your starting point along the line. If that number is odd, then your point is inside the solid. If it is even, then it is outside.


这篇关于关于如何从网格中计算候选三角形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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