Sweep with easing equations

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

Sweep with easing equations

Benjamin-2
Hi,

Playing with the sweep demo, I've tried transitions based on Robert Penner's easing equations from the Flash/ActionScript days
http://robertpenner.com/easing/penner_easing_as1.txt

Now with a single parameter, k between 0 and 1 as in:
https://github.com/tweenjs/tween.js/blob/master/src/Tween.js
(instead of t:current time, b:beginning value, c:change in value, d:duration)
for scaling in "path_transform".



I use that to make fillet on airfoils.
Maybe it could be useful for someone else.

Benjamin


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

sweep_w_easing.scad (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Sweep with easing equations

Ronaldo
2017-01-13 20:20 GMT-02:00 Benjamin <[hidden email]>:
I use that to make fillet on airfoils.
Maybe it could be useful for someone else.

Benjamin


Nice done. How do you make airfoil fillets with that technique?



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Sweep with easing equations

Benjamin-2

On 14/01/17 01:48, Ronaldo Persiano wrote:

Nice done. How do you make airfoil fillets with that technique?

Thank you.
I make an outCubic scaling on the profile (.scad file attached).
Previous versions of my toy propellers were breaking at the junction between hub and airfoil. They do not any more.





Benjamin

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

airfoil_filleted.scad (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Sweep with easing equations

Ronaldo
Thank you for your answer. You have illustrated that in the first code and I missed. Sorry.

The issue in the use of a cubic to make fillets is that it has geometric concordance in the top but not in the base. You could use another blending function that has concordance in bottom too:
translate([-spacing/2, 0, 0]) {
        sweep(airfoil_points, path_outCubic);
        translate([0, 0, height - 0.01])
        straight_airfoil();
}

translate([spacing/2, 0, 0]) {
        sweep(airfoil_points, path_fillet);
        translate([0, 0, height - 0.01])
        straight_airfoil();
}

translate([0, 0, -1.5])
cube([80, 50, 3], center=true);

//---------------------------------------------------------------------
path_fillet = [for(i=[0:steps])
    translation([0,0,height*i*i/steps/steps])*
    scaling([bottom_w+delt*fillet(pow(i/steps,2)),bottom_w+delt*fillet(pow(i/steps,2)),1])];

function fillet(k) = sqrt(k*(2-k));
This code fragment should replace an appropriate fragment of your last code. Then you will get the following preview image:



Behind you see your cubic blending and in the first plane my proposed blending.
Reply | Threaded
Open this post in threaded view
|

Re: Sweep with easing equations

Ronaldo
This is a simpler form for the same blending:

path_fillet = [for(i=[0:steps])
    translation([0,0,height*i*i/steps/steps])*
    scaling([bottom_w+delt*fillet(i/steps),bottom_w+delt*fillet(i/steps),1])];

function fillet(k) = k*sqrt(2-k*k);
Reply | Threaded
Open this post in threaded view
|

Re: Sweep with easing equations

jon_bondy
In reply to this post by Ronaldo
Ronaldo:

Trying to follow along here...

What is "straight_airfoil()"?

I am also unclear why there is a "*" on the right side of the line that
says "translation".  I guess I'm also confused about what "translate"
is: I looked in the files that are Used, but could not find it.  Same
comment for "scaling".

Sure would be nice if you could right-click on the name of a Used file
and pop it up, even in Notepad.

Jon

On 1/14/2017 10:36 AM, Ronaldo wrote:

> Thank you for your answer. You have illustrated that in the first code and I
> missed. Sorry.
>
> The issue in the use of a cubic to make fillets is that it has geometric
> concordance in the top but not in the base. You could use another blending
> function that has concordance in bottom too:
>
>> translate([-spacing/2, 0, 0]) {
>> sweep(airfoil_points, path_outCubic);
>> translate([0, 0, height - 0.01])
>> straight_airfoil();
>> }
>>
>> translate([spacing/2, 0, 0]) {
>> sweep(airfoil_points, path_fillet);
>> translate([0, 0, height - 0.01])
>> straight_airfoil();
>> }
>>
>> translate([0, 0, -1.5])
>> cube([80, 50, 3], center=true);
>>
>> //---------------------------------------------------------------------
>> path_fillet = [for(i=[0:steps])
>>      translation([0,0,height*i*i/steps/steps])*
>>    
>> scaling([bottom_w+delt*fillet(pow(i/steps,2)),bottom_w+delt*fillet(pow(i/steps,2)),1])];
>>
>> function fillet(k) = sqrt(k*(2-k));
> This code fragment should replace an appropriate fragment of your last code.
> Then you will get the following preview image:
>
> <http://forum.openscad.org/file/n20080/airfoilFillet.png>
>
> Behind you see your cubic blending and in the first plane my proposed
> blending.
>
>
>
> --
> View this message in context: http://forum.openscad.org/Sweep-with-easing-equations-tp20075p20080.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2016.0.7996 / Virus Database: 4749/13766 - Release Date: 01/14/17
>
>


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Sweep with easing equations

Benjamin-2
In reply to this post by Ronaldo

On 14/01/17 16:41, Ronaldo wrote:
This is a simpler form for the same blending:


path_fillet = [for(i=[0:steps]) 
    translation([0,0,height*i*i/steps/steps])*
   
scaling([bottom_w+delt*fillet(i/steps),bottom_w+delt*fillet(i/steps),1])];

function fillet(k) = k*sqrt(2-k*k);


Perfect!
An outCirc function in my example would have been better than an outQuad but still behind your solution:





My toy propeller use only part of the round transition.




Thanks again.


Benjamin





--
View this message in context: http://forum.openscad.org/Sweep-with-easing-equations-tp20075p20081.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Sweep with easing equations

Ronaldo
In reply to this post by jon_bondy
jon_bondy wrote
What is "straight_airfoil()"?

I am also unclear why there is a "*" on the right side of the line that
says "translation".  I guess I'm also confused about what "translate"
is: I looked in the files that are Used, but could not find it.  Same
comment for "scaling".
My code was not complete. It was supposed to be inserted/substitute part of Benjamin's original code. The module straight_airfoil() , defined in the original code, makes a sweep of the airfoil profile along a straight segment.

translation() and scaling() are functions defined in scad-utils/transformations.scad that is used in the Benjamin's code. Those functions returns 4x4 matrices to provide affine transformations of points; so the '*' is a matrix multiplication operator.

scad-utils may be found in Github.
Reply | Threaded
Open this post in threaded view
|

Re: Sweep with easing equations

jon_bondy
Ah.  I must have grabbed a bad copy of his code.  No definition of
straight_airfoil() in the source code that I used (and which both
compiled and produced the visual output as expected, which is why I did
not suspect something missing).  I just checked, again, and the source
code that he specifies at the start of this thread does not have
"straight_airfoil()".  Did you get different source code somewhere?

And there was more than one "transformations.scad", so of course I
choose the wrong one to inspect.

Thank you!

Jon


On 1/14/2017 7:27 PM, Ronaldo wrote:

> jon_bondy wrote
>> What is "straight_airfoil()"?
>>
>> I am also unclear why there is a "*" on the right side of the line that
>> says "translation".  I guess I'm also confused about what "translate"
>> is: I looked in the files that are Used, but could not find it.  Same
>> comment for "scaling".
> My code was not complete. It was supposed to be inserted/substitute part of
> Benjamin's original code. The module straight_airfoil() , defined in the
> original code, makes a sweep of the airfoil profile along a straight
> segment.
>
> translation() and scaling() are functions defined in
> scad-utils/transformations.scad that is used in the Benjamin's code. Those
> functions returns 4x4 matrices to provide affine transformations of points;
> so the '*' is a matrix multiplication operator.
>
> scad-utils may be found in  Github
> <https://github.com/OskarLinde/scad-utils>  .
>
>
>
>
> --
> View this message in context: http://forum.openscad.org/Sweep-with-easing-equations-tp20075p20084.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2016.0.7996 / Virus Database: 4749/13769 - Release Date: 01/14/17
>
>


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Sweep with easing equations

Ronaldo


2017-01-14 22:35 GMT-02:00 jon <[hidden email]>:
Ah.  I must have grabbed a bad copy of his code.  No definition of straight_airfoil() in the source code that I used (and which both compiled and produced the visual output as expected, which is why I did not suspect something missing).  I just checked, again, and the source code that he specifies at the start of this thread does not have "straight_airfoil()".  Did you get different source code somewhere?


You are right: straight_airfoil() is defined not in the first but in the second Benjamin's code: airfoil_filleted.scad. And my code should be inserted in that code and not in the first one.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Sweep with easing equations

Ronaldo
In reply to this post by Benjamin-2
Benjamin-2 wrote
On 14/01/17 16:41, Ronaldo wrote:
An outCirc function in my example would have been better than an outQuad
but still behind your solution:
As a matter of fact, my fillet function reproduces an circular arc as you can see by:
polygon([for(i=[0:10]) [i*i/10/10, fillet(i/10)]]);
The quadratic step size just adds a better resolution at one end. If you define height and delt equal the circular fillet becomes apparent. Otherwise, it is eliptical.