I am looking for a sample from a texture along a circular arc in the fragment shader. Such rules exclude recursive methods such as this .
I came up with several different ways to do this: two that seem most reasonable (given the starting position p, center c, radius r = length(c-p), angle (arc length) thetain radians and positions N):
1) Turn the pc vector about c by theta/N, Ntimes: this requires building a rotation matrix that will be reused: cost - two trigger functions, a N2x2 matrix is multiplied, Nor so vector subtractions
2) Find the chord length of one segment intersecting a sector: its length 2*r*sin(theta/2). As soon as I have the first vector, I can rotate it and add it to the previous position to "step" along my arc. The problem with this method is that I still don't know the expression to get the orientation of my length vector 2*r*sin(theta/2). Even if I did, I would probably need trigger functions to create it. I still need to rotate it so that it takes me to still create the rotation matrix. Ugh.
Are there any other methods that I could consider?
source
share