Montag, 29. Februar 2016

Straight Skeleton on .NET

As you may read on wikipedia, Straight Skeleton is method of representing a polygon by topological skeleton [1]. Well, this is not self describing words but let's see usage examples as it's widely used.  First time I've heard about this algorithm when I was trying to visualize gabled roofs in 3D [2] from OSM buildings data and it looks like this algorithm is right way to construct roof shape:  


Next time, I found that it is also useful for indoor environment generating [3] as it produces quite good results for typical building footprint:


However, I was surprised that there was no working .NET implementation. Hopefully, I found some good Java implementation done by kendzi:

"Implementation of straight skeleton algorithm for polygons with holes. It is based on concept of tracking bisector intersection with queue of events to process and circular list with processed events called lavs. This implementation is highly modified concept described by Petr Felkel and Stepan Obdrzalek [1]. In compare to original this algorithm has new kind of event and support for multiple events which appear in the same distance from edges. It is common when processing degenerate cases caused by polygon with right angles." [4]

I decided to port it to .NET taking into account language specific idioms. Original Java code depends on external libraries which provide some primitives: vector, line, ray, etc. My port has no dependencies as I ported all needed classes as well. You can find it on my github page [5].

[1] Wikipedia
[2] OpenStreetMap Simple 3D Buildings
[3] Alexander Dahl, Lars Rinde "Procedural Generation of Indoor Environments"
[4] Straight Skeleton by kendzi
[5] Github repository 

Donnerstag, 18. Februar 2016

Welcome

In this blog, I'm going to share my findings during work on utymap project (former ActionStreetMap). The goal of this project is to render world in 3D using various sources of map data, mostly OpenStreetMap and NaturalEarth.