Class: VRPointCloud

THREE.WebAR.VRPointCloud

new VRPointCloud(vrDisplay)

A class that allows to manage the point cloud acquisition and representation in ThreeJS. A buffer geometry is generated to represent the point cloud. The point cloud is provided using a VRDisplay instance that shows the capability to do so. The point cloud is actually exposed using a TypedArray. The array includes 3 values per point in the cloud. There are 2 ways of exposing this array: 1.- Using a new TypedArray for every frame/update. The advantage is that the TypedArray is always of the correct size depending on the number of points detected. The disadvantage is that there is a performance hit from the creation and copying of the array (and future garbage collection). 2.- Using the same reference to a single TypedArray. The advantage is that the performance is as good as it can get with no creation/destruction and copy penalties. The disadvantage is that the size of the array is the biggest possible point cloud provided by the underlying hardware. The non used values are filled with THREE.WebAR.MAX_FLOAT32_VALUE.
Parameters:
Name Type Description
vrDisplay window.VRDisplay The reference to the VRDisplay instance that is capable of providing the point cloud. NOTE: The buffer geometry that can be retrieved from instances of this class can be used along with THREE.Point and THREE.PointMaterial to render the point cloud using points. This class represents the vertices colors with the color white.
Source:

Methods

getBufferGeometry() → {THREE.BufferGeometry}

Returns the THREE.BufferGeometry instance that represents the points in the pont cloud.
Source:
Returns:
The buffer geometry that represents the points in the point cloud. NOTE: A possible way to render the point cloud could be to use the THREE.BufferGeometry instance returned by this method along with THREE.Points and THREE.PointMaterial. var pointCloud = new THREE.VRPointCloud(vrDisplay, true); var material = new THREE.PointsMaterial( { size: 0.01, vertexColors: THREE.VertexColors } ); var points = new THREE.Points( pointCloud.getBufferGeometry(), material );
Type
THREE.BufferGeometry

update(updateBufferGeometry, pointsToSkip, transformPoints)

Update the point cloud. The THREE.BufferGeometry that this class provides will automatically be updated with the point cloud retrieved by the underlying hardware.
Parameters:
Name Type Description
updateBufferGeometry boolean A flag to indicate if the underlying THREE.BufferGeometry should also be updated. Updating the THREE.BufferGeometry is very cost innefficient so it is better to only do it if necessary (only if the buffer geometry is going to be rendered for example). If this flag is set to false, then the underlying point cloud is updated but not buffer geometry that represents it. Updating the point cloud is important to be able to call functions that operate with it, like the getPickingPointAndPlaneInPointCloud function.
pointsToSkip number A positive integer from 0-N that specifies the number of points to skip when returning the point cloud. If the updateBufferGeometry flag is activated (true) then this parameter allows to specify the density of the point cloud. A values of 0 means all the detected points need to be returned. A number of 1 means that 1 every other point needs to be skipped and thus, half of the detected points will be retrieved, and so on. If the parameter is not specified, 0 is considered.
transformPoints boolean A flag to specify if the points should be transformed in the native side or not. If the points are not transformed in the native side, they should be transformed in the JS side (in a vertex shader for example).
Source: