# [S3DB-dev] roof lines by skeleton for non-rectangle buildings

As some of us experimented with a straight-skeleton approach to create complex roof lines I think we need a common way to decide when it should be used. Currently what I do is compare the area of the outline with the oriented bounding box: Skeleton is used when ‘area of obb > area of outline * 1.2’ or when the outline contains holes - so this is pretty arbitrary

I think it would be good to have a tag like roof:orientation:multi=yes when a skeleton interpretation for the roof is applicable.

I’m using straight_skeleton when polygon is not flag with “roof:orientation=across” as i didn’t find any smart solution for that.

This is still a work in progress so it can’t be seen in F4-map for now but i’m quite happy with the results and hope to release it soon.

Edit: I removed the test for polygon with more than 5 points and polygon with at least 1 hole as it often leads to strange result

We released the straight skeleton code this morning (it is not fully stable but we need feedback)

Berlin (some spot with many gambrel roofs):
http://map.f4-group.com/#lat=52.5295876&lon=13.4283313&zoom=18&camera.theta=45.859&camera.phi=5.443

Good job guys!

I’m still working on straight skeletons and i ended up with roof:orientation as the best candidate to decide to use skeleton or not:

tag orientation is not present → compute and use the straight skeleton algorithm.

roof:orientation=across → straight skeleton can’t be computed as it doesn’t make sense, compute minimal oriented OBox and use the smallest edge as ridge.

roof:orientation=along → the mapper knows that the roof has a single straight ridge along the building, compute minimal oriented OBox and use the longest edge as ridge.

@j3d & @Kendzi what do you think about tweaking our engines to match this idea to get similar behavior ?

I’m using very similar algorithm. In short:

• Is tag direction → Square like
• Is tag orientation → Square like
• Has holes → Skeleton like
• Oriented bbox area greater 120% of polygon area → Skeleton like
• Else Square like

Great, i’ll match your behavior in F4Map.

But i won’t base the detection on hole because when we remove parts from the outline it generates holes (for example when there are parts representing chimney or dormers).