dir(
frame,a,b,w,h,i,j) ->x,y,z
The unit normal at the centre of texel (i, j) of a w x h map over a patch
frame comes from frame. a, b are the patch's half-extents: the
tangent of the half-angle each side subtends at the centre. w, h are the
map's size in texels. i, j are the texel, counted from 1.
Returns the unit normal in the object frame at
s = -a + (i - 1/2) * 2a/w, t = -b + (j - 1/2) * 2b/h. i, j can lie
outside the map: a half-integer names a texel's edge, and 0.5 the
patch's own edge.
Returns nil when:
a or b is not above 0;a² + b² > 1, a corner past 45 degrees;