Re: Path length
Behdad Esfahbod <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
On 15-03-24 01:45 PM, Bryce Harrington wrote: > On Tue, Mar 24, 2015 at 05:09:50PM +0000, Stuart Axon wrote: >> Is the best way to get the length of a cairo path to call cairo_copy_path_flat and sum the lengths of the LINE_TOs contained inside ? That's what I've personally done in the past. However: >> I've been looking at arc lengths and it seems it can get complex, There are very decent and simple approximations that I think are good enough for most purposes. Read here for example: http://pomax.github.io/bezierinfo/#arclength Would be interesting to measure or calculate the error of that approximation for small values of n. >> any chance of cairo providing cairo_path_length in future, or should I be looking at something like 2geom for this sort of thing ? >> S++ > > I haven't seen anyone making plans to implement that, so 2geom might be > your best choice right now. That said, I imagine patches to add that to > cairo would be entertained if the use case for it is strong enough. Would be nice, but we'd need a nice API for it too. > Bryce > -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo