Google Tango API之TangoPointCloud
TangoPointCloudManager
com.projecttango.tangosupport
Class TangoPointCloudManager
java.lang.Object
com.projecttango.tangosupport.TangoPointCloudManager
public class TangoPointCloudManagerextends java.lang.Object
Maintains point cloud buffers in a thread-safe fashion. We assume that the point cloud data arrives on one thread and a second render thread wants access to the latest complete point cloud data without waiting.
以线程安全的方式维护点云缓冲区。 我们假设点云数据在一个线程上到达,并且第二渲染线程想要访问最新的完整点云数据而不等待。
TangoPointCloudManager()
Constructs an instance containing three empty point cloud buffers.
构造包含三个空点云缓冲区的实例。
Method Detail
方法详细
getLatestPointCloud
public TangoPointCloudData getLatestPointCloud()
Swaps the front and share buffers if there is newer data in the share buffer. After the swap, the front buffer will contain the latest complete point cloud data. The method updatePointCloud()
should be called at least once prior to calling this method, otherwise this method will return null.
Returns:
The latest complete point cloud data or null if the method updatePointCloud()
has not been called at least once.
public TangoPointCloudData getLatestPointCloud()
如果共享缓冲区中有较新的数据,则交换前端和共享缓冲区。 交换后,前缓冲区将包含最新的完整点云数据。 方法updatePointCloud()
应该在调用此方法之前至少调用一次,否则此方法将返回null。
Return:
最新的完整点云数据或null如果方法updatePointCloud()
至少没有被调用过一次。
updatePointCloud
public void updatePointCloud(TangoPointCloudData pointCloud) throws TangoInvalidException
Makes an internal copy of the input point cloud data and swaps the back and share buffers for availability from the render thread if there is at least one point in the input point cloud. This is expected to be called from the data available callback.
Parameters:
pointCloud
- A point cloud from the callback thread. This cannot be null.
Throws:
TangoInvalidException - if pointCloud
is null, or if pointCloud.points
is null while pointCloud.numPoints
is positive, or if pointCloud.timestamp
or pointCloud.numPoints
are negative, or Double.NaN
updatePointCloud
public void updatePointCloud(TangoPointCloudData pointCloud)
throws TangoInvalidException
生成输入点云数据的内部副本,如果输入点云中至少有一个点,则从渲染线程交换回并共享缓冲区以获得可用性。 这预计将从数据可用回调中调用。
参数:
pointCloud - 来自回调线程的点云。 此值不能为空。
投掷:
TangoInvalidException - 如果pointCloud为null,或者pointCloud.points为null,而pointCloud.numPoints为正,或者pointCloud.timestamp或pointCloud.numPoints为负,或Double.NaN。
.