如何检索 ARMeshGeometry 给定面的法线?
给定一个 ARMeshAnchor 'meshAnchor',我可以检索它的几何形状和面:
let geometry = meshAnchor.geometry
let faces = geometry.faces
var i = Int(0)
while i < faces.count
{
//??? get the normal of faces[i]
i = i+1
}
如何检索 faces[i] 的世界坐标中的法线?
每张脸有 1 个正常吗?每个三角形的每个顶点?或每个网格的顶点?
根据苹果公司的说法: https://developer.apple.com/documentation/arkit/ armeshgeometry/3516923-法线
var 法线: ARGeometrySource { get }
= 定义每个面的外侧方向的射线
given a ARMeshAnchor 'meshAnchor', i can retrieve its geometry and faces :
let geometry = meshAnchor.geometry
let faces = geometry.faces
var i = Int(0)
while i < faces.count
{
//??? get the normal of faces[i]
i = i+1
}
how can I retrieve the normal in world coordinates of faces[i] ?
Is there 1 normal per face ? per vertex of each triangle ? or per each vertex of the mesh ?
According to Apple : https://developer.apple.com/documentation/arkit/armeshgeometry/3516923-normals
var normals: ARGeometrySource { get }
= Rays that define which direction is outside for each face
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我的解决方案。我使用了面几何体的网格锚点中的 int32。该解决方案运行时应该不会出现错误。我能够得到正确的解决方案。就像我通过使用场景理解创建的网格表面进行测试一样,然后获取地板上的网格表面,它返回 0,1,0(y 是向上方向),这是正确的!顺便说一句,我使用 .first 是因为由于三角形的 3 个顶点,数组中存储了 3 个面。而且它们的法线都是相同的,因为它是一个平面。
This was my solution. I used the int32 from the mesh anchor of the face geometry. This solution should run without an error. I was able to get a correct solution. Like I tested it by using the mesh surface created with scene understanding then getting a mesh face that was on the floor and it returned 0,1,0 (y is up direction) which is right! btw I used .first because there are 3 faces stored in the array due to the 3 verticies of a triangle. and their normals are all the same since its a plane.