找到“脚” 3D 空间中三角形的高
一些背景故事,目前我正在努力在 Expression2 中实现三角形渲染系统来创建 .obj 模型。
我目前遇到的限制之一是我无法以老式方式创建多边形,而是必须创建等腰三角形,并将其部分切掉。
我当前的问题是我正在研究如何以及在哪里放置等腰三角形。 (我已经整理好了角度等其他所有内容)
http://img22.imageshack.us /img22/3251/trianglem.png (忽略蓝色三角形)
v0、v1 和 v2 是 3D 空间中的 3 个坐标,它们构成所需的三角形。
红线是从 v1 出发并沿三角形平面与斜边成直角相交的线。我希望计算 p1,它本质上是 v1 和高度与斜边(又称“脚”)相交处的中间点。
我目前的尝试无论如何都不起作用:
Dot = (v0-v1):dot(v0-v2)
P1 = v0 + Dot*((v0-v2):normalized())
我感谢任何帮助。谢谢。
A little backstory, currently I'm working on implementing a triangle rendering system in Expression2 to create .obj models.
One of the limitations I'm currently experiencing is that I cannot create polygons the old-fashioned way, rather, I'm having to create Isosceles triangles, and cut part of it off.
My current problem is that I'm working on how and where to place the Isosceles triangle. (I have everything else like angle already sorted out)
http://img22.imageshack.us/img22/3251/trianglem.png
(Ignore the blue triangle)
v0, v1 and v2 are 3 co-ordinates in 3D space which make up the desired triangle.
The red line is a line that goes from v1 and meets the hypotenuse at right-angles along the plane of the triangle. I wish to calculate p1, which is essentially a point exactly half way between v1 and where the altitude meets the hypotenuse, aka the 'foot'.
My current attempt doesn't work what-so-ever:
Dot = (v0-v1):dot(v0-v2)
P1 = v0 + Dot*((v0-v2):normalized())
I appreciate any help. Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道你使用的语言,我的理解是,你在空间的某个地方有一个带有这些特定线条的特定三角形,并且你想要某个点的确切位置。
如果这就是你想要的,我想一个好的方法是(用不存在的语言......):
px = v0.x - v1.x
py = v0.y + v1.y / 2
pz = v0.z + v1.z / 2
我希望它有帮助..很抱歉在我完全不知道的事情上发布答案,只是想提供帮助 =)
I have no clue on the language you're using, What i undersood is that you have a certain triangle with these certain lines in somewhere in a space and you want the exact position of a certain dot.
If that is what you want, I guess a good approach would be (in nonexistant language..):
p.x = v0.x - v1.x
p.y = v0.y + v1.y / 2
p.z = v0.z + v1.z / 2
I hope it helps.. sorry for posting an answer on something I absolutely don't know about, just trying to help =)