发现在三维三角形的面的法线角度,给出的坐标的顶点 [英] Find the normal angle of the face of a triangle in 3D, given the co-ordinates of its vertices

查看:389
本文介绍了发现在三维三角形的面的法线角度,给出的坐标的顶点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如你可以从这张截图,我想使物理引擎的一些成熟的我的工作,但我遇到了一定的问题:我需要能够找出可以看到弥补这个网格三角形中的任何一个角度,这样我就可以工作缩小该三角

As you may be able to tell from this screenshot, I am trying to make a physics engine for a platformer I am working on, but I have run into a definite problem: I need to be able to find out the angle of any one of the triangles that you can see make up this mesh, so that I can work out the rotation and therefore angular acceleration of the player on that triangle.

我可以用我创建找到全取3分的任何三角形玩家所接触的位置的算法,但我不知道如何使用这些点来制定出三角形的旋转。

I can use an algorithm that I created to find the locations of all 3 points of any triangle that the player is in contact with, but I don't know how to use those points to work out the rotation of the triangle.

通过旋转,我指的是正常的方向远离中心面的,即,角度,一个人会靠在如果站在该表面。可有人拿出一系列方程,将允许要解决这个问题呢?

By the rotation, I mean the direction of the normal away from the centre of the face, i.e., the angle at which a person would be leaning if they stood on that surface. Can someone come up with a series of equations that will allow for this problem to be solved?

推荐答案

如果你把两个向量的叉积:

If you take the cross product of the two vectors:

p1 - p0

p2 - p0

其中, P0 P1 P2 三三角形的顶点,你会得到正常的。三角形被认为是指向你,如果顶点是相对于它的正常向外顺时针排序。这就是所谓的左手定则。想象一下,牵着你的左手手指从 P0 卷曲到 P1 ,拇指伸出面对的方向正常:

where p0, p1 and p2 are three vertices of the triangle, you'll get the normal. A triangle is considered to be pointing towards you if the vertices are ordered clockwise with respect to its outward normal. This is called the left hand rule. Imagine holding your left hand with your fingers curled from p0 to p1, your thumb sticks out in the direction of the face normal:

这篇关于发现在三维三角形的面的法线角度,给出的坐标的顶点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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