Swift 5 simd_incircle not found

Hello,

Could I please ask how to include the simd framework function simd_incircle(::::)?

I have imported simd but cannot find this function, linked: https://developer.apple.com/documentation/accelerate/1646495-simd_incircle

Details: Swift 5.2 Xcode 13.0

Thank you

Accepted Answer

I did the following test, with Xcode 13.2.1. I had not Xcode 13.0 available to repeat the test with.

import simd

In viewDidLoad, added:

          let result = simd_incircle(simd_float2(repeating: 1), simd_float2(repeating: 2), simd_float2(repeating: 3), simd_float2(repeating: 4))
          print("Result", result)

.

It compiles and runs run and yields:

  • Result 0.0

Note I was expecting a Bool according to doc !?!?!?

For some reason the deployment target needed to be "refreshed" by choosing a new value in the dropdown found in General>Deployment Info before additional framework functions were seen.

I made another test with points that are not aligned.

I get a non null result, but still not bool. And documentation says absolutely nothing !

          let aPt = simd_float2(repeating: -1)
          let bPt = simd_make_float2(1, -1)
          let cPt = simd_make_float2(0, 1)
          let result = simd_incircle(simd_float2(repeating: 0), aPt, bPt, cPt)
          print("Result", result)
  • Result 6.0

The header docs are correct:

/** @abstract Test if x lies inside, on, or outside the circle passing

 *  through a, b, and c.

 *

 *  @param __x The point being tested.

 *  @param __a The first point determining the circle.

 *  @param __b The second point determining the circle.

 *  @param __c The third point determining the circle.

 *

 *  @result Assuming that (a,b,c) are positively-oriented, positive if x is

 *  inside the circle, zero if x is on the circle, and negative if x is

 *  outside the circle.  The sign of the result is flipped if (a,b,c) are

 *  negatively-oriented.                                                      */
Swift 5 simd_incircle not found
 
 
Q