2017-09-13 52 views
3

我是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]; 

這應導致(後從這些幾何形狀結構的節點和將其添加到場景),以公知的和熟悉的組合:

任何廣泛的提示將不勝感激,我真的卡在這裏。

回答

1

SceneKit不提供構造型立體幾何(CSG)的API。有SCNGeometry API來構建完全自定義的幾何圖形,但是您必須自己找出頂點和三角形的列表。

+0

謝謝你那個明確的答案,不知何故,我已經猜到了它 – thurmaSan

+1

在內置的Apple API中,模型I/O提供了最接近你要找的東西 - 它做CSG操作,但只在[體素]上https://developer.apple.com/documentation/modelio/mdlvoxelarray)。 (不是任意網格或像理想球體那樣的分析/參數化幾何體。) – rickster