Tag Archives: 3D

3D diffs in Github

STL is a standard file type used to store data about 3D objects. Like bitmaps for 2D images. Github gave the ability to visualize these files in the site some time back, now they let us view the diffs as well.

How does this work? We take both versions of the model, and using binary space partitioning, we compute the added, removed, and unchanged parts. This is done using csgtool, a C library paired with a Ruby gem via FFI. These pieces are cached and displayed by the 3D viewer we already have, though we color them differently and play with their transparency to help illustrate the changes.

How does one see diffs in 3D objects? You paint the deleted parts in red and the newly added parts in green. Ha! You didn’t see that coming. Also, the thing rotates! There’s also a slider to animate the diff.