Go array initialization

前端 未结 4 1843
面向向阳花
面向向阳花 2021-02-05 00:30
func identityMat4() [16]float {
    return {
        1, 0, 0, 0,
        0, 1, 0, 0,
        0, 0, 1, 0,
        0, 0, 0, 1 }
}

I hope you get the idea

4条回答
  •  日久生厌
    2021-02-05 00:34

    func identityMat4() [16]float64 {
        return [...]float64{
            1, 0, 0, 0,
            0, 1, 0, 0,
            0, 0, 1, 0,
            0, 0, 0, 1 }
    }
    

    (Click to play)

提交回复
热议问题