The function projects worldPt to the polygon plane, then if the point is on some boundary, indices of these boundaries are added to the loopsArray and the function returns, otherwise it finds the innermost loop containing the point and adds its index to the loopsArray before returning.