• Residential
  • Commericial
  • Consulting
  • Previous
  • Blog
    • The Firm
    • Contact
    • Find
Menu

BWA

  • Residential
  • Commericial
  • Consulting
  • Previous
  • Blog
  • About
    • The Firm
    • Contact
    • Find

Hundreds of perforations over hundreds of panels by multi-threading the boolean difference operations.

Multi-Boolean

June 6, 2018

While waiting for one of those seemingly interminable Grasshopper definitions to compute for a project, you know, the one where you force-feed the SDiff component with hundreds of panels, each with hundreds of custom perforations, I thought there had to be a faster way.  And of course, I thought multi-threading would be it.  Unfortunately, boolean operations are notoriously difficult (if not impossible) to run as parallel.

And though it is true we can not multi-thread solid boolean methods, we can, however, spread branches of inputs across threads (thank you data trees). For example, when perforating individual panels, each with their own set of shapes to be differenced, you can run the boolean process for each panel on it’s own thread. It’s not truly multi-threading the boolean operation, but still runs much faster for the branched use case. In fact, I imagine this could help any component that could not otherwise be multi-threaded.

Here is a generic swiss-cheese example with 64 slices:

The boolean difference method employed in the definition is done recursively so that any shapes that fail to difference can be discarded to a list that can be used for troubleshooting without dumping the whole process (sphere in red). This takes a little longer than difference-ing the whole list at once, but it’s negligible and the troubleshooting benefit has proven useful for me.

Here is the Grasshopper definition for the swiss-cheese example:

RecursiveBooleanExample.gh

After searching a bit more following this post to discourse.mcneel.com, I found djordje posted an extremely elegant version of this approach for Python way back in 2014!  

In Grasshopper Tags multi-threaded, c#, boolean
Mesh Patch →

About

This blog primarily exhibits how-to and work-in-progress posts related to Heron, a Grasshopper add-in which BWA developed to import GIS data into the Rhino 3d modeling environment.

Support Heron on Patreon

Latest Posts

Featured
Multi-Boolean
Jun 6, 2018
Multi-Boolean
Jun 6, 2018

Making quick work of custom perforating hundreds of panels by multi-threading boolean difference operations in Grasshopper.

Jun 6, 2018
Mesh Patch
Jun 5, 2018
Mesh Patch
Jun 5, 2018

Have building outlines with courtyards?  Looking for a quick way to turn these into building masses?  The new Mesh Patch command in Rhino 6 can help.

Jun 5, 2018
Slippy Maps in Heron
Apr 20, 2018
Slippy Maps in Heron
Apr 20, 2018

Enabling tile-based image delivery for Heron (WIP)

Apr 20, 2018
Google Street View in Heron
Apr 2, 2018
Google Street View in Heron
Apr 2, 2018

Providing more touch points from the real world in Heron (WIP).

Apr 2, 2018

Archive

© Brian Washburn Architect PC