# Trying to incorporate equation based shapes.

19 messages
Open this post in threaded view
|

## Trying to incorporate equation based shapes.

 In my case airfoils.  I want to take a NACA 0030 airfoil as a fuselage and blend it to a NACA 0010My 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 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. KevinAll equations and pictures were shamelessly acquired from
Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

 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 wrote: In my case airfoils.  I want to take a NACA 0030 airfoil as a fuselage and blend it to a NACA 0010My 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. 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 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. KevinAll equations and pictures were shamelessly acquired from _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscad http://openscad.org - https://flattr.com/thing/121566
Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

 Or maybe skinny boxes.On Sat, Aug 4, 2012 at 7:37 AM, nop head 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 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. 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 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. KevinAll equations and pictures were shamelessly acquired from _______________________________________________ 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
Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

 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 0010My 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. 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 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. KevinAll equations and pictures were shamelessly acquired from _______________________________________________ OpenSCAD mailing list [hidden email] http://rocklinux.net/mailman/listinfo/openscad http://openscad.org - https://flattr.com/thing/121566
Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

 I will look at that.  Thank you.My problem is four fold. Primus: I am a NOOB on OpenScadSecundus: 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 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 0010My 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. 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 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. KevinAll equations and pictures were shamelessly acquired from _______________________________________________ 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
Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

 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 wrote: I will look at that.  Thank you.My problem is four fold. Primus: I am a NOOB on OpenScadSecundus: 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 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 0010My 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. 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 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. KevinAll equations and pictures were shamelessly acquired from _______________________________________________ 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
Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

 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);
Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

 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 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
Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

 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 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
Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

 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(); }
Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

 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
Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

 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
Open this post in threaded view
|

## Re: Trying to incorporate equation based shapes.

 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);