Trying to incorporate equation based shapes.

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

Trying to incorporate equation based shapes.

Kevin Crowley
In my case airfoils.  I want to take a NACA 0030 airfoil as a fuselage and blend it to a NACA 0010
My problem is I can not figure out  out to draw any airfoil.  I've gone through the math sections of the manual and figure I must  be missing something.

This is the equation.
 y_t = \frac{t}{0.2}c\, \left[ 0.2969 \sqrt{\frac{x}{c}} - 0.1260 \left(\frac{x}{c}\right) - 0.3516 \left(\frac{x}{c}\right)^2 + 0.2843 \left(\frac{x}{c}\right)^3 - 0.1015 \left( \frac{x}{c} \right)^4 \right],

where:

  • c is the chord length,
  • x is the position along the chord from 0 to c,
  • y is the half thickness at a given value of x (centerline to surface), and
  • t is the maximum thickness as a fraction of the chord (so 100 t gives the last two digits in the NACA 4-digit denomination).

this is what the cross section of a NACA 0015 looks like

File:NACA0015 a.png


My initial thought had been to lay a series of torpedo shaped sections next to each other and then use hull to join them together but I can't get to the 1st step.


Any help pointing me to the right approach would be greatly appreciated.


Kevin


All equations and pictures were shamelessly acquired from

http://en.wikipedia.org/wiki/NACA_airfoil


Reply | Threaded
Open this post in threaded view
|

Re: Trying to incorporate equation based shapes.

nophead
Perhaps do a 2D hull over a for loop which generates thin rectangles with height equal to Y.

On 4 August 2012 13:26, Kevin Crowley <[hidden email]> wrote:
In my case airfoils.  I want to take a NACA 0030 airfoil as a fuselage and blend it to a NACA 0010
My problem is I can not figure out  out to draw any airfoil.  I've gone through the math sections of the manual and figure I must  be missing something.

This is the equation.
 y_t = \frac{t}{0.2}c\, \left[ 0.2969 \sqrt{\frac{x}{c}} - 0.1260 \left(\frac{x}{c}\right) - 0.3516 \left(\frac{x}{c}\right)^2 + 0.2843 \left(\frac{x}{c}\right)^3 - 0.1015 \left( \frac{x}{c} \right)^4 \right],

where:

  • c is the chord length,
  • x is the position along the chord from 0 to c,
  • y is the half thickness at a given value of x (centerline to surface), and
  • t is the maximum thickness as a fraction of the chord (so 100 t gives the last two digits in the NACA 4-digit denomination).

this is what the cross section of a NACA 0015 looks like

File:NACA0015 a.png


My initial thought had been to lay a series of torpedo shaped sections next to each other and then use hull to join them together but I can't get to the 1st step.


Any help pointing me to the right approach would be greatly appreciated.


Kevin


All equations and pictures were shamelessly acquired from

http://en.wikipedia.org/wiki/NACA_airfoil



_______________________________________________
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: Trying to incorporate equation based shapes.

Kevin Crowley
Or maybe skinny boxes.

On Sat, Aug 4, 2012 at 7:37 AM, nop head <[hidden email]> wrote:
Perhaps do a 2D hull over a for loop which generates thin rectangles with height equal to Y.

On 4 August 2012 13:26, Kevin Crowley <[hidden email]> wrote:
In my case airfoils.  I want to take a NACA 0030 airfoil as a fuselage and blend it to a NACA 0010
My problem is I can not figure out  out to draw any airfoil.  I've gone through the math sections of the manual and figure I must  be missing something.

This is the equation.
 y_t = \frac{t}{0.2}c\, \left[ 0.2969 \sqrt{\frac{x}{c}} - 0.1260 \left(\frac{x}{c}\right) - 0.3516 \left(\frac{x}{c}\right)^2 + 0.2843 \left(\frac{x}{c}\right)^3 - 0.1015 \left( \frac{x}{c} \right)^4 \right],

where:

  • c is the chord length,
  • x is the position along the chord from 0 to c,
  • y is the half thickness at a given value of x (centerline to surface), and
  • t is the maximum thickness as a fraction of the chord (so 100 t gives the last two digits in the NACA 4-digit denomination).

this is what the cross section of a NACA 0015 looks like

File:NACA0015 a.png


My initial thought had been to lay a series of torpedo shaped sections next to each other and then use hull to join them together but I can't get to the 1st step.


Any help pointing me to the right approach would be greatly appreciated.


Kevin


All equations and pictures were shamelessly acquired from

http://en.wikipedia.org/wiki/NACA_airfoil



_______________________________________________
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: Trying to incorporate equation based shapes.

Brad Pitcher
In reply to this post by Kevin Crowley

You're having trouble with the 2D part? You might get it to work with my 2D graphing library:
http://www.thingiverse.com/thing:11243

On Aug 4, 2012 5:26 AM, "Kevin Crowley" <[hidden email]> wrote:
In my case airfoils.  I want to take a NACA 0030 airfoil as a fuselage and blend it to a NACA 0010
My problem is I can not figure out  out to draw any airfoil.  I've gone through the math sections of the manual and figure I must  be missing something.

This is the equation.
 y_t = \frac{t}{0.2}c\, \left[ 0.2969 \sqrt{\frac{x}{c}} - 0.1260 \left(\frac{x}{c}\right) - 0.3516 \left(\frac{x}{c}\right)^2 + 0.2843 \left(\frac{x}{c}\right)^3 - 0.1015 \left( \frac{x}{c} \right)^4 \right],

where:

  • c is the chord length,
  • x is the position along the chord from 0 to c,
  • y is the half thickness at a given value of x (centerline to surface), and
  • t is the maximum thickness as a fraction of the chord (so 100 t gives the last two digits in the NACA 4-digit denomination).

this is what the cross section of a NACA 0015 looks like

File:NACA0015 a.png


My initial thought had been to lay a series of torpedo shaped sections next to each other and then use hull to join them together but I can't get to the 1st step.


Any help pointing me to the right approach would be greatly appreciated.


Kevin


All equations and pictures were shamelessly acquired from

http://en.wikipedia.org/wiki/NACA_airfoil



_______________________________________________
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: Trying to incorporate equation based shapes.

Kevin Crowley
I will look at that.  Thank you.
My problem is four fold.
Primus: I am a NOOB on OpenScad
Secundus: Algorithms for shapes or plotting is not something I have done recently.
Tertius: I can physically draft the shapes I want but my brain freezes when I try it on the computer.
Quartus: I am trying to run with this before I can even toddle as I am being impatient.

 
On Sat, Aug 4, 2012 at 10:25 AM, Brad Pitcher <[hidden email]> wrote:

You're having trouble with the 2D part? You might get it to work with my 2D graphing library:
http://www.thingiverse.com/thing:11243

On Aug 4, 2012 5:26 AM, "Kevin Crowley" <[hidden email]> wrote:
In my case airfoils.  I want to take a NACA 0030 airfoil as a fuselage and blend it to a NACA 0010
My problem is I can not figure out  out to draw any airfoil.  I've gone through the math sections of the manual and figure I must  be missing something.

This is the equation.
 y_t = \frac{t}{0.2}c\, \left[ 0.2969 \sqrt{\frac{x}{c}} - 0.1260 \left(\frac{x}{c}\right) - 0.3516 \left(\frac{x}{c}\right)^2 + 0.2843 \left(\frac{x}{c}\right)^3 - 0.1015 \left( \frac{x}{c} \right)^4 \right],

where:

  • c is the chord length,
  • x is the position along the chord from 0 to c,
  • y is the half thickness at a given value of x (centerline to surface), and
  • t is the maximum thickness as a fraction of the chord (so 100 t gives the last two digits in the NACA 4-digit denomination).

this is what the cross section of a NACA 0015 looks like

File:NACA0015 a.png


My initial thought had been to lay a series of torpedo shaped sections next to each other and then use hull to join them together but I can't get to the 1st step.


Any help pointing me to the right approach would be greatly appreciated.


Kevin


All equations and pictures were shamelessly acquired from

http://en.wikipedia.org/wiki/NACA_airfoil



_______________________________________________
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: Trying to incorporate equation based shapes.

Kevin Crowley
I'm losted. Where do i get the Lib and how do I incorporate it into OpenScad?

On Sat, Aug 4, 2012 at 11:01 AM, Kevin Crowley <[hidden email]> wrote:
I will look at that.  Thank you.
My problem is four fold.
Primus: I am a NOOB on OpenScad
Secundus: Algorithms for shapes or plotting is not something I have done recently.
Tertius: I can physically draft the shapes I want but my brain freezes when I try it on the computer.
Quartus: I am trying to run with this before I can even toddle as I am being impatient.


 
On Sat, Aug 4, 2012 at 10:25 AM, Brad Pitcher <[hidden email]> wrote:

You're having trouble with the 2D part? You might get it to work with my 2D graphing library:
http://www.thingiverse.com/thing:11243

On Aug 4, 2012 5:26 AM, "Kevin Crowley" <[hidden email]> wrote:
In my case airfoils.  I want to take a NACA 0030 airfoil as a fuselage and blend it to a NACA 0010
My problem is I can not figure out  out to draw any airfoil.  I've gone through the math sections of the manual and figure I must  be missing something.

This is the equation.
 y_t = \frac{t}{0.2}c\, \left[ 0.2969 \sqrt{\frac{x}{c}} - 0.1260 \left(\frac{x}{c}\right) - 0.3516 \left(\frac{x}{c}\right)^2 + 0.2843 \left(\frac{x}{c}\right)^3 - 0.1015 \left( \frac{x}{c} \right)^4 \right],

where:

  • c is the chord length,
  • x is the position along the chord from 0 to c,
  • y is the half thickness at a given value of x (centerline to surface), and
  • t is the maximum thickness as a fraction of the chord (so 100 t gives the last two digits in the NACA 4-digit denomination).

this is what the cross section of a NACA 0015 looks like

File:NACA0015 a.png


My initial thought had been to lay a series of torpedo shaped sections next to each other and then use hull to join them together but I can't get to the 1st step.


Any help pointing me to the right approach would be greatly appreciated.


Kevin


All equations and pictures were shamelessly acquired from

http://en.wikipedia.org/wiki/NACA_airfoil



_______________________________________________
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: Trying to incorporate equation based shapes.

Brad Pitcher

First you may want to think about, can the equation be simplified or broken up into a standard Cartesian, polar, or parametric equation? The library only works with those types of equations. Also the equation cannot be recursive.

On Aug 4, 2012 9:09 AM, "Kevin Crowley" <[hidden email]> wrote:
I'm losted. Where do i get the Lib and how do I incorporate it into OpenScad?

On Sat, Aug 4, 2012 at 11:01 AM, Kevin Crowley <[hidden email]> wrote:
I will look at that.  Thank you.
My problem is four fold.
Primus: I am a NOOB on OpenScad
Secundus: Algorithms for shapes or plotting is not something I have done recently.
Tertius: I can physically draft the shapes I want but my brain freezes when I try it on the computer.
Quartus: I am trying to run with this before I can even toddle as I am being impatient.


 
On Sat, Aug 4, 2012 at 10:25 AM, Brad Pitcher <[hidden email]> wrote:

You're having trouble with the 2D part? You might get it to work with my 2D graphing library:
http://www.thingiverse.com/thing:11243

On Aug 4, 2012 5:26 AM, "Kevin Crowley" <[hidden email]> wrote:
In my case airfoils.  I want to take a NACA 0030 airfoil as a fuselage and blend it to a NACA 0010
My problem is I can not figure out  out to draw any airfoil.  I've gone through the math sections of the manual and figure I must  be missing something.

This is the equation.
 y_t = \frac{t}{0.2}c\, \left[ 0.2969 \sqrt{\frac{x}{c}} - 0.1260 \left(\frac{x}{c}\right) - 0.3516 \left(\frac{x}{c}\right)^2 + 0.2843 \left(\frac{x}{c}\right)^3 - 0.1015 \left( \frac{x}{c} \right)^4 \right],

where:

  • c is the chord length,
  • x is the position along the chord from 0 to c,
  • y is the half thickness at a given value of x (centerline to surface), and
  • t is the maximum thickness as a fraction of the chord (so 100 t gives the last two digits in the NACA 4-digit denomination).

this is what the cross section of a NACA 0015 looks like

File:NACA0015 a.png


My initial thought had been to lay a series of torpedo shaped sections next to each other and then use hull to join them together but I can't get to the 1st step.


Any help pointing me to the right approach would be greatly appreciated.


Kevin


All equations and pictures were shamelessly acquired from

http://en.wikipedia.org/wiki/NACA_airfoil



_______________________________________________
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



_______________________________________________
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: Trying to incorporate equation based shapes.

Kevin Crowley
it's been a while for this type of math question. The equation solves for a value  of  |y| for any given x and an arbitrarily assigned value of c where 0=< x <=c. the if you graph all the results of y and -y against a value of x you end up with a symmetrical airfoil.  So I think that makes it is cartesian.  I don't think it is recursive.



On Sat, Aug 4, 2012 at 11:36 AM, Brad Pitcher <[hidden email]> wrote:

First you may want to think about, can the equation be simplified or broken up into a standard Cartesian, polar, or parametric equation? The library only works with those types of equations. Also the equation cannot be recursive.

On Aug 4, 2012 9:09 AM, "Kevin Crowley" <[hidden email]> wrote:
I'm losted. Where do i get the Lib and how do I incorporate it into OpenScad?

On Sat, Aug 4, 2012 at 11:01 AM, Kevin Crowley <[hidden email]> wrote:
I will look at that.  Thank you.
My problem is four fold.
Primus: I am a NOOB on OpenScad
Secundus: Algorithms for shapes or plotting is not something I have done recently.
Tertius: I can physically draft the shapes I want but my brain freezes when I try it on the computer.
Quartus: I am trying to run with this before I can even toddle as I am being impatient.


 
On Sat, Aug 4, 2012 at 10:25 AM, Brad Pitcher <[hidden email]> wrote:

You're having trouble with the 2D part? You might get it to work with my 2D graphing library:
http://www.thingiverse.com/thing:11243

On Aug 4, 2012 5:26 AM, "Kevin Crowley" <[hidden email]> wrote:
In my case airfoils.  I want to take a NACA 0030 airfoil as a fuselage and blend it to a NACA 0010
My problem is I can not figure out  out to draw any airfoil.  I've gone through the math sections of the manual and figure I must  be missing something.

This is the equation.
 y_t = \frac{t}{0.2}c\, \left[ 0.2969 \sqrt{\frac{x}{c}} - 0.1260 \left(\frac{x}{c}\right) - 0.3516 \left(\frac{x}{c}\right)^2 + 0.2843 \left(\frac{x}{c}\right)^3 - 0.1015 \left( \frac{x}{c} \right)^4 \right],

where:

  • c is the chord length,
  • x is the position along the chord from 0 to c,
  • y is the half thickness at a given value of x (centerline to surface), and
  • t is the maximum thickness as a fraction of the chord (so 100 t gives the last two digits in the NACA 4-digit denomination).

this is what the cross section of a NACA 0015 looks like

File:NACA0015 a.png


My initial thought had been to lay a series of torpedo shaped sections next to each other and then use hull to join them together but I can't get to the 1st step.


Any help pointing me to the right approach would be greatly appreciated.


Kevin


All equations and pictures were shamelessly acquired from

http://en.wikipedia.org/wiki/NACA_airfoil



_______________________________________________
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



_______________________________________________
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: Trying to incorporate equation based shapes.

bobc
In reply to this post by Kevin Crowley
On 4 August 2012 17:01,  <[hidden email]> wrote:

> From: Kevin Crowley <[hidden email]>
> Subject: Re: [OpenSCAD] Trying to incorporate equation based shapes.
>
> I will look at that.  Thank you.
> My problem is four fold.
> Primus: I am a NOOB on OpenScad
> Secundus: Algorithms for shapes or plotting is not something I have done
> recently.
> Tertius: I can physically draft the shapes I want but my brain freezes when
> I try it on the computer.
> Quartus: I am trying to run with this before I can even toddle as I am
> being impatient.

Perhaps something like this:

// Draw a NACA airfoil

// calc symmetric 00xx half thickness
function yt (x,c,t) =
t/0.2*c*(0.2969*sqrt(x/c)-0.126*(x/c)-0.3516*pow(x/c,2)+0.2843*pow(x/c,3)-0.1015*pow(x/c,4));

