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

Incorrect size for voronoi.circumcenters array. #103

Closed
vchizhov opened this issue Feb 12, 2020 · 2 comments
Closed

Incorrect size for voronoi.circumcenters array. #103

vchizhov opened this issue Feb 12, 2020 · 2 comments

Comments

@vchizhov
Copy link

The circumcenters array is allocated as: Float64Array(delaunay.points.length * 2);. Instead the size should be based on the number of triangles. Note that the number of triangles may be as high as 2*vertex_count - 5, which far exceeds delaunay.points.length (the multiplication by 2 in the allocation is for the (x,y) coordinates so that's not the 2 factor that we are looking for).

@mourner
Copy link
Collaborator

mourner commented Feb 12, 2020

The delaunay.points array is also interleaved x, y, so its length is also double the vertex count, evening things out. I agree this might look a little unintuitive in the code though.

@mourner mourner closed this as completed Feb 12, 2020
@vchizhov
Copy link
Author

@mourner So point.length is not the point count but instead 2 * point_count? Then I guess it should work. It's still probably better to just plug in the number of triangles there - would take less memory, and it will be more obvious that this is not a bug.

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