hiulit / Delaunator-GDScript

A GDScript port of Delaunator: A fast library for Delaunay triangulation of 2D points.
MIT License
80 stars 8 forks source link

Suggestion: Use static typing #2

Closed t-karcher closed 3 years ago

t-karcher commented 3 years ago

Great script - thanks!

I noticed that you only mentioned the variable types as comment instead of using static typing:

https://github.com/hiulit/Delaunator-GDScript/blob/d7dd218c69c005f026f0fe02f934730ec5a88acc/Delaunator.gd#L6-L7

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.

hiulit commented 3 years ago

Hey, thanks for the feedback! I can't remember exactly why I left it out, but I think that some typed arrays weren't working correctly. I'll have a look again and see if I can add the types :)

hiulit commented 3 years ago

Done, thanks to a this pull request https://github.com/hiulit/Delaunator-GDScript/pull/3