This week I’ve been continuing some of the work I did during the recent Forma Hackathon in Oslo.
Part of this was using the Forma Elements API to extract information about buildings included in the “proposal” being developed. For the Hackathon I’d hardcoded the size of the buildings - the number of floors and the heights of each floor - but the Forma team (thanks, Vilde!) has been helping me figure out how to get this information from Forma. In a nutshell, it’s possible to get the grossFloorAreaPolygons for the building of interest and then analyze the associated data: the elevations of each floor, the number of floors and even the polygons representing the each floor’s outline.
I’d originally used VASA to calculate sample points for the building - that we could use to approximate window locations - but I found that using the polygons for each floor would allow us to get regularly spaced windows and more easily determine which side we would be looking out from. (I used a simple cross product of the direction we follow the polygonal loop with the up vector to get the view direction.)
All in all a much more consistent experience than the one I posted last week. Here you can see the way the cones are projected outwards in a much more predictable way.
Another control I decided to add was for the angle of the cone. Here you can see how that slider works alongside the distance slider to give more control on that front.
One of my initial goals at the Hackathon was to aggregate the results of performing “visibility with a cone” operations from each of the windows to show a single mesh with the visibility results merged.
This was actually a non-trivial problem, mainly because I needed to expose a “Union” function in VASA that creates a single VoxelModel from a list of them. Emscripten - which we’re using to build the WebAssembly package from the C++ codebase - is very picky about passing objects as pointers. I ended up having to build in a local lambda function to do some custom marshaling from a vector of objects to a vector of pointers. Tricky stuff, but it seems to be working well.
Here’s a view showing the unioned visibility cones for the whole building at the same time. It’s a little slow to generate (it takes about 5 seconds or so), but it’s pretty.
Speaking of pretty, here’s a view that was generated somewhere along the way. I’m really enjoying working with Forma as a visualization platform!
That’s it for now. See you next time.