Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Holes #4

Open
mflux opened this issue Apr 19, 2017 · 1 comment
Open

Holes #4

mflux opened this issue Apr 19, 2017 · 1 comment

Comments

@mflux
Copy link

mflux commented Apr 19, 2017

Hi I'm interested in using this lib. Can you please complete the example with holes? Is there an api specifying hole paths?

@Hartha-aloufi
Copy link

You can add holes with the polygon points, but you need to define the edges of the polygon and the edges of the holes - the constraints edges - and set exterior flag to false

`
let cnt = 0;
for (let i = 0; i < holes.length; i++) {
for (let j = 0; j < holes[i].length; j++) {
pos.push([holes[i][j].x, holes[i][j].y]);

                      if(j)
                        edges.push([points.length + cnt -1, points.length + cnt]);
                      cnt++;
                  }

                  edges.push([points.length + cnt -1, points.length + cnt - holes[i].length]);
              }


              let cells = cdt2d(pos, edges, {exterior:false});

`

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants