Mesh Differencing
Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/twodee/blog/wp-includes/wp-db.php on line 3030
Deprecated: parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/class.jetpack.php on line 4255
Deprecated: Creation of dynamic property Jetpack_Carousel::$localize_strings is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/modules/carousel/jetpack-carousel.php on line 339
A feature that I’ve long wanted in Madeup is the ability to subtract away holes from a mesh. I try to implement most features myself, because I want to learn. However, constructive solid geometry is too much for me. I turned to libigl, CGAL, Eigen, and Boost for help, and now I can join solids in interesting ways. The first three things I made? A car body with holes for the axles, a spring-loaded hand cannon with holes for a locking pin, and the requisite six-sided die.
I’m still tweaking the first two, but to commemorate the moment, I’ll share the d6. It was made by creating a cube using the box solidifier and then visiting all the pips as nodes for the spheres solidifier. The difference mesh is computed as die - pips. (Union and intersection are expressed using or and and, respectively.)
/usr/lib/ruby/vendor_ruby/rubygems/dependency.rb:315:in `to_specs': Could not find 'coderay' (>= 0) among 94 total gem(s) (Gem::MissingSpecError) Checked in 'GEM_PATH=/var/www/.local/share/gem/ruby/3.2.0:/var/lib/gems/3.2.0:/usr/local/lib/ruby/gems/3.2.0:/usr/lib/ruby/gems/3.2.0:/usr/lib/x86_64-linux-gnu/ruby/gems/3.2.0:/usr/share/rubygems-integration/3.2.0:/usr/share/rubygems-integration/all:/usr/lib/x86_64-linux-gnu/rubygems-integration/3.2.0:/home/johnch/.gems' , execute `gem env` for more information from /usr/lib/ruby/vendor_ruby/rubygems/dependency.rb:327:in `to_spec' from /usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_gem.rb:57:in `gem' from ./coderay:24:in `'
I didn’t have a real d6 in front of me (the Internet doesn’t count), so I guessed on the face arrangement. It looks like I was wrong. 1 opposes 6, 5 opposes 2, and 3 opposes 4. I hadn’t realized before that opposite faces sum to 7.
The pips should be black, shouldn’t they? Sadly, I don’t think libigl preserves vertex metadata when applying boolean operations between meshes, so coloring them differently seems like a job better suited for a mouse-based modeling program.
