hiulit / delaunator-gdscript Goto Github PK
View Code? Open in Web Editor NEWA GDScript port of Delaunator: A fast library for Delaunay triangulation of 2D points.
License: MIT License
A GDScript port of Delaunator: A fast library for Delaunay triangulation of 2D points.
License: MIT License
I was having trouble getting the code to run in the Godot 4 alpha, and since it's not reasonable to start a new issue for that, I was hoping to see what else I could do! The link currently takes me to a 404 page
Godot4 array api has changed a lot, and the meaning of end
param in slice
method has changed, which is the inclusive index previously and now is the exclusive index, same as the original javascript lib.
In this case, line 295-296 should be
triangles = _triangles.slice(0, triangles_len)
halfedges = _halfedges.slice(0, triangles_len)
otherwise you will got a non-3-multiply length array .triangles
, which is invild.
Great script - thanks!
I noticed that you only mentioned the variable types as comment instead of using static typing:
Delaunator-GDScript/Delaunator.gd
Lines 6 to 7 in d7dd218
I wonder whether you could increase the script performance by switching to static typing?
var coords : PoolRealArray = []
...
Even if the performance would not be affected, it would increase readability and has some other advantages, too.
Delaunator-GDScript/Delaunator.gd
Line 144 in d7dd218
could instead just be
hull = []
Thank you! This is excellent work!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.