I have two pieces of code, one of which works fine (iOS version), and the other does not work correctly (Mac version). I canβt decide what the problem is with the Mac version that uses NSBezierPath and not UIBezierPath.
iOS version
I have a piece of code that works exactly as I would like on iOS using UIBezierPath. Here is the code:
let center = CGPoint(x: size.width / 2.0, y: size.height / 2.0) let radius = size.width / 2.0 let startAngle = angle let endAngle = 180.0 - startAngle let bezierPath = UIBezierPath() bezierPath.addArcWithCenter(center, radius: radius, startAngle: startAngle.radians, endAngle: endAngle.radians, clockwise: true) println(bezierPath) return bezierPath
He makes the following conclusion
<UIBezierPath: 0x7fe348f82910; <MoveTo {42.677669529663689, 42.677669529663689}>, <CurveTo {7.3223304703363148, 42.677669529663689} {32.914562235881945, 52.440776823445439} {17.085437764118062, 52.440776823445432}>
and displays the following image

Mac OS X Version
This does exactly what I want, except that it is for iOS. I would like to translate this code on OS X / Cocoa. Here is what I came up with
let center = CGPoint(x: size.width / 2.0, y: size.height / 2.0) let radius = size.width / 2.0 let startAngle = angle let endAngle = 180.0 - startAngle let bezierPath = NSBezierPath() bezierPath.appendBezierPathWithArcWithCenter(center, radius: radius, startAngle: startAngle.radians, endAngle: endAngle.radians, clockwise: true) println(bezierPath) return bezierPath
(it is almost identical to the iOS code).
Result here
Path <0x600000122800> Bounds: {{-4.9018102839097546e-05, -4.9018102839077596e-05}, {50.000098036205685, 50.000094758067902}} Control point bounds: {{-0.18691031775632938, -0.18691031775632855}, {50.373820635512658, 50.37016203886877}} 49.997651 25.342684 moveto 50.186910 11.536862 39.148505 0.191608 25.342684 0.002349 curveto 11.536862 -0.186910 0.191608 10.851495 0.002349 24.657316 curveto -0.186910 38.463138 10.851495 49.808392 24.657316 49.997651 curveto 38.196255 50.183252 49.422202 39.556558 49.978864 26.027794 curveto
getting the following form:

Both code segments were provided with the same inputs and used the same methods to calculate radians, etc. As far as I can tell, everything is the same between them, apart from the conclusion. It is also worth noting that I convert each of the paths to UIImage and NSImage after they are drawn. Please let me know if I should post the code I use for this.
I also tried using moveToPoint to get both code snippets to the correct starting position (unnecessary on iOS, do not fix the problem on OS X).
Many thanks for your help.