ios – 使用SCNShape和UIBezierPath绘制弧

前端之家收集整理的这篇文章主要介绍了ios – 使用SCNShape和UIBezierPath绘制弧前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图使用以下代码在SCNShape中绘制一块馅饼:

UIBezierPath *piePiece = [UIBezierPath bezierPath];
[piePiece addArcWithCenter: CGPointZero radius:  0.150 startAngle: 0.0 endAngle: M_PI/6  clockwise: YES];
[piePiece closePath];
SCNShape *pieShape = [SCNShape shapeWithPath: piePiece extrusionDepth: 0];
pieShape.firstMaterial.diffuse.contents = [UIColor blueColor];
pieShape.firstMaterial.doubleSided = YES;
SCNNode *pieNode = [SCNNode nodeWithGeometry: pieShape];

但我得到以下形状:

Sample
我看不到弧线.我究竟做错了什么?

谢谢

解决方法

您必须将UIBezierPath的平坦度更改为较低的值.在Swift中:

pieShape.flatness = 0.0003

猜你在找的iOS相关文章