Hi! This is someting to use when there is a need for tolerance in custom direction, and model definition hasn’t proper tolerance adjust.
Example for create socket in plate:
How this works:
According to wiki: “For all non-empty subsets S1 and S2 of a real vector space, the convex hull of their Minkowski sum is the Minkowski sum of their convex hulls”. In other words concave mesh is ‘convex decomposed’ to convex parts using library ‘CoACD’, then convex parts are added together, on result is performed convex hull, and on the last step all parts are Union together using library ‘Manifold3d’.
Note:
Before you run .gh attached example files, disable solver for finish download needed python libraries: "CoACD, Manifold3d, Scipy, Trimesh’. When is all ok, click button ‘Run MinSum’ - its added to prevent ‘Race condition’ when loading file (is likely of c# loading scripts).
Case One:
The creation of XT60E socket, mounted in 3d printed plate:
In my OpenSCAD days, it was an Ace when dealing with assembly parts, and to compansate shrinkage when annealing special PLA material blend. I hope you find it’s interesting.
Create empty Python script, open it, go to packet menager and start adding:
coacd, scipy, trimesh, manifold3d, wait for install, component can be delated.
Enable component Minkowski. click button or hardwired it.
This way Grashopper will cache libraries on fresh start.
Thanks. I looked at the simple iphone example you posted before but for the subtraction of this plug I don’t understand the point yet. The geometry in the layer XT60E Result Minkowski appears to be an offset version of the exact geometry.
that’s the core behavior of the Minkowski sum, in GH terms it’s like if you translate B on “every possible superposition” over item A (no change of its orientation) and then make the final boolean solid union of all the states of all the Bs together
like here, imagine you translate B in every possible position over A:
Thanks @inno I understand it on the iPhone example but on the other object the OP showed I don’t see what it does just yet?
To be able to subtract the overall shape of a plug, something like a multi level convex hull would be needed. There was another topic not long ago about this but I don’t remember which it was.
Depending on the needed resolution, this could be done with Isopod or Shrinkwrap.
the result of the operation is similar to a solid offset, but the way you get to the final shape is through applying a solid part (B) over another solid part (A)
OP’s example is nice, but in order to really show the magic of this I think it would be even better to show a part B which does not have axial simmetry, or off center
when you “slide” the tolerance cube over the surface of the plug (front view) you get a theoretical situation like this:
but instead of a cube centered on its perfect center you could use something like half a cube half a sphere, and you would get all the rightside of the original object with fillets and all the leftside of the object with sharp edge:
Version 2:
Added: Component to ensure all Python libs are loaded.
Added: ‘C# Braker’ to pass data inputs A, B when are not null, and input EN must be True.
Added: ‘PMP CHull’ list of cloudpoints are hulled in parallel, using ThreadPoolExecutor.
Added: More robust validation of face mesh.
This works but I’m still wondering about the actual use? Your shape for the population is a simple cube so the result is very close if not identical to an offset…
Ok, Martin so as you saw exemples of sweeping shape B along surface of A (thanks to inno), next thing is montion plannig:
Take for example static 3d game level and yours movable actor is inscribe in static box (non rotational - sbox) with point represent centrum of mass.
Now you can use two approches of colision detection (family of C-space):
Per basis, on demand actor and game objects using GJK (minkowski difference), not suitable for checkings colisons with ceilings, walls etc.,
too much pipeline overload.
Create geodata, volume boundary domain for allowed movment by sweeping all static walls, ceilings, ground etc. - with your actor box representation (minkowski sum): domain XY: -half size xy to + half size xy of this sbox, and for Z: - max heigth of sbox from center of mass (head of an actor close to ceiling) To some positive value for feet above ground. It’s very efficient way of colisions avoidence, because it’s baked and can be updated (add extra boolan union to domain during cut-scene). deep dive overview
For tweaking Convex decomposition, link to coacd api (in YNCD cluster): CoACD API documentation
I left everything at default, except PCA alignment, an extrusion post-processing is controled by boolan TORB.
I like this cluster approch it can restrict the preview to core components of function. And I would like to learn more of how to make c-bindings, and use Native-library or PInvoke to implement bindings into C# code, but c’mon I bought Rhino to use Grasshopper, not visual studio, moreover all this libs uses py-binding, python script only send data to C++, performance lost is minimal, anyway it’s weekend project and unique at least on forum
An example of collision detection, using ‘minkowski difference’, GJK is simplified version of this.
The transparent elements show the detection status. The Minkowski difference result moves, in sync to -B, when B tuches A, then result of op. contains the point [0,0,0] and a collision is found. Video below.