【问题标题】:Basic Shapes Union / Intersection / Difference : too blind to see?基本形状联合/交叉/差异:太盲目看不见?
【发布时间】:2018-02-22 00:41:57
【问题描述】:

我是 ARKit 的新手,在检查了一些示例代码(如 https://developer.apple.com/sample-code/wwdc/2017/PlacingObjects.zip)之后,我想知道是否有任何可能性以“联合/交叉/差异”的方式从基元构造几何图形。

以下伪代码应说明:

SCNBox *boxGeometry = [SCNBox boxWithWidth:1.0 height:1.0 length:1.0];
SCNSphere *sphereGeometry = [SCNSphere sphereWithRadius:0.6];

SCNGeometry *sphereUnionBox = [SCNGeometry union:sphereGeometry with:boxGeometry];
SCNGeometry *sphereAndBoxIntersection = [SCNGeometry intersect:sphereGeometry and:boxGeometry];
SCNGeometry *sphereSubstractedFromBox = [SCNGeometry substract:sphereGeometry from:boxGeometry];
SCNGeometry *boxSubstractedFromSphere = [SCNGeometry substract:boxGeometry from:sphereGeometry];

这应该导致(在从这些几何图形构建节点并将它们添加到场景之后)到众所周知和熟悉的组合:

任何广泛的提示将不胜感激,我真的被困在这里了。

【问题讨论】:

    标签: scenekit arkit


    【解决方案1】:

    SceneKit 不提供构造立体几何 (CSG) 的 API。有 SCNGeometry API 可以构建完全自定义的几何图形,但您必须自己找出顶点和三角形的列表。

    【讨论】:

    • 谢谢你的明确回答,不知怎的我已经猜到了
    • 在 Apple 的内置 API 中,Model I/O 提供最接近您正在寻找的内容 — 它执行 CSG 操作,但仅限于 voxels。 (不是任意网格或解析/参数几何,如理想球体。)
    • 嘿@mnuages,非常感谢您的详细回答!我和我的团队在一个问题上停留了好几天啊:/我发布了一个有趣的问题:stackoverflow.com/questions/63662318/…希望您提出建议!
    猜你喜欢
    • 2020-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 2011-04-17
    • 2021-11-29
    • 2020-01-31
    相关资源
    最近更新 更多