确定 SAT 分离轴定理中的边缘法线
SAT 算法要求您找到每个形状的每个边缘的法线(本质上是垂直于边缘向量的向量)以用作分离轴。这可以非常简单地完成...
(x,y) => (-y,x)
或
(x,y)=> (y,-x)
SAT 算法中应该使用哪个?这本质上是一个应该使用左手法线还是右手法线的问题。使用哪个会有所不同吗?应该只使用正常的左手还是右手?是否应该根据不同的情况而改变?
The SAT algorithm requires you to find the normal of each edge of each shape (essentially a vector perpendicular to the edge vector) to be used as the separating axes. This can be done very simply...
(x,y) => (-y,x)
OR
(x,y) => (y,-x)
Which should be used in the SAT algorithm? This is essentially a question of whether the left hand normal or the right hand normal should be used. Will it make a difference which is used? Should only the left or right hand normal be used? Should this change with different situations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只要对每个面使用相同的约定就没关系,因为法线用于计算投影并比较它们:
(!p1.overlap(p2))
的结果将两个公式相同。华泰
It doesn't matter as long as you use the same convention for every face, because the normals are used to calculate projections, and comparing them:
The result of
(!p1.overlap(p2))
will be the same with both formulas.HTH
法线应始终从边缘指向。只有两种可能的解决方案,您已经想到了。其中一个是对的,另一个是错误的。
哪一种是正确的取决于两件事:
The normal should always point out from the edge. There are only two possible solutions, which you figured out. One of them is right and the other is wrong.
Which one is correct depends on two things: