如何在Objective-C中从simd_float4获取值 [英] How to get values from simd_float4 in objective-c

查看:177
本文介绍了如何在Objective-C中从simd_float4获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从ARKit得到了simd_float4 * 4矩阵.我想检查矩阵的值,但是发现自己不知道如何在Objective-C中进行操作.在Swift中,可以将其写为matrix.columns.3来获取值的向量.但是我不知道如何在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是一个结构体(例如4 simd_float4),您可以使用

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

simd_float4x4.columns[index]

访问矩阵中的列.

/*! @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文档链接: https://developer.apple.com/documentation/simd/simd_float4x4?language = objc

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

希望有帮助!

这篇关于如何在Objective-C中从simd_float4获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