tidwall / tg

Geometry library for C - Fast point-in-polygon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Length for tg_line?

simonrolfmore-brunswick opened this issue · comments

I absolutely appreciate this may not be the way you want to go with tg, but I figure it can't hurt to ask: would you be interested in exposing a function to calculate the length of a tg_line?

It looks like there's already an internal length function for calculating the Pythagoras distance between 2 points, and a function to calculate a ring's perimeter as part of the Polsby-Popper score calculation, so this doesn't appear to be a huge stretch in terms of extra code, but I understand this may not be an API overhead you want to take on.

For full disclosure, I'm asking for this with the hope of it getting incorporated into sqlite-tg as it's a much lighter-weight alternative to using Spatialite and the GeoJSON conversion, intersection, and bounding box functions are super useful for the work I'm doing.

You're right that this should be a relatively simple change. Most of the code is already there but just needs to be exposed to the API.

I'll dig a little deep and see what I can do.

The method is now available.

Thank you! Looks fantastic :)