JaveFX TriangleMesh金字塔 - 它有效,但为什么? [英] JaveFX TriangleMesh Pyramid - it works, but why?

查看:168
本文介绍了JaveFX TriangleMesh金字塔 - 它有效,但为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一些文本中轻轻地解释制作一个4面金字塔,如下所示:

  pyramid.getPoints( ).addAll(0,0,0); // 0 = top 
pyramid.getPoints()。addAll(0,height,-hypotenuse / 2); // 1 =最近的
pyramid.getPoints()。addAll(-hypotenuse / 2,height,0); // 2 = leftest
pyramid.getPoints()。addAll(hypotenuse / 2,height,0); // 3 =最远
pyramid.getPoints()。addAll(0,height,hypotenuse / 2); // 4 = rightest

pyramid.getTexCoords()。addAll(0,0);

pyramid.getFaces()。addAll(0,0,2,0,1,0); //左前方
pyramid.getFaces()。addAll(0,0,1,0,3,0); // ???
pyramid.getFaces()。addAll(0,0,3,0,4,0); //右后侧
pyramid.getFaces()。addAll(0,0,4,0,2,0); // ???
pyramid.getFaces()。addAll(4,0,1,0,2,0); //前面的底部三角形???
pyramid.getFaces()。addAll(4,0,3,0,1,0); //底部三角形正确???

它有效,但我不明白。





添加的第二个面具有顶点0, 1,3,所以(参考图)......它将金字塔切成两半。据我所知,这不是一个外在的面孔。
与第4张脸相同,只是现在切片与第2张脸正交。然后是最后两个面,它们应该是构成金字塔方底的三角形。第一个从顶点4到顶点1到顶点2,所以...这是金字塔底座的前三角形(我认为)。所以我希望顶点2,3,4形成金字塔底座的后三角形,但在最后一行代码中我们看到顶点4,3,1,它们(根据我的逻辑)构成了金字塔的直角三角形基础,即不与金字塔底座的前三角形互补。有人可以解释一下这个简单的几何拼图吗?是否有适当的深度资源我可以学习?



很多义务 - 迈克尔

解决方案

正确的顶点编号是(粗略绘制图像的道歉):





因此面孔

 (0,2,1)
(0,1,3)
(0,3,4)
(0,4,2)
(4 ,1,2)
(4,3 ,1)

准确描述你想要的三角形。


Making a 4-sided pyramid is explained 'lightly' in a few texts, as follows:

pyramid.getPoints().addAll(0,0,0); //0 = top
pyramid.getPoints().addAll(0, height, -hypotenuse/2); //1 = closest
pyramid.getPoints().addAll(-hypotenuse/2, height, 0); //2 = leftest
pyramid.getPoints().addAll(hypotenuse/2, height, 0); //3 = furthest
pyramid.getPoints().addAll(0, height, hypotenuse/2); //4 = rightest

pyramid.getTexCoords().addAll(0, 0);

pyramid.getFaces().addAll(0,0,2,0,1,0); //Left front side
pyramid.getFaces().addAll(0,0,1,0,3,0); //???
pyramid.getFaces().addAll(0,0,3,0,4,0); //Right back side
pyramid.getFaces().addAll(0,0,4,0,2,0); //???
pyramid.getFaces().addAll(4,0,1,0,2,0); //Bottom triangle at front???
pyramid.getFaces().addAll(4,0,3,0,1,0); //Bottom triangle right???

It works, but I don't understand it.

The 2nd face added has vertices 0, 1, 3, so (reference figure) ... it slices the pyramid in half. It is not an external face as far as I can tell. Same with the 4th face, only now the slice is orthogonal to the 2nd face. And then the last 2 faces, which should be the triangles making up the square base of the pyramid. The first one goes from vertex 4 to vertex 1 to vertex 2, so ... that is the front triangle of the pyramid base (is what I think). So I expect vertices 2,3,4 to form the back triangle of the pyramid base, but in the last line of code we see vertices 4,3,1, which (according to my logic) make up the right triangle of the pyramid base, i.e. does not complement the front triangle of the pyramid base. Can someone please explain this on-the-face-of-it simple geometric puzzle? And is there a proper indepth resource out there I can study?

Much obliged - Michael

解决方案

The correct numbering of the vertices is (apologies for the crudely-drawn image):

which you can see fairly clearly by plotting vertices 1-4 in the x-z plane:

1: (0, -h/2)
2: (-h/2, 0)
3: (h/2,  0)
4: (0,  h/2)

Thus the faces

(0,2,1)
(0,1,3)
(0,3,4)
(0,4,2)
(4,1,2)
(4,3,1)

describe exactly the triangles you want.

这篇关于JaveFX TriangleMesh金字塔 - 它有效,但为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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