{
	ball.cal - 2d coordinate mapping onto sphere.

	unit sphere centered at origin

	A1 = picture height/width
	A2 = unit scale for pattern
}

ball_u = Atan2(Py,Px)*Sqrt(1-Pz*Pz)/A2;
ball_v = Acos(Pz)/A2;

ball_tile_u = mod(ball_u,max(1,1/A1));
ball_tile_v = mod(ball_v,max(1,A1));

ball_match_u = tri(ball_u,max(1,1/A1));
ball_match_v = tri(ball_v,max(1,A1));
