Minkowski subtraction

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Minkowski subtraction

tjhowse
Speaking from a position of profound ignorance on the implementation: Would it be possible to do a minkowski subtraction?

I'm designing a wing for an RC plane. I generate an airfoil shape, linear extrude it and minkowski with sphere(r=skin_thickness), then subtract the original extruded shape to give me the skin. I then want to add ribbed reenforcement to the inside by interersecting the extrusion minus a minkowski subtraction of the extrusion, with a lattice of rib-thickness planes. Union the lattice structure with the skin and you have a super strong object.

The presently possible solution is to sum onto the airfoil twice, but each time you add a layer the airfoil gets "puffier". I suppose I could doctor the trailing edge with a wedge shape, and it should retain most of its aerodynamic properties.
Reply | Threaded
Open this post in threaded view
|

Re: Minkowski subtraction

Giles Bathgate-2
It sounds to me like you are firstly using minkowski to simulate an
offset module, and then in the second example you are wanting an
"inset" module. Unfortunately openscad doesn't yet support inset or
offsets. Its a much needed addition to openscad. As far as I know CGAL
doesn't support minkowski subtraction as you describe it either.

Regards

Giles.

On 17 August 2012 14:12, tjhowse <[hidden email]> wrote:

> Speaking from a position of profound ignorance on the implementation: Would
> it be possible to do a minkowski subtraction?
>
> I'm designing a wing for an RC plane. I generate an airfoil shape, linear
> extrude it and minkowski with sphere(r=skin_thickness), then subtract the
> original extruded shape to give me the skin. I then want to add ribbed
> reenforcement to the inside by interersecting the extrusion minus a
> minkowski subtraction of the extrusion, with a lattice of rib-thickness
> planes. Union the lattice structure with the skin and you have a super
> strong object.
>
> The presently possible solution is to sum onto the airfoil twice, but each
> time you add a layer the airfoil gets "puffier". I suppose I could doctor
> the trailing edge with a wedge shape, and it should retain most of its
> aerodynamic properties.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566

Reply | Threaded
Open this post in threaded view
|

Re: Minkowski subtraction

nophead
I have used 2D Minkowski to offset inwards using a trick. I put a break in the shape on a flat side just bigger than twice the circle I am using for the offset. That makes the sum go inside the shape as well as outside. I then repair the hole I have made and intersect with the original shape to remove the unwanted expansion of the outside.

I presume it would work in 3D as well.

On 17 August 2012 14:19, Giles Bathgate <[hidden email]> wrote:
It sounds to me like you are firstly using minkowski to simulate an
offset module, and then in the second example you are wanting an
"inset" module. Unfortunately openscad doesn't yet support inset or
offsets. Its a much needed addition to openscad. As far as I know CGAL
doesn't support minkowski subtraction as you describe it either.

Regards

Giles.

On 17 August 2012 14:12, tjhowse <[hidden email]> wrote:
> Speaking from a position of profound ignorance on the implementation: Would
> it be possible to do a minkowski subtraction?
>
> I'm designing a wing for an RC plane. I generate an airfoil shape, linear
> extrude it and minkowski with sphere(r=skin_thickness), then subtract the
> original extruded shape to give me the skin. I then want to add ribbed
> reenforcement to the inside by interersecting the extrusion minus a
> minkowski subtraction of the extrusion, with a lattice of rib-thickness
> planes. Union the lattice structure with the skin and you have a super
> strong object.
>
> The presently possible solution is to sum onto the airfoil twice, but each
> time you add a layer the airfoil gets "puffier". I suppose I could doctor
> the trailing edge with a wedge shape, and it should retain most of its
> aerodynamic properties.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

Reply | Threaded
Open this post in threaded view
|

Re: Minkowski subtraction

Giles Bathgate-2
Can you explain what you mean by a "break in the shape" perhaps a
quick example using 2D.

Regards

Giles

On 17 August 2012 14:40, nop head <[hidden email]> wrote:
> I have used 2D Minkowski to offset inwards using a trick. I put a break in
> the shape on a flat side just bigger than twice the circle I am using for
> the offset. That makes the sum go inside the shape as well as outside. I
> then repair the hole I have made and intersect with the original shape to
> remove the unwanted expansion of the outside.

Reply | Threaded
Open this post in threaded view
|

Re: Minkowski subtraction

nophead
In reply to this post by nophead
Also when you offset inwards with a circle you can generate sharp corners, unlike outwards which has rounded corners. To get round that I offset too far inwards and then offset outwards again with a circle to get a rounded interior.

Here is an example of tripple Minskowski I have been meaning to blog.

module inner_shape(width, height) {
    rad = 4;
    inset = 10 + rad;

    minkowski() {
        render() difference() {
            shape(width, height);
            union() {
               minkowski() {
                    difference() {
                        minkowski() {
                            shape(width, height);
                            circle(r = 1, center = true);
                        }
                        shape(width, height);
                        translate([width -1, -inset])
                            square([3, 2 * inset + 1]);
                    }
                    circle(r = inset);
                }
                translate([width - inset - eta, -2 * inset])
                    square([2 * inset + 1 + 2 * eta, 4 * inset]);
            }
        }
        circle(rad);
    }
}




On 17 August 2012 14:40, nop head <[hidden email]> wrote:
I have used 2D Minkowski to offset inwards using a trick. I put a break in the shape on a flat side just bigger than twice the circle I am using for the offset. That makes the sum go inside the shape as well as outside. I then repair the hole I have made and intersect with the original shape to remove the unwanted expansion of the outside.

I presume it would work in 3D as well.


On 17 August 2012 14:19, Giles Bathgate <[hidden email]> wrote:
It sounds to me like you are firstly using minkowski to simulate an
offset module, and then in the second example you are wanting an
"inset" module. Unfortunately openscad doesn't yet support inset or
offsets. Its a much needed addition to openscad. As far as I know CGAL
doesn't support minkowski subtraction as you describe it either.

Regards

Giles.

On 17 August 2012 14:12, tjhowse <[hidden email]> wrote:
> Speaking from a position of profound ignorance on the implementation: Would
> it be possible to do a minkowski subtraction?
>
> I'm designing a wing for an RC plane. I generate an airfoil shape, linear
> extrude it and minkowski with sphere(r=skin_thickness), then subtract the
> original extruded shape to give me the skin. I then want to add ribbed
> reenforcement to the inside by interersecting the extrusion minus a
> minkowski subtraction of the extrusion, with a lattice of rib-thickness
> planes. Union the lattice structure with the skin and you have a super
> strong object.
>
> The presently possible solution is to sum onto the airfoil twice, but each
> time you add a layer the airfoil gets "puffier". I suppose I could doctor
> the trailing edge with a wedge shape, and it should retain most of its
> aerodynamic properties.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


Reply | Threaded
Open this post in threaded view
|

Re: Minkowski subtraction

nophead
In reply to this post by Giles Bathgate-2
See my post that crossed. I use one Minkowski and a difference to make an outline of the shape. Then I cut a square out it it to let the next Minkowski get inside. Then I patch up the gap with unioning another square.

On 17 August 2012 14:45, Giles Bathgate <[hidden email]> wrote:
Can you explain what you mean by a "break in the shape" perhaps a
quick example using 2D.

Regards

Giles

On 17 August 2012 14:40, nop head <[hidden email]> wrote:
> I have used 2D Minkowski to offset inwards using a trick. I put a break in
> the shape on a flat side just bigger than twice the circle I am using for
> the offset. That makes the sum go inside the shape as well as outside. I
> then repair the hole I have made and intersect with the original shape to
> remove the unwanted expansion of the outside.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

Reply | Threaded
Open this post in threaded view
|

Re: Minkowski subtraction

tjhowse
That's a pretty ingenious hack. I'll give it a try.

On 17 August 2012 23:49, nop head <[hidden email]> wrote:
See my post that crossed. I use one Minkowski and a difference to make an outline of the shape. Then I cut a square out it it to let the next Minkowski get inside. Then I patch up the gap with unioning another square.


On 17 August 2012 14:45, Giles Bathgate <[hidden email]> wrote:
Can you explain what you mean by a "break in the shape" perhaps a
quick example using 2D.

Regards

Giles

On 17 August 2012 14:40, nop head <[hidden email]> wrote:
> I have used 2D Minkowski to offset inwards using a trick. I put a break in
> the shape on a flat side just bigger than twice the circle I am using for
> the offset. That makes the sum go inside the shape as well as outside. I
> then repair the hole I have made and intersect with the original shape to
> remove the unwanted expansion of the outside.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

Reply | Threaded
Open this post in threaded view
|

Re: Minkowski subtraction

clothbot
In reply to this post by tjhowse
On 2012-08-17, at 9:12 AM, tjhowse wrote:

Speaking from a position of profound ignorance on the implementation: Would it be possible to do a minkowski subtraction?

I'm designing a wing for an RC plane. I generate an airfoil shape, linear extrude it and minkowski with sphere(r=skin_thickness), then subtract the original extruded shape to give me the skin. I then want to add ribbed reenforcement to the inside by interersecting the extrusion minus a minkowski subtraction of the extrusion, with a lattice of rib-thickness planes. Union the lattice structure with the skin and you have a super strong object.

