0

I use potree to view my model I want to get list of all points in pointcloud to add event to each point depending on its index. Can I get list of all points without using measurement tools?

Potree.loadPointCloud(cloudPointsPath, "name", e => {
                var pointcloud = e.pointcloud;
                var material = pointcloud.material;
                viewer.scene.addPointCloud(pointcloud);
                material.pointColorType = Potree.PointColorType.RGB;
                material.size = 1;
                material.pointSizeType = Potree.PointSizeType.FIXED;
                material.shape = Potree.PointShape.PARABOLOI;
                viewer.fitToScreen();
            });
0

I got list of visible points using this function

function getAllPointsOfPointCloud(pointCloud) {
        var list = [];
        var array = pointCloud.pcoGeometry.root.geometry.attributes.position.array;
        var index = 0;
        for (var i = 0; i < pointCloud.pcoGeometry.root.geometry.attributes.position.length;i=i+3) {
            var x = array[i + 0];
            var y = array[i+ 1];
            var z = array[i + 2];
            let position = new THREE.Vector3(x, y, z);
            position.applyMatrix4(pointCloud.matrixWorld);
            list[index] = position;
            index++;
        }
        return list;
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.