Closed StrandedKitty closed 12 months ago
I would love to work with you on this issue. I have some custom three-js geometries that render a few different roof shapes given their outlines:
https://github.com/Beakerboy/Threejs-Geometries
A hipped roof is next on my list. I’ll review your straight skeleton implementation and see what I can figure out.
@Beakerboy Good luck! My hipped roof implementation is located in HippedRoofBuilder.ts, you can take a look at it. Overall, there's nothing complicated, it's pretty easy to render a hipped roof once you have a straight skeleton generated.
Just for adding another example: https://streets.gl/#53.55148,10.00444,45.00,0.00,473.43
I've switched to a much more robust CGAL straight skeleton implementation that works much better with complex OSM polygons. See updated https://github.com/StrandedKitty/straight-skeleton for details.
Works really well for most situations, nice overall improvement! Example: https://streets.gl/#49.79288,9.93804,45.00,119.17,387.58
Thank you for that elaborate fix.
To generate geometry for hipped and similar roof shapes in runtime this project uses a straight skeleton algorithm implementation ported from reinterpretcat's C# implementation: https://github.com/StrandedKitty/straight-skeleton
It seems like the algorithm tends to fail on buildings with a lot of right angles and holes. Basically, there are three types of failures:
To temporarily fix this problem I've implemented a fallback to the flat roof shape, but it only works for the first two cases which are easily detactable.
Though I don't know if looking into this is worth the effort.