# SceneKit-Convert a rotation vector into rotation matrix

I'm very new and I'm studying this ARKit code from RPasecky/CubesInSpace on github where he/she convert the point of view 's rotation vector into a rotation matrix

https://raw.githubusercontent.com/RPasecky/CubesInSpace/master/CubesInSpace/MainViewController.swift

func calculateCameraDirection(cameraNode: SCNVector4) -> SCNVector3 {
let x = -cameraNode.x
let y = -cameraNode.y
let z = -cameraNode.z
let w = cameraNode.w
let cameraRotationMatrix = GLKMatrix3Make(cos(w) + pow(x, 2) * (1 - cos(w)),
x * y * (1 - cos(w)) - z * sin(w),
x * z * (1 - cos(w)) + y*sin(w),

y*x*(1-cos(w)) + z*sin(w),
cos(w) + pow(y, 2) * (1 - cos(w)),
y*z*(1-cos(w)) - x*sin(w),

z*x*(1 - cos(w)) - y*sin(w),
z*y*(1 - cos(w)) + x*sin(w),
cos(w) + pow(z, 2) * ( 1 - cos(w)))


It was called from here

    let rotation = self.sceneView.pointOfView!.rotation //else { return (SCNVector3Zero) }

I understand the rotation of pointOfView that is passed in has x, y, z as the coordinate of the axis and w is the rotation angle. But how do I arrive at the code in the function? Which concepts should I learn about here?