【问题标题】:Can we select and section point cloud in autodesk forge?我们可以在 Autodesk forge 中选择和剖切点云吗?
【发布时间】:2021-12-31 13:01:55
【问题描述】:

我们必须用 forge 开发一个工具来完成以下任务

  1. 我们应该从本地硬盘显示大点云
  2. 我们应该能够选择点
  3. 我们应该能够分割/剪辑点云

如果我们使用 Autodesk forge 完成上述任务,请告诉我

提前致谢

【问题讨论】:

  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: autodesk-forge


【解决方案1】:

不幸的是,Forge Viewer 没有内置支持渲染大规模点云。以下是您可能要考虑的一些选项,但我认为没有任何解决方案可以为您勾选所有选项:

选项 1

通过Scene Builder 扩展将点作为THREE.PointCloud 插入场景:

function generatePointCloud() {
    const GridWidth = 1000;
    const GridHeight = 1000;
    const PointsCount = GridWidth * GridHeight;
    const PointSize = 0.1;
    const positions = new Float32Array(PointsCount * 3);
    const colors = new Float32Array(PointsCount * 3);
    let i = 0;
    for (var x = 0; x < GridWidth; x++) {
        for (var y = 0; y < GridHeight; y++) {
            const u = x / GridWidth, v = y / GridHeight;
            positions[3 * i] = (u - 0.5) * 100;
            positions[3 * i + 1] = (v - 0.5) * 100;
            positions[3 * i + 2] = 0.0;
            colors[3 * i] = u;
            colors[3 * i + 1] = v;
            colors[3 * i + 2] = 0.0;
            i++;
        }
    }

    const geometry = new THREE.BufferGeometry();
    geometry.addAttribute('position', new THREE.BufferAttribute(positions, 3));
    geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3));
    geometry.computeBoundingBox();
    geometry.isPoints = true; // This flag is important! It will force Forge Viewer to render the geometry as gl.POINTS

    const material = new THREE.PointCloudMaterial({ size: PointSize, vertexColors: THREE.VertexColors });
    return new THREE.PointCloud(geometry, material);
}

// ...

const sceneBuilder = await viewer.loadExtension('Autodesk.Viewing.SceneBuilder');
const modelBuilder = await sceneBuilder.addNewModel({
    conserveMemory: false,
    modelNameOverride: 'My Point Cloud'
});
const points = generatePointCloud();
points.dbId = 12345;
modelBuilder.addMesh(points);

这样,点云对象的行为将与任何其他 Forge 模型一样 - 它会在悬停时突出显示,在单击时被选中,并且还可以被分割。不幸的是,THREE.PointCloud 对象将所有点都保存在内存中,因此这种方法不适合大规模点云。

选项 2

使用 Potree 将大型点云加载到 Forge Viewer:https://github.com/petrbroz/forge-potree-demo

通过这种方式,您可以将大规模点云流式传输到场景中,但在这种情况下,选择和/或切片将不可用。您必须自己在 Potree 对象上实现该功能。

【讨论】:

    猜你喜欢
    • 2020-04-14
    • 1970-01-01
    • 2021-11-21
    • 2021-10-25
    • 2021-06-19
    • 2018-09-16
    • 2018-03-01
    • 2017-02-09
    • 2019-04-13
    相关资源
    最近更新 更多