Deriving Payment Address and Keys

The protocol states

A key tuple (ask, skenc, addrpk) is generated by users who wish to receive payments under this scheme. The viewing key skenc and the payment address addrpk = (apk , pkenc ) are derived from the spending key ask .

I am finding it difficult to find the details of how the viewing key is derived from the spending key and how the transmission key is derived from the viewing key.