0

Basically, I am working on a strategy game, and provinces on the map are basically comprised of a list of border points (which are used to create a Polygon).

I thought that loading the points from a SVG file "polygon" tag would be a great idea. However, Inkscape doesn't appear to have any way to convert my closed paths into polygons, and loading from a "path" would be relatively difficult because I would have to write code to "follow" the path during curves and add points at regular intervals.

0

This is very close to what you ask but not quite. As they will be paths in both cases although just simple straight segment paths:

  1. Select the path in question.
  2. Choose Extensions → Modify Path → Add Nodes...
    • Set mode to By max. Segment Legth
    • Set legth of segment
  3. Choose Extensions → Modify Path → Straighten Segments...

enter image description here

Image 1: Original path (top), result after polygonisation (bottom)

Or alternatively you can probably also use Extensions → Modify Path → Flatten Beziers..., for a more usable polygon. But your mileage may vary.

enter image description here

Image 1: after applying flatten beziers

On the other hand you can do this in a browser easily. Although a fully linear path is almost just as easy to parse as a polygon (it has 2 or 3 letters in the thing otherwise its just a list of points)

  • Thanks! It worked. I think I might run the resulting file through an obline path->polygon tool for simplicity (I did some digging and found one). – Dustin Jackson Apr 15 '18 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.