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

Straight skeleton algorithm fails on complex building footprints #1

Closed
StrandedKitty opened this issue Apr 16, 2023 · 5 comments
Closed
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@StrandedKitty
Copy link
Owner

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:

  1. Straight skeleton code throws an error.
  2. The resulting geometry falls way out of the roof footprint.
  3. A part of the roof is missing.

Example of a hipped roof with a missing part

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.

@StrandedKitty StrandedKitty added the help wanted Extra attention is needed label Apr 16, 2023
@Beakerboy
Copy link

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.

@StrandedKitty
Copy link
Owner Author

@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.

@kayD
Copy link

kayD commented Jun 6, 2023

Just for adding another example: https://streets.gl/#53.55148,10.00444,45.00,0.00,473.43

@StrandedKitty
Copy link
Owner Author

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.

@kayD
Copy link

kayD commented Oct 11, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants