[cairo] Finding minimum distance to a stroke or fill

Behdad Esfahbod behdad at cs.toronto.edu
Wed Mar 1 17:15:39 PST 2006


> There hasn't really been time for people to play with these new
> distance functions yet, of course, so we can't really say if sqrt()
> is an actual performance problem or not. One question we can ask is,
> does anyone have a use case in hand that would require finding the
> nearest point (rather than just the distance)?

You can use it for neat effects, like having a cursor that cannot
get out of a circle.  Kinda like clipping where the cursor can
move.  I'm assuming that distance_to_fill will return zero and
the input point if the point is inside the fill.  And of course
that doesn't work quite as expected with non-convex paths.


> -Carl

--behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
	-- Dan Bern, "New American Language"


More information about the cairo mailing list