Project Tango: How to tell if the plane created in the Plane fitting example is a floor or a wall in Java SDK?

烂漫一生 提交于 2020-01-06 03:38:06

问题


The plane fitting example fits a cube on a plane that it created from the point cloud that it retrieves based on the point selected by user. I want to determine if that point is a floor, a wall or a roof. What I am trying to achieve is to change the example so that it only renders the cube on the floor and not on wall or roof.


回答1:


The simplest solution is to check the plane normal. Usually, wall's normal is perpendicular to the gravity, and floor is parallel to gravity.




回答2:


Something like this:

You got the normal of the plane hit right?

     float surfaceAngle = Vector3.Angle(normal, new Vector3(0,1,0));

     float floorLimitAngle = 20;
     float ceilingLimitAngle = 180 - 20;

     if (surfaceAngle < floorLimitAngle )
        // It's a floor
     else if (surfaceAngle > ceilingLimitAngle)
        // It's a ceiling
     else
        // It's a wall


来源:https://stackoverflow.com/questions/38776664/project-tango-how-to-tell-if-the-plane-created-in-the-plane-fitting-example-is

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!