The presently possible solution is to sum onto the airfoil twice, but each time you add a layer the airfoil gets "puffier". I suppose I could doctor the trailing edge with a wedge shape, and it should retain most of its aerodynamic properties.

It's a bit compute-intensive, but you can accomplish this "for sufficiently thin wall thicknesses" by performing a union of the difference of the object with itself translated by the thickness amount in many directions.  See below.

Andrew.


--snip--

// shell_3d() module

module shell_3d(th=0.1,N=4) {
 union() {
 // Top
  render() difference() {
    child(0);
    translate([0,0,-th]) child(0);
  }
 // Bottom
  render() difference() {
    child(0);
    translate([0,0,th]) child(0);
  }
 // In XY plane
  for(i=[0:N-1]) assign(rotAngle=360*i/N) {
    render() difference() {
      child(0);
      translate([th*cos(rotAngle),th*sin(rotAngle),0]) child(0);
    }
  }
 // In Top half at 45 degrees
  for(i=[0:N-1]) assign(rotAngle=360*(i+0.5)/N) {
    render() difference() {
      child(0);
      translate([th*sqrt(0.5)*cos(rotAngle),th*sqrt(0.5)*sin(rotAngle),th*sqrt(0.5)]) child(0);
    }
  }
 // In Bottom half at 45 degrees
  for(i=[0:N-1]) assign(rotAngle=360*(i+0.5)/N) {
    render() difference() {
      child(0);
      translate([th*sqrt(0.5)*cos(rotAngle),th*sqrt(0.5)*sin(rotAngle),-th*sqrt(0.5)]) child(0);
    }
  }
 }
}

difference() {
  union() {
    shell_3d(th=0.5,N=4) {
      sphere(r=10.0,center=true);
    }
    shell_3d(th=0.5,N=4) {
      cube(14.0,center=true);
    }
    translate([0,0,20]) shell_3d(th=0.5,N=4) union() {
      sphere(r=10.0,center=true);
      cube(14.0,center=true);
    }
  }
  cube(size=[10.0,10.0,20.0],center=false);
}

--end-snip--

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/



Reply | Threaded
Open this post in threaded view
|

Re: Minkowski subtraction

tjhowse
I implemented a variant of nophead's technique here:

https://github.com/tjhowse/printawing/blob/nophead/wing.scad

Still a work in progress, lot of junk and unused code, but it proves the concept.

Takes a while to render, but works very well. The wing prints nicely too.

On 18 August 2012 00:02, Andrew Plumb <[hidden email]> wrote:
On 2012-08-17, at 9:12 AM, tjhowse wrote:

Speaking from a position of profound ignorance on the implementation: Would it be possible to do a minkowski subtraction?

I'm designing a wing for an RC plane. I generate an airfoil shape, linear extrude it and minkowski with sphere(r=skin_thickness), then subtract the original extruded shape to give me the skin. I then want to add ribbed reenforcement to the inside by interersecting the extrusion minus a minkowski subtraction of the extrusion, with a lattice of rib-thickness planes. Union the lattice structure with the skin and you have a super strong object.

The presently possible solution is to sum onto the airfoil twice, but each time you add a layer the airfoil gets "puffier". I suppose I could doctor the trailing edge with a wedge shape, and it should retain most of its aerodynamic properties.

It's a bit compute-intensive, but you can accomplish this "for sufficiently thin wall thicknesses" by performing a union of the difference of the object with itself translated by the thickness amount in many directions.  See below.

Andrew.


--snip--

// shell_3d() module

module shell_3d(th=0.1,N=4) {
 union() {
 // Top
  render() difference() {
    child(0);
    translate([0,0,-th]) child(0);
  }
 // Bottom
  render() difference() {
    child(0);
    translate([0,0,th]) child(0);
  }
 // In XY plane
  for(i=[0:N-1]) assign(rotAngle=360*i/N) {
    render() difference() {
      child(0);
      translate([th*cos(rotAngle),th*sin(rotAngle),0]) child(0);
    }
  }
 // In Top half at 45 degrees
  for(i=[0:N-1]) assign(rotAngle=360*(i+0.5)/N) {
    render() difference() {
      child(0);
      translate([th*sqrt(0.5)*cos(rotAngle),th*sqrt(0.5)*sin(rotAngle),th*sqrt(0.5)]) child(0);
    }
  }
 // In Bottom half at 45 degrees
  for(i=[0:N-1]) assign(rotAngle=360*(i+0.5)/N) {
    render() difference() {
      child(0);
      translate([th*sqrt(0.5)*cos(rotAngle),th*sqrt(0.5)*sin(rotAngle),-th*sqrt(0.5)]) child(0);
    }
  }
 }
}

