简体   繁体   中英

How to get values from simd_float4 in objective-c

I got a simd_float4*4 matrix from ARKit. I want to check the values of the matrix but found myself do not know how to do it in Objective-C. In Swift, this can be written as matrix.columns.3 to fetch a vector of values. But I do not know how to do it in Objective-C. Could someone point me a direction please. Thanks!

simd_float4x4 is a struct (like 4 simd_float4), and you can use

simd_float4x4.columns[index]

to access column in matrix.

/*! @abstract A matrix with 4 rows and 4 columns.*/
struct simd_float4x4 {
    public var columns: (simd_float4, simd_float4, simd_float4, simd_float4)
    public init()
    public init(columns: (simd_float4, simd_float4, simd_float4, simd_float4))
}

Apple document link: https://developer.apple.com/documentation/simd/simd_float4x4?language=objc

hope helpful!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM