gpt4 book ai didi

ios - 使用 SCNShape 和 UIBezierPath 绘制圆弧

转载 作者:可可西里 更新时间:2023-11-01 06:13:04 26 4
gpt4 key购买 nike

我正在尝试使用以下代码在 SCNShape 中绘制一 block 饼图:

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 - 使用 SCNShape 和 UIBezierPath 绘制圆弧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46859841/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com