从 pointcloud 获取所有点,其中 pointcloud 是新的 Potree.PointCloudOctree(geometry)

Get all points from pointcloud where pointcloud is new Potree.PointCloudOctree(geometry)

我使用 potree 查看我的模型我想获取 pointcloud 中所有点的列表以根据其索引向每个点添加事件。我可以在不使用测量工具的情况下获得所有点的列表吗? 我想从 pointcloud

获得积分

 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();
            });

我使用此代码得到了点列表

 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;
        }