module airfoil (c,t)
{
        step = c/80;

        for (i=[0:step:c])
        {
                translate ([i, 0, 0])
                        cube ([step, 0.1, 2 * (0.1+yt(i,c,t))], center=true );
        }
}

module test()
{
airfoil (50, 0.30);

translate ([0,-20,0])
        airfoil (50, 0.10);
}

module blend (len, c, t1, t2)
{
        step = c/200;

        for (i=[0:step:c])
        {
                assign (p1 = 0.1 + yt(i,c,t1) ,
                        p2 = 0.1 + yt(i,c,t2) )
                {

                translate ([0, 0, i])
                        polygon (points =  [
                        [0,-p1],
                        [0,p1],
                        [len, p2],
                        [len, -p2],
                        [0, -p1] ]);
                }

        }

}

rotate ([-90,0,0])
        blend (50, 50,0.30,0.10);

Reply | Threaded
Open this post in threaded view
|

Re: Trying to incorporate equation based shapes.

Kevin Crowley
You are entirely too kind to me.  I am your eternal servant!!!  or till Tuesday.  Whichever comes first.


On Sat, Aug 4, 2012 at 12:53 PM, Bob Cousins <[hidden email]> wrote:
On 4 August 2012 17:01,  <[hidden email]> wrote:
> From: Kevin Crowley <[hidden email]>
> Subject: Re: [OpenSCAD] Trying to incorporate equation based shapes.
>
> I will look at that.  Thank you.
> My problem is four fold.
> Primus: I am a NOOB on OpenScad
> Secundus: Algorithms for shapes or plotting is not something I have done
> recently.
> Tertius: I can physically draft the shapes I want but my brain freezes when
> I try it on the computer.
> Quartus: I am trying to run with this before I can even toddle as I am
> being impatient.

Perhaps something like this:

// Draw a NACA airfoil

// calc symmetric 00xx half thickness
function yt (x,c,t) =
t/0.2*c*(0.2969*sqrt(x/c)-0.126*(x/c)-0.3516*pow(x/c,2)+0.2843*pow(x/c,3)-0.1015*pow(x/c,4));

module airfoil (c,t)
{
        step = c/80;

        for (i=[0:step:c])
        {
                translate ([i, 0, 0])
                        cube ([step, 0.1, 2 * (0.1+yt(i,c,t))], center=true );
        }
}

module test()
{
airfoil (50, 0.30);

translate ([0,-20,0])
        airfoil (50, 0.10);
}

module blend (len, c, t1, t2)
{
        step = c/200;

        for (i=[0:step:c])
        {
                assign (p1 = 0.1 + yt(i,c,t1) ,
                        p2 = 0.1 + yt(i,c,t2) )
                {

                translate ([0, 0, i])
                        polygon (points =  [
                        [0,-p1],
                        [0,p1],
                        [len, p2],
                        [len, -p2],
                        [0, -p1] ]);
                }

        }

}

rotate ([-90,0,0])
        blend (50, 50,0.30,0.10);
_______________________________________________
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: Trying to incorporate equation based shapes.

Len Trigg

There are also a couple of NACA airfoil libraries on thingiverse that you can use, e.g.:

http://www.thingiverse.com/thing:14179

Cheers, Len.

On Aug 5, 2012 5:57 AM, "Kevin Crowley" <[hidden email]> wrote:
You are entirely too kind to me.  I am your eternal servant!!!  or till Tuesday.  Whichever comes first.


On Sat, Aug 4, 2012 at 12:53 PM, Bob Cousins <[hidden email]> wrote:
On 4 August 2012 17:01,  <[hidden email]> wrote:
> From: Kevin Crowley <[hidden email]>
> Subject: Re: [OpenSCAD] Trying to incorporate equation based shapes.
>
> I will look at that.  Thank you.
> My problem is four fold.
> Primus: I am a NOOB on OpenScad
> Secundus: Algorithms for shapes or plotting is not something I have done
> recently.
> Tertius: I can physically draft the shapes I want but my brain freezes when
> I try it on the computer.
> Quartus: I am trying to run with this before I can even toddle as I am
> being impatient.

Perhaps something like this:

