If I have an arbitrary edge/path in an image that may be oriented and curved in any direction, is there any way to detect the "length" vector of that path? Or perhaps the perpendicular direction of it? If I convert the (blurred) path into a normal map, I get 2 perpendicular directions on either side of the path, so that is one possible tool.

My eventual goal is to find ways to shorten the path along its length or along its end points (by vector warping it or such).

Note 1: One thing I tried was to convert to normals (using the blur method above), then use a pixel processor to convert all vectors to "absolute", making them all point in the same perpendicular direction to the path. But this causes strange problems when the path traces out circular curves - the vectors flip completely around during some angled turns, because there is no way to detect which side is the "inside" of the path.

Note 2: There may also be something that could be done with the tile sampler. It is possible to generate perpendicular lines across all paths using the masking threshold and vector rotation options. These lines would represent path direction "checkpoints". But I'm not sure where to go from there. Maybe blur these lines, convert to normals, then process them some how? Still not much better than just having the path slope.

Note 3: If we take the blurred path converted to normals and rotate them by 90 degrees (using vector rotation node), we get vectors that trace around the path like a race track. If there was some way to force the vectors on both sides to point the same way, it would result in the path direction everywhere except on the ends. Maybe some way of masking out one side and blending that with a second version that is rotated the opposite way by 90 degrees? I'm just not sure how to mask these out accurately. Or maybe a pixel processor that samples vectors from both images and captures the ones facing toward each other? But then I can think of no way to generate a result vector that bends around curves correctly (same problem as note #1).

If anyone has any ideas to pull this off, please let me know.

Thanks!

My eventual goal is to find ways to shorten the path along its length or along its end points (by vector warping it or such).

Note 1: One thing I tried was to convert to normals (using the blur method above), then use a pixel processor to convert all vectors to "absolute", making them all point in the same perpendicular direction to the path. But this causes strange problems when the path traces out circular curves - the vectors flip completely around during some angled turns, because there is no way to detect which side is the "inside" of the path.

Note 2: There may also be something that could be done with the tile sampler. It is possible to generate perpendicular lines across all paths using the masking threshold and vector rotation options. These lines would represent path direction "checkpoints". But I'm not sure where to go from there. Maybe blur these lines, convert to normals, then process them some how? Still not much better than just having the path slope.

Note 3: If we take the blurred path converted to normals and rotate them by 90 degrees (using vector rotation node), we get vectors that trace around the path like a race track. If there was some way to force the vectors on both sides to point the same way, it would result in the path direction everywhere except on the ends. Maybe some way of masking out one side and blending that with a second version that is rotated the opposite way by 90 degrees? I'm just not sure how to mask these out accurately. Or maybe a pixel processor that samples vectors from both images and captures the ones facing toward each other? But then I can think of no way to generate a result vector that bends around curves correctly (same problem as note #1).

If anyone has any ideas to pull this off, please let me know.

Thanks!