Archived post by mattiasmalmer

sometimes xyzdist() is not really what you want when you want to get distance from the edge of a font and so on because you get all these rounded corners. i wrote a quick wrangle that gives you the same type of sharp distance that an inset would give you:

“` int numprims=nprimitives(1);
float dist=10000000000000000000; for (int i=0; ipp=v@P-p0; if (dot(normalize(-normalize(p3-p1)+normalize(p0-p1)),v@P-p1)>=0) { if (dot(normalize(-normalize(p2-p0)+normalize(p1-p0)),pp)>=0) { dist=min(dist,(length(cross(pp,dir))/length(dir))); } }
}
@dist=dist; “`

(the second input is a “convertline” of the font)

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20232412/04/23/houdinifx_CuEDfyQLMW.gif