discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Minkowski rounings with Sphere

S
Snörre
Mon, May 11, 2020 12:27 PM

Hello together,

the Minkowski function I think is to make a cube round, right?
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.

In  the actual version I need to do:

minkowski()
{
cube([90,50,10], center = true);
sphere(r=5, $fn = 36);}

Or I do it with variables:

RoundingBox = 5;

minkowski()
{
cube([100-RoundingBox2,60-RoundingBox2,20-RoundingBox*2], center =
true);
sphere(r=5, $fn = 36);}

So, why not including the roundings directly into Minkowski?

Greetings

--
Sent from: http://forum.openscad.org/

Hello together, the Minkowski function I think is to make a cube round, right? 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. In the actual version I need to do: minkowski() { cube([90,50,10], center = true); sphere(r=5, $fn = 36);} Or I do it with variables: RoundingBox = 5; minkowski() { cube([100-RoundingBox*2,60-RoundingBox*2,20-RoundingBox*2], center = true); sphere(r=5, $fn = 36);} So, why not including the roundings directly into Minkowski? Greetings -- Sent from: http://forum.openscad.org/
NH
nop head
Mon, May 11, 2020 1:01 PM

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 prolaser@t-online.de wrote:

Hello together,

the Minkowski function I think is to make a cube round, right?
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.

In  the actual version I need to do:

minkowski()
{
cube([90,50,10], center = true);
sphere(r=5, $fn = 36);}

Or I do it with variables:

RoundingBox = 5;

minkowski()
{
cube([100-RoundingBox2,60-RoundingBox2,20-RoundingBox*2], center =
true);
sphere(r=5, $fn = 36);}

So, why not including the roundings directly into Minkowski?

Greetings

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 <prolaser@t-online.de> wrote: > Hello together, > > the Minkowski function I think is to make a cube round, right? > 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. > > In the actual version I need to do: > > minkowski() > { > cube([90,50,10], center = true); > sphere(r=5, $fn = 36);} > > Or I do it with variables: > > RoundingBox = 5; > > minkowski() > { > cube([100-RoundingBox*2,60-RoundingBox*2,20-RoundingBox*2], center = > true); > sphere(r=5, $fn = 36);} > > > So, why not including the roundings directly into Minkowski? > > Greetings > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
RW
Rogier Wolff
Mon, May 11, 2020 2:20 PM

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 prolaser@t-online.de 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-RoundingBox2,60-RoundingBox2,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. 

--
** R.E.Wolff@BitWizard.nl ** 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.

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 <prolaser@t-online.de> 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. -- ** R.E.Wolff@BitWizard.nl ** 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.
L
lar3ry
Mon, May 11, 2020 3:43 PM

If you don't mind using libraries, you could use BOSL2. You can find it at
https://github.com/revarbat/BOSL2
There is a Wiki there as well.

include <BOSL2/std.scad>
$fn=60;

cuboid([100,60,20], rounding=5);

http://forum.openscad.org/file/t2121/rounded_cube.png

--
Sent from: http://forum.openscad.org/

If you don't mind using libraries, you could use BOSL2. You can find it at https://github.com/revarbat/BOSL2 There is a Wiki there as well. include <BOSL2/std.scad> $fn=60; cuboid([100,60,20], rounding=5); <http://forum.openscad.org/file/t2121/rounded_cube.png> -- Sent from: http://forum.openscad.org/