[Solved] break circle into sections for heading [closed]


Your logic is vastly more complicated than it needs to be. Simply calculate the difference between the heading and the radial, then normalize that to be between 0 and 360.

Then compare that to the three ranges.

let radial = ... // some radial in the range 0-360
let heading = ... // some heading in the range 0-360
let diff = (heading - radial + 360).truncatingRemainder(dividingBy: 360)

if diff >= 110 && diff <= 290 {
    // direct entry
} else if diff > 290 {
    // teardrop entry
} else {
    // parallel entry
}

That’s all you need.

1

solved break circle into sections for heading [closed]