Can someone explain the RaycastResult calculation in the FacePainting app?

Hi, i downloaded the FacePainting app from here https://developer.apple.com/documentation/realitykit/creating_an_app_for_face-painting_in_ar but i don't understand the RaycastResult calculation like how to figure out the uv from the indices, can someone explain or annotate the steps, thanks.

Can someone explain the RaycastResult calculation in the FacePainting app?
 
 
Q