What is the type of SCNVector3 components? CGFloat or Float?

我只是一个虾纸丫 提交于 2019-12-01 10:47:01

In the iOS 8.1 SDK headers, the SCNVectorX types are based on Float, as can be seen by command-clicking on SCNVector3:

struct SCNVector3 {
    var x: Float
    var y: Float
    var z: Float
}

func SCNVector3Make(x: Float, y: Float, z: Float) -> SCNVector3

This is different from the OS X 10.10 SDK where CGFloat is used. So the documentation seems to be wrong. The following compiles in an iOS project:

func * (left: SCNVector3, right: Float) -> SCNVector3 {
    return SCNVector3Make(left.x * right, left.y * right, left.z * right)
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!