Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Change in forEachTriangle #76

Open
PaulTorfs opened this issue Jan 17, 2022 · 2 comments
Open

Change in forEachTriangle #76

PaulTorfs opened this issue Jan 17, 2022 · 2 comments
Assignees
Labels

Comments

@PaulTorfs
Copy link

PaulTorfs commented Jan 17, 2022

I do suggest the following change in forEachTriange (the version on the website does only provide one coordinate (and even the wrong one), this version returns both x and y coordinates:

function forEachTriangle(points, delaunay, callback) {
  for (let t = 0; t < delaunay.triangles.length / 3; t++) {
    callback(t, pointsOfTriangle(delaunay, t).map(p => [points[2*p],points[2*p+1]]));
  }
}
@redblobgames
Copy link
Collaborator

Oh, yes, this is an issue but not sure what I should do about it — if you store points as nested [[x0,y0], [x1,y1], [x2,y2], …] then the helper code you need will be different than if you store the flat version [x0, y0, x1, y1, x2, y2, …]. Right now the guide is written for the nested point structure.

@PaulTorfs
Copy link
Author

PaulTorfs commented Jan 18, 2022 via email

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

No branches or pull requests

3 participants