计算4D形状的3D横截面(tesseract) [英] Calculate 3D cross section of 4D shape (tesseract)

查看:114
本文介绍了计算4D形状的3D横截面(tesseract)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,我已经阅读了以下有关计算4D对象的3D相交点的信息:

So far I have read the following on calculating the points of the 3D intersect for a 4D object:

4D横截面的简单实现

如何获取4D网格的3D横截面?

但是,我对发生的事情确实感到困惑.我了解我需要计算4D对象(在我的情况下为tesseract)的每个边缘与3D空间相交的点,然后将计算出的点合并,但是我不确定相交的计算方式如何完成.

However, I am really confused on whats going on. I understand that I need to calculate the point at which each edge of the 4D object (in my case a tesseract) intersects the 3D space and then join the points that were calculated, however I am not sure how the calculation of the intersects would be done.

如果有人可以解释他们将如何计算完整的3D横截面,那将是很好的选择,但是我将对如何计算1个4D边缘的相交感到满意,就像在两个4D点之间的相交处一样.

It would be nice if someone could explain how they would go about calculating the full 3D cross section, however I will be satisfied with how to calculate the intersect of 1 4D edge, as in the intersection between two 4D points.

(不同于我发现的第一个链接中显示的内容,我希望能够在第4轴上的任何w坐标处执行此操作,因此,一种计算方法将3D空间沿w轴的位置保持在思维,以及tesseract本身的位置和方向)

(Unlike what was shown in the first link I found, I want to be able to do this at any w coordinate on the 4th axis, so a way of calculating that keeps the position of the 3D space along the w axis in mind, along with the position and orientation of the tesseract itself)

谢谢

推荐答案

我在这里做过(您的第一个链接是它的重复项)

I did in here (Your first link is its duplicate)

您不仅可以找到横截面,还可以找到带有横截面渲染的C ++ 4D tesseract示例(也没有).

You will find there more than just cross-section and also C++ 4D tesseract example with cross-section rendering (without too).

现在您要问的是如何计算几何形状的边缘与轴关联的4D超平面w = constant之间的交点?这很容易,因为边缘实际上是由两个点p0,p1定义的线,因此您可以为此使用线性插值:

Now what you are asking is how to compute intersection between edge of geometry and axis alligned 4D hyperplane w = constant ? That is easy as edge is line in really defined by two points p0,p1 so you can use linear interpolation for this:

p(t) = p0 + (p1-p0)*t

这将为您提供直线上的任何点,而t = <0,1>是标量线性参数,定义了p(t)在直线上的位置.

this will give you any point in the line while t = <0,1> is scalar linear parameter defining where on the line p(t) is.

p(0) = p0
p(1) = p1
p(0.5) = mid point between p0,p1

现在您只想求解t,所以w等于您的常数,将其称为w_cut作为切割平面.

Now you just want to solve t so the w is equal to your constant let call it w_cut as cutting plane.

p(t).w = w_cut
p0.w + (p1.w-p0.w)*t = w_cut
t = (w_cut-p0.w) / (p1.w-p0.w)

如果t<0,1>间隔内,则边缘与平面相交.如果(p1.w-p0.w)=0整个边缘都在平面上.

if t is inside <0,1> interval the edge intersect your plane. if (p1.w-p0.w)=0 entire edge is in the plane.

现在,如链接的答案中所述,这不涉及拓扑,因此您将获取点和边,但没有有关如何从中构造3D几何的互连信息,因此需要进行深入分析.更好的办法是以四面体的形式组织网格,并检查其三角形的交点而不是仅检查边缘.

Now as mentioned in the linked answer this does not deal with topology so you would obtain points and edges but not inter-connection info on how to construct 3D geometry from them and thorough analysis is needed to do so. So much better is organize your mesh in a form of tetrahedrons and inspecting intersection of its triangles instead of edges alone.

因此,您检查四面体的每个三角形的3个边.每个三角形在相交后将转换为:

So you inspect 3 edges of each triangle of tetrahedron. Each triangle will convert after intersection to:

  1. 无-忽略

  1. nothing - ignore

单点-记住

单边-记住它的2分

整个三角形-记住它的3个点

whole triangle - remember its 3 points

删除重复的点,然后在相交后应该有一个四面体的点列表(0,34点),这样:

Remove duplicate points and after that you should have a list of points (0,3 or 4 points) of the tetrahedron after intersection so:

  1. 0点-忽略

3点-渲染三角形

4点-渲染四面体

还有12点的可能性,但是您可以忽略它们,除非您希望同时渲染无限细的线和点.有关更多信息,请在上面的链接中检查此功能:

there is also a possibility for 1 and 2 points but you can ignore them unless you want to render also infinitely thin lines and points in which case render them. For more info inspect this function in the link above:

void mesh4D::draw_cut(double w_cut)

它的功能与我在此处所述的完全相同.唯一的问题是我们失去了多边形缠绕.但这可以通过在normal_of_triangle与矢量center_of_triangle - center_of_tetrahedron之间做点来修复,如果符号为负,则法线指向内部.因此,如果您知道如果方向错误,您想以哪种方式指向三角形的逆序.

it does exactly as I described here. The only problem with this is that we lose the polygon winding. But that can be repaired by doing dot between the normal_of_triangle and vector center_of_triangle - center_of_tetrahedron if the sign is negative the normal is pointing inward. So if yo know which way you want to point reverse order of triangle points if wrong direction is present.

这篇关于计算4D形状的3D横截面(tesseract)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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