question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Concave polygons not working even after I installed poly-decomp (node server)

See original GitHub issue

I’ve installed poly-decomp with npm install poly-decomp. I then put decomp = require('poly-decomp') above matter = require('matter-js'), when I run my code, it still says poly-decomp.js required. I dug in matter.js code and changed line 6541 to decomp = require('poly-decomp'). It doesn’t give the same message anymore, but my shape is still just convex.

I ran console.log(decomp) after line 6541, and it returned

{ decomp: [Function: polygonDecomp],
quickDecomp: [Function: polygonQuickDecomp],
isSimple: [Function: polygonIsSimple],
removeCollinearPoints: [Function: polygonRemoveCollinearPoints],
makeCCW: [Function: polygonMakeCCW] }

which I think is what it should return. I dug even farther and made sure that line 6763 was being run, and it is. Although, when I console.log(decomp.makeCCW(concave)); on line 6769, it returns undefined. What should I do to make it work? Right now it isn’t giving me the error message, but it isn’t making the shape concave.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:28 (10 by maintainers)

github_iconTop GitHub Comments

13reactions
liabrucommented, Jul 19, 2018

Thanks for the info guys, sorry that this is still an issue. While I look into it more, I think this temporary fix should work with the latest version. Make sure you put it somewhere early on, before you use Bodies.fromVertices:

window.decomp = require('poly-decomp');
4reactions
Dibblecommented, Feb 18, 2019

all solutions above doesn’t work Webpack replaces window.decomp = require('poly-decomp'); by __webpack_provided_window_dot_decomp = __WEBPACK_IMPORTED_MODULE_0_poly_decomp___default.a;

so global window is remains untouched

Using global.decomp = require('poly-decomp') is working for me with Webpack

Read more comments on GitHub >

github_iconTop Results From Across the Web

A brand new website interface for an even better experience!
Concave polygons not working even after I installed poly-decomp (node server)
Read more >
How can I clean/fix polygons in a Node.js application?
Although I am not cleaning up Polygons I have found a better approach. ... fix everything, you can try repairing it once it's...
Read more >
poly-decomp - npm
poly-decomp.js ... Create a concave polygon var concave = new decomp. ... Make sure you have git, Node.js, NPM and grunt installed.
Read more >
Use of GL_STENCIL_TEST to render concave polygons
In fact, the context enabled by Quartz Composer doesn't implement a stencil buffer. It seems impossible to render directly in OpenGL with the ......
Read more >
poly-decomp.js
js. Decomposition of 2D polygons into convex pieces in JavaScript. See the Github repo. Try drawing a polygon below!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found