[cairo] Finding minimum distance to a stroke or fill
cworth at cworth.org
Wed Mar 1 16:44:01 PST 2006
On Wed, 1 Mar 2006 18:11:34 -0500 (EST), Behdad Esfahbod wrote:
> > That puts a rather long name on the commonly needed function, (which
> > could be a minor performance trap), and it does put two extremely thin
> > convenience functions in to cairo (which is something we don't usually
> > do).
> Having this functionality does make cairo_in_stroke and
> cairo_in_fill look like thin wrappers too... It looks like such
> a heavy hammer.
Yeah, perhaps I just missed when I first added in_stroke and in_fill
and should have instead just added distance functions instead.
> I suggest having cairo_distance_to_stroke/fill that do exactly
> what they should (return the distance)
Let's do that now.
> and have a couple more
> functions, returning distance_squared and the mapped point.
And here I'm willing to do our standard "Don't add API that's
exclusively for 'performance' reasons until there's a demonstrated
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)?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060301/fcafc0d6/attachment.pgp
More information about the cairo