difference() {
  union() {
    shell_3d(th=0.5,N=4) {
      sphere(r=10.0,center=true);
    }
    shell_3d(th=0.5,N=4) {
      cube(14.0,center=true);
    }
    translate([0,0,20]) shell_3d(th=0.5,N=4) union() {
      sphere(r=10.0,center=true);
      cube(14.0,center=true);
    }
  }
  cube(size=[10.0,10.0,20.0],center=false);
}

--end-snip--

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/




_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

Reply | Threaded
Open this post in threaded view
|

Re: Minkowski subtraction

Giles Bathgate-2

I suspected that it would take ages to render. Does anyone know how we might go about implementing a 3d offset module it would be very handy.
On Aug 18, 2012 1:49 PM, "tjhowse" <[hidden email]> wrote:
>
> I implemented a variant of nophead's technique here:
>
> https://github.com/tjhowse/printawing/blob/nophead/wing.scad
>
> Still a work in progress, lot of junk and unused code, but it proves the concept.
>
> Takes a while to render, but works very well. The wing prints nicely too.
>
> On 18 August 2012 00:02, Andrew Plumb <[hidden email]> wrote:
>>
>> On 2012-08-17, at 9:12 AM, tjhowse wrote:
>>
>>> Speaking from a position of profound ignorance on the implementation: Would it be possible to do a minkowski subtraction?
>>>
>>> I'm designing a wing for an RC plane. I generate an airfoil shape, linear extrude it and minkowski with sphere(r=skin_thickness), then subtract the original extruded shape to give me the skin. I then want to add ribbed reenforcement to the inside by interersecting the extrusion minus a minkowski subtraction of the extrusion, with a lattice of rib-thickness planes. Union the lattice structure with the skin and you have a super strong object.
>>>
>>> The presently possible solution is to sum onto the airfoil twice, but each time you add a layer the airfoil gets "puffier". I suppose I could doctor the trailing edge with a wedge shape, and it should retain most of its aerodynamic properties.
>>
>>
>> It's a bit compute-intensive, but you can accomplish this "for sufficiently thin wall thicknesses" by performing a union of the difference of the object with itself translated by the thickness amount in many directions.  See below.
>>
>> Andrew.
>>
>>
>> --snip--
>>
>> // shell_3d() module
>>
>> module shell_3d(th=0.1,N=4) {
>>  union() {
>>  // Top
>>   render() difference() {
>>     child(0);
>>     translate([0,0,-th]) child(0);
>>   }
>>  // Bottom
>>   render() difference() {
>>     child(0);
>>     translate([0,0,th]) child(0);
>>   }
>>  // In XY plane
>>   for(i=[0:N-1]) assign(rotAngle=360*i/N) {
>>     render() difference() {
>>       child(0);
>>       translate([th*cos(rotAngle),th*sin(rotAngle),0]) child(0);
>>     }
>>   }
>>  // In Top half at 45 degrees
>>   for(i=[0:N-1]) assign(rotAngle=360*(i+0.5)/N) {
>>     render() difference() {
>>       child(0);
>>       translate([th*sqrt(0.5)*cos(rotAngle),th*sqrt(0.5)*sin(rotAngle),th*sqrt(0.5)]) child(0);
>>     }
>>   }
>>  // In Bottom half at 45 degrees
>>   for(i=[0:N-1]) assign(rotAngle=360*(i+0.5)/N) {
>>     render() difference() {
>>       child(0);
>>       translate([th*sqrt(0.5)*cos(rotAngle),th*sqrt(0.5)*sin(rotAngle),-th*sqrt(0.5)]) child(0);
>>     }
>>   }
>>  }
>> }
>>
>> difference() {
>>   union() {
>>     shell_3d(th=0.5,N=4) {
>>       sphere(r=10.0,center=true);
>>     }
>>     shell_3d(th=0.5,N=4) {
>>       cube(14.0,center=true);
>>     }
>>     translate([0,0,20]) shell_3d(th=0.5,N=4) union() {
>>       sphere(r=10.0,center=true);
>>       cube(14.0,center=true);
>>     }
>>   }
>>   cube(size=[10.0,10.0,20.0],center=false);
>> }
>>
>> --end-snip--
>>
>> --
>>
>> "The future is already here.  It's just not very evenly distributed" -- William Gibson
>>
>> Me: http://clothbot.com/wiki/
>>
>>
>>
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> [hidden email]
>> http://rocklinux.net/mailman/listinfo/openscad
>> http://openscad.org - https://flattr.com/thing/121566
>
>
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566