为什么UIBezierPath的addArcWithCenter添加了两条曲线?

时间:2017-07-04 08:58:08

标签: ios objective-c geometry uibezierpath

我正在尝试使用以下方法创建一个大小为708x80的垂直圆角贝塞尔曲线路径:

#define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI)

UIBezierPath *maskPath = [UIBezierPath bezierPath];

[maskPath addArcWithCenter:CGPointMake(cornerRadius, cornerRadius) radius:cornerRadius startAngle:DEGREES_TO_RADIANS(180) endAngle:DEGREES_TO_RADIANS(270) clockwise:YES];
[maskPath addArcWithCenter:CGPointMake(size.width - cornerRadius, cornerRadius) radius:cornerRadius startAngle:DEGREES_TO_RADIANS(270) endAngle:DEGREES_TO_RADIANS(0) clockwise:YES];
[maskPath addArcWithCenter:CGPointMake(size.width - cornerRadius, size.height - cornerRadius) radius:cornerRadius startAngle:DEGREES_TO_RADIANS(0) endAngle:DEGREES_TO_RADIANS(90) clockwise:YES];
[maskPath addArcWithCenter:CGPointMake(cornerRadius, size.height - cornerRadius) radius:cornerRadius startAngle:DEGREES_TO_RADIANS(90) endAngle:DEGREES_TO_RADIANS(180) clockwise:YES];

[maskPath closePath];

并创建此路径:

<MoveTo {1.4921397e-13, 39.999996}>,
<CurveTo {40, 7.1054274e-15} {1.9312909e-06, 17.908607} {17.908611, -2.6343716e-07}>,
<LineTo {668, 7.1054274e-15}>,
<CurveTo {708, 40} {690.09137, 2.6343719e-07} {708, 17.908609}>,
<LineTo {708, 40}>,
<CurveTo {668, 80} {708, 62.091389} {690.09137, 80}>,
<CurveTo {668, 80} {668, 80} {668, 80}>,
<LineTo {40, 80}>,
<CurveTo {4.2632564e-14, 40} {17.908609, 80} {-9.6564531e-07, 62.091389}>,
<CurveTo {1.4921397e-13, 39.999996} {6.631732e-14, 40} {1.0184446e-13, 39.999996}>,
<Close>

为什么它只为左下角和左下角创建两条曲线?另外,为什么第一条双曲线从完全相同的点开始?

0 个答案:

没有答案