On Mon, May 11, 2020 at 02:01:37PM +0100, nop head wrote:
> Because a Minkowski sum is a mathematical operation that sums two sets of
> points in all combinations to make a new set of points.
>
> On Mon, 11 May 2020 at 13:28, Snörre <
[hidden email]> wrote:
>
> > Hello together,
> >
> > the Minkowski function I think is to make a cube round, right?
No. Minkowski is an operation that CAN be used to make a cube round.
Minkovsky does a UNION between ALL resulting objects when you
translate one object along a vector with the endpoint inside the
second object. This looks "asymmetric" but it isn't: the result is the
same whichever way around you do it.
So for the rounded box, you might think that you're shifting the box
around along all points inside the sphere, but the same rounded box is
what you get when you move the sphere around all the vectors that fall
inside the cube.
> > So why is the radius added to the cube?
> > At least I work like this. I need a specific cube size with rounded edges.
> > Example:
> >
> > I need a box with 100 x 60 x 20 with roundings 5.
I'd make a module rounded box that does...
> > minkowski()
> > {
> > cube([100-RoundingBox*2,60-RoundingBox*2,20-RoundingBox*2], center =
> > true);
> > sphere(r=5, $fn = 36);}
... this.
But because of the "all possible vectors" and then a union across all
those objects, the minkowski operation is very expensive.
So for rounded box I'd write:
module roundedbox (x, y, z, r)
{
x2=x/2-r;
y2=y/2-r;
z2=z/2-r;
hull () {
translate ([ x2, y2, z2]) sphere (r=r);
translate ([ x2, y2,-z2]) sphere (r=r);
translate ([ x2,-y2, z2]) sphere (r=r);
translate ([-x2,-y2,-z2]) sphere (r=r);
translate ([-x2, y2, z2]) sphere (r=r);
translate ([-x2,-y2,-z2]) sphere (r=r);
translate ([-x2,-y2, z2]) sphere (r=r);
}
}
This is much faster than the minkovsky.
Roger.
--
**
[hidden email] **
https://www.BitWizard.nl/ ** +31-15-2049110 **
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org