// Draw a NACA airfoil

// calc symmetric 00xx half thickness
function yt (x,c,t) =
t/0.2*c*(0.2969*sqrt(x/c)-0.126*(x/c)-0.3516*pow(x/c,2)+0.2843*pow(x/c,3)-0.1015*pow(x/c,4));

module airfoil (c,t)
{
        step = c/80;

        for (i=[0:step:c])
        {
                translate ([i, 0, 0])
                        cube ([step, 0.1, 2 * (0.1+yt(i,c,t))], center=true );
        }
}

module test()
{
airfoil (50, 0.30);

translate ([0,-20,0])
        airfoil (50, 0.10);
}

module blend (len, c, t1, t2)
{
        step = c/200;

        for (i=[0:step:c])
        {
                assign (p1 = 0.1 + yt(i,c,t1) ,
                        p2 = 0.1 + yt(i,c,t2) )
                {

                translate ([0, 0, i])
                        polygon (points =  [
                        [0,-p1],
                        [0,p1],
                        [len, p2],
                        [len, -p2],
                        [0, -p1] ]);
                }

        }

}

rotate ([-90,0,0])
        blend (50, 50,0.30,0.10);
_______________________________________________
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: Trying to incorporate equation based shapes.

Kevin Crowley
An embarrasment of riches now.  Thanks.

On Sat, Aug 4, 2012 at 2:18 PM, Len Trigg <[hidden email]> wrote:

There are also a couple of NACA airfoil libraries on thingiverse that you can use, e.g.:

http://www.thingiverse.com/thing:14179

Cheers, Len.

On Aug 5, 2012 5:57 AM, "Kevin Crowley" <[hidden email]> wrote:
You are entirely too kind to me.  I am your eternal servant!!!  or till Tuesday.  Whichever comes first.


On Sat, Aug 4, 2012 at 12:53 PM, Bob Cousins <[hidden email]> wrote:
On 4 August 2012 17:01,  <[hidden email]> wrote:
> From: Kevin Crowley <[hidden email]>
> Subject: Re: [OpenSCAD] Trying to incorporate equation based shapes.
>
> I will look at that.  Thank you.
> My problem is four fold.
> Primus: I am a NOOB on OpenScad
> Secundus: Algorithms for shapes or plotting is not something I have done
> recently.
> Tertius: I can physically draft the shapes I want but my brain freezes when
> I try it on the computer.
> Quartus: I am trying to run with this before I can even toddle as I am
> being impatient.

Perhaps something like this:

// Draw a NACA airfoil

// calc symmetric 00xx half thickness
function yt (x,c,t) =
t/0.2*c*(0.2969*sqrt(x/c)-0.126*(x/c)-0.3516*pow(x/c,2)+0.2843*pow(x/c,3)-0.1015*pow(x/c,4));

module airfoil (c,t)
{
        step = c/80;

        for (i=[0:step:c])
        {
                translate ([i, 0, 0])
                        cube ([step, 0.1, 2 * (0.1+yt(i,c,t))], center=true );
        }
}

module test()
{
airfoil (50, 0.30);

translate ([0,-20,0])
        airfoil (50, 0.10);
}

module blend (len, c, t1, t2)
{
        step = c/200;

        for (i=[0:step:c])
        {
                assign (p1 = 0.1 + yt(i,c,t1) ,
                        p2 = 0.1 + yt(i,c,t2) )
                {

                translate ([0, 0, i])
                        polygon (points =  [
                        [0,-p1],
                        [0,p1],
                        [len, p2],
                        [len, -p2],
                        [0, -p1] ]);
                }

        }

}

rotate ([-90,0,0])
        blend (50, 50,0.30,0.10);
_______________________________________________
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

_______________________________________________
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: Trying to incorporate equation based shapes.

Kevin Crowley

Just thought I would update on this.  I have succeeded in getting a plane design that is at least close to what I wanted.  What I can not seem to do is get all of these slices to get joined together.  I have tried overlapping the slices and did a union on them but didn't work as expected.  They were still separate objects.  Ultimately, I need to get this complied and rendered so I can export it as something other than  other than an image so i can run it on both a CNC router and through aerodynamic software.  With this code if I try to compile and render(f6) it will keep going for most of day before it finishes. and that is using 90%+ of both cpus and 905+ of all memory.  That kind of tells me I am not coding this in a very efficient manner. I suspect polyhedrons might be the solution but I don't have my head wrapped around them yet.  I don't understand the point of or the use of the triangles in the polyhedron.


Thanks for all the help so far.  It has been fun learning this.


On Sat, Aug 4, 2012 at 3:59 PM, Kevin Crowley <[hidden email]> wrote:


An embarrasment of riches now.  Thanks.


On Sat, Aug 4, 2012 at 2:18 PM, Len Trigg <[hidden email]> wrote:

There are also a couple of NACA airfoil libraries on thingiverse that you can use, e.g.:

http://www.thingiverse.com/thing:14179

Cheers, Len.

On Aug 5, 2012 5:57 AM, "Kevin Crowley" <[hidden email]> wrote:
You are entirely too kind to me.  I am your eternal servant!!!  or till Tuesday.  Whichever comes first.


On Sat, Aug 4, 2012 at 12:53 PM, Bob Cousins <[hidden email]> wrote:
On 4 August 2012 17:01,  <[hidden email]> wrote:
> From: Kevin Crowley <[hidden email]>
> Subject: Re: [OpenSCAD] Trying to incorporate equation based shapes.
>
> I will look at that.  Thank you.
> My problem is four fold.
> Primus: I am a NOOB on OpenScad
> Secundus: Algorithms for shapes or plotting is not something I have done
> recently.
> Tertius: I can physically draft the shapes I want but my brain freezes when
> I try it on the computer.
> Quartus: I am trying to run with this before I can even toddle as I am
> being impatient.

Perhaps something like this:

// Draw a NACA airfoil

// calc symmetric 00xx half thickness
function yt (x,c,t) =
t/0.2*c*(0.2969*sqrt(x/c)-0.126*(x/c)-0.3516*pow(x/c,2)+0.2843*pow(x/c,3)-0.1015*pow(x/c,4));

module airfoil (c,t)
{
        step = c/80;

        for (i=[0:step:c])
        {
                translate ([i, 0, 0])
                        cube ([step, 0.1, 2 * (0.1+yt(i,c,t))], center=true );
        }
}

module test()
{
airfoil (50, 0.30);

translate ([0,-20,0])
        airfoil (50, 0.10);
}

module blend (len, c, t1, t2)
{
        step = c/200;

        for (i=[0:step:c])
        {
                assign (p1 = 0.1 + yt(i,c,t1) ,
                        p2 = 0.1 + yt(i,c,t2) )
                {

                translate ([0, 0, i])
                        polygon (points =  [
                        [0,-p1],
                        [0,p1],
                        [len, p2],
                        [len, -p2],
                        [0, -p1] ]);
                }

        }

}

rotate ([-90,0,0])
        blend (50, 50,0.30,0.10);
_______________________________________________
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

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




Scadplane01.png (36K) Download Attachment
Scadplane03.png (38K) Download Attachment
airfoil0001.scad (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Trying to incorporate equation based shapes.

togo
This post has NOT been accepted by the mailing list yet.
Have you tried to hull() {} operation?

For example, in the code above, try:

//rotate ([-90,0,0])
//       blend (50, 50,0.30,0.10);

hull(){
    test();
}
Reply | Threaded
Open this post in threaded view
|

Re: Trying to incorporate equation based shapes.

Parkinbot
In reply to this post by Kevin Crowley
I haved done some work on this complex, especially how to smoothly transit between different NACA shapes.

These are my library projects, that will solve all your issues.

http://www.thingiverse.com/thing:898554     NACA library and shape transistion based an linear_extrude()
http://www.thingiverse.com/thing:900137     general shape transition based on sweep()
http://www.thingiverse.com/thing:1208001   Generalist approach on transition with spline interpolation


Reply | Threaded
Open this post in threaded view
|

Re: Trying to incorporate equation based shapes.

togo
Parkinbot, your blithe promises are too big.

1. I tried your 900137.  I got missing include.  Seems the file capitalization was wrong.  

2. Got syntax error.  Seems you were using some bleeding edge features.  Had to switch from stable to testing version of openscad.

3. Your example worked.  But the code is full of cryptic stuff.  Not for the faint of heart.

But, hey, it looks cool!  And you contributed to the community.

I'll build on the OP's work.  It's not as clever as yours, but it's understandable and it worked first try.

T

Reply | Threaded
Open this post in threaded view
|

Re: Trying to incorporate equation based shapes.

Ronaldo
In reply to this post by Kevin Crowley
As your airfoil is convex the hull() certainly works. Try this:

// Draw a NACA airfoil

function yt (x,c,t) =
t/0.2*c*(0.2969*sqrt(x/c)-0.126*(x/c)-0.3516*pow(x/c,2)+0.2843*pow(x/c,3)-0.1015*pow(x/c,4));

module airfoil (c,t,m){
    p  = concat([ for(i=[m-1:-1:0])
                   [ c*i*i/(m-1)/(m-1),  yt(c*i*i/(m-1)/(m-1), c, t) ] ],
                [ for(i=[0:m-1])
                   [ c*i*i/(m-1)/(m-1), -yt(c*i*i/(m-1)/(m-1), c, t) ] ]);

  rotate([90,0,0]) linear_extrude(0.01)
    polygon( p );
}

module blend_airfoils(c1,t1,c2,t2,y,n){
  hull (){
    airfoil(c1,t1,n);
    translate([0,y,0]) airfoil(c2,t2,n);  
  }
}

blend_airfoils(70,0.1,50,0.2,200,20);
Reply | Threaded
Open this post in threaded view
|

Re: Trying to incorporate equation based shapes.

Ronaldo
Or even better:

module blend_airfoils(y){
  hull (){
    children(0);
    translate([0,y,0]) children(1);  
  }
}

blend_airfoils(200) {
    airfoil(70,0.20,30);
    airfoil(45,0.1,30);
}
Reply | Threaded
Open this post in threaded view
|

Re: Trying to incorporate equation based shapes.

Neon22
Using @Parkinbot's approach. Something like this:

use <naca4.scad>
use <Naca_sweep.scad>
num_points = 100;
airfoil1 = vec3D(airfoil_data(0015, 110, num_points), 0); // NACA, length, numsamples
airfoil2 = vec3D(airfoil_data(1733, 110, num_points), 20);
airfoil3 = vec3D(airfoil_data(2418, 110, num_points), 40);
// airfoil4 = T_(0,0,80, vec3D(airfoil_data(0015, 130, num_points)));
data = [airfoil1, airfoil2, airfoil3];
sweep(data);
NACA airfoil
The advantage being that airfoil_data() takes a 4-digit NACA number directly and includes all the non-symmetrical ones.

@Parkinbot does use a different approach which allows you to rotate,scale, and translate the curves prior to assembly. See airfoil4 for putting the translation outside the vec_3D().
So making twisted blades like boat propellers is possible in a somewhat complex description. See his thingiverse for excellent examples.

So to be slightly clearer:

1. airfoil_data() takes the special 4 digit NACA rep which you can read about here:
- https://en.wikipedia.org/wiki/NACA_airfoil
- http://www.pdas.com/naca456pdas.html  - would be great to do ALL of these.
and extracts the fields for chord ratios etc  and then creates the curve as pairs of [X,Y] coordinates.

2. The Vec3D() function turns the pairs into triplets (I used optional Z arg in first 3 airfoils)

3. Further transforms can be applied (I used Translate which is T_() in @parkinbot's approach, in airfoil4)

4. The resulting list is a transformed sequence of coords suitable for sweeping or skinning together.
@parkinbot's Naca_sweep.scad includes a function sweep() to do this but the skin() from elsewhere also works.

The missing part is a splined curve through the airfoils.
To do this you need to play with @Parkinbot's spline functions - referenced above in his post...

I believe you could call this code approach idiosyncratic but it's effective at describing a complex series of swept curves in a concise way.

IMHO incorporating these ideas into a module that was consistent across openSCAD (such as the MCAD module which seem slike it has many unmerged pull requests) and using the same approach everywhere means we could all benefit from a NACA lib. (and spline interp, and lofting, etc... All old threads it would be great to actually resolve in the current design as well as openSCAD2...)
YMMV, as usual