Sitelet https://github.com/schteppe/poly-decomp.js/issues/8
Skip to content

quickDecomp sometimes returns incorrect results altough isSimple() returns true #8

Description

@Livor

Hi,

I use matter-js, which uses poly-decomp for decomposition of concave shapes. And from what I can tell they use it correctly.
As I understand decomposition should work if isSimple() returns true, correct me if I'm wrong.

my stringified dataset:
[[0,-79.44508550870114],[10,-99.0834989573238],[20,-128.29964750979318],[30,-185.09029800617753],[40,-134.0195021932894],[50,-139.5227157326003],[60,-215.58025321809043],[70,-6.122609059449391],[80,-236.07719042816427],[90,-226.24259910699942],[100,-238.8041580583293],[110,-140.12907455932222],[120,-52.898053692856664],[130,-116.1611158499016],[140,-182.81279630844563],[150,-57.05993977865975],[160,-93.0145040380496],[170,-234.66429450441535],[180,-36.42968890750706],[190,-163.89528934984702],[200,0],[0,0]]

and result as returned by poly-decomp:
[[[40,-134.0195021932894],[10,-99.0834989573238],[20,-128.29964750979318]],[[20,-128.29964750979318],[30,-185.09029800617753],[40,-134.0195021932894]],[[50,-139.5227157326003],[60,-215.58025321809043],[70,-6.122609059449391]],[[118.85126572145955,0],[0,0],[0,-79.44508550870114],[10,-99.0834989573238],[40,-134.0195021932894],[50,-139.5227157326003],[110,-140.12907455932222],[120,-52.898053692856664]],[[130,-116.1611158499016],[140,-182.81279630844563],[150,-57.05993977865975]],[[160,-93.0145040380496],[170,-234.66429450441535],[180,-36.42968890750706]],[[180,-36.42968890750706],[190,-163.89528934984702],[200,0],[185.00906723012366,0]],[[185.00906723012366,0],[118.85126572145955,0],[120,-52.898053692856664],[130,-116.1611158499016],[160,-93.0145040380496],[180,-36.42968890750706]]]

The error is apparent as the vector [100, -238.8041580583293] does not show up in the result...

I also added images that showcase how it should, and how it actually does, look like. (for this I simply cut the shape into stripes)

1
2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions