SirRamEsq / SmartShape2D

A 2D Terrain Tool for Godot
MIT License
1.35k stars 67 forks source link

Uniform width edges #27

Open djrain opened 4 years ago

djrain commented 4 years ago

There seems to be no way to have uniform width edges with few points when welding is enabled. Having one far-off vertex results in a strongly thinning edge:

Screen Shot 2020-09-10 at 12 24 30 PM

Perhaps this effect is desirable in some cases, but probably not most. The issue can be minimized by adding more vertices: Screen Shot 2020-09-10 at 12 53 33 PM

But compare with a similar Line2D of only a few points:

Screen Shot 2020-09-10 at 12 36 32 PM

Is it possible to achieve the same uniform width for SmartShape by default?

GuyUnger commented 4 years ago

I just found this article, not sure if it's relevant but might be of some help: https://www.codeproject.com/Articles/226569/Drawing-polylines-by-tessellation

djrain commented 4 years ago

That article mentions the following, which seems relevant, in "Limitations" section:

That means practically we cannot use polyline() to draw a curve where points are dense.

Not sure if that's something that could be worked around (really not familiar with this stuff)... But honestly, I'm wondering why SmartShape couldn't just use Line2D directly for the edges?

GuyUnger commented 4 years ago

Line2D can't use different textures per edge (you could use multiple lines but then they won't connect), no build-in way for start and end textures for open shapes. maybe more limitations but that's what I can think of now