带有贝塞尔曲线的 SCNShape [英] SCNShape with bezier path
本文介绍了带有贝塞尔曲线的 SCNShape的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 Scenekit iOS 中绘制 3d 线,我正在尝试使用下面的代码来绘制线,
I am tying to draw a 3d line in Scenekit iOS, i am trying below code to draw line,
func path() -> UIBezierPath
{
var bPath = UIBezierPath()
bPath.moveToPoint(CGPointMake(0, 0))
bPath.addLineToPoint(CGPointMake(10, 10))
bPath.addLineToPoint(CGPointMake(5, 5))
bPath.closePath()
return bPath
}
下面的代码是在SCNNode中加载该行,
and the below code is to load the line in SCNNode,
let sap = SCNShape()
sap.path = path()
let carbonNode = SCNNode(geometry: sap)
carbonNode.position = SCNVector3Make(0, 0, 15)
scene.rootNode.addChildNode(carbonNode)
但是,我的屏幕一片空白.
But, i am getting blank screen.
推荐答案
尝试更改几何体的材质.您可能有一个白色背景上的白色物体.
try changing your geometry's materials. You might have a white object on a white background.
事实证明,三角形的顶点是共线的.因此,您最终会得到一个退化三角形.
edit: it also turns out that the vertices of your triangle are colinear. You thus end up with a degenerate triangle.
这篇关于带有贝塞尔曲线的 SCNShape的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文