what tool to trace an image outline and get vertices? (not polygons)

I have used physics editor for physics boundaries which is good, i.e. producing polygons.

I want to trace an image now however for “display.newPolygon( x, y, vertices )”, so don’t want to export polygons, but rather the vertices. 

What’s a good tool for this?  (I’m on Mac - I do have Photoshop CS6…)

Did you find a tool? I’m looking for something similar.

Can graphics.newOutline do what you suggested?

Take a look at the docs here:http://docs.coronalabs.com/daily/api/library/graphics/newOutline.html

You can then pull the outline vertices out if you need them for newPolygon, or simply add the physics body directly as in the example on the docs

Physics Editor. Here the info go got from them

Hi,

sure it can.
But you need to do some manual work.

The exporters are plain text files. See http://www.codeandweb.com/blog/2012/05/30/customize_physicseditor_exporter
You can check out the included exporters - maybe there’s already a format you can use.
I’ve attached the plain text exporter - its already included.

You can iterate over the polygons, but you could also iterate over the “hull” - which is the outer polygon, not yet split into smaller parts:

{% for point in fixture.hull %} {% if not forloop.first %}, {% endif %}({{point.x}}, {{point.y}}) {% endfor %}

This will give you what you need.

You might also produce source code - so that you don’t have to parse a file…


great news - I saw the hull output in the text export and copy/pasted it, then did some mod’s to get it to lua format - but with what you’ve got I should be able to get a simple output of the hull only in a Lua table format correct?


yes - it should be possible to create that.
Take the corona-sdk exporter and change the iterating over the polygons to the hull - that should already do the trick

Did you find a tool? I’m looking for something similar.

Can graphics.newOutline do what you suggested?

Take a look at the docs here:http://docs.coronalabs.com/daily/api/library/graphics/newOutline.html

You can then pull the outline vertices out if you need them for newPolygon, or simply add the physics body directly as in the example on the docs

Physics Editor. Here the info go got from them

Hi,

sure it can.
But you need to do some manual work.

The exporters are plain text files. See http://www.codeandweb.com/blog/2012/05/30/customize_physicseditor_exporter
You can check out the included exporters - maybe there’s already a format you can use.
I’ve attached the plain text exporter - its already included.

You can iterate over the polygons, but you could also iterate over the “hull” - which is the outer polygon, not yet split into smaller parts:

{% for point in fixture.hull %} {% if not forloop.first %}, {% endif %}({{point.x}}, {{point.y}}) {% endfor %}

This will give you what you need.

You might also produce source code - so that you don’t have to parse a file…


great news - I saw the hull output in the text export and copy/pasted it, then did some mod’s to get it to lua format - but with what you’ve got I should be able to get a simple output of the hull only in a Lua table format correct?


yes - it should be possible to create that.
Take the corona-sdk exporter and change the iterating over the polygons to the hull - that should already do the trick