0

It is a common knowledge about clockwise or counterclockwise, like this picture:

enter image description here

So when I read clockwise set to true it means it is clockwise, and if I read clockwise set to false it means counterclockwise. However, as you can read in the code below, I set clockwise to true, but the result is not correct.

Is it a wrong function coding from Apple?

Test code:

struct CircleShape: Shape {
    func path(in rect: CGRect) -> Path {
        return Path { path in
            path.addArc(center: CGPoint(x: rect.midX, y: rect.midY), radius: 200,
                        startAngle: Angle(degrees: 0), endAngle: Angle(degrees: 90), clockwise: true)
        }
    }
}

Result:

enter image description here

As you can read in my code, I set clockwise for true, starting from 0 and end for 90, but the output is for clockwise: false which is not what I understand from clockwise or counterclockwise. Is it not confusing behavior? Or, I am missing something in between?

jnpdx
  • 45,847
  • 6
  • 64
  • 94
ios coder
  • 1
  • 4
  • 31
  • 91
  • Yes, this seems to be wrong coded :)) – ChrisR Feb 09 '22 at 18:33
  • @vadian https://stackoverflow.com/a/64272159/2303865 – Leo Dabus Feb 09 '22 at 18:42
  • My question got closed for unknown reason! Those links does not answer my question, I am still looking to an answer. – ios coder Feb 09 '22 at 19:09
  • It is about Z vector direction (around which rotation of clock is performed), but vector is not from you (as you see), but to you, so you see it as opposite. – Asperi Feb 09 '22 at 19:12
  • but no one is going ask me about axes when I use the word of clockwise, the word of clockwise has own definition globally, unless they could use better naming for avoid such misunderstanding. I would say it is wrong naming if it is not wrong coding. – ios coder Feb 09 '22 at 19:37

0 Answers0