discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Creating beam deflection?

K
Ken
Fri, Nov 3, 2023 7:23 AM

Fascinating- I didn't know openscad could do that. More stuff to learn &
play with- thanks.

On 2023-11-03 18:05, Caddiy via Discuss wrote:

Ken wrote:

 Revar, just for my own interest I ran this code snippet and all it
 produced was a straight beam- am I missing something from the
 previous discussion? (I did include BOSL2/std.scad)

     Revar Desmera wrote:

     |My post actually did have those multiplier asterisks, but I
     suspect something tried to do markdown processing on it for
     you. Hopefully this version takes care of that: |$vpt=[ 20,
     20, -80 ]; $vpr=[ 170, 45, 180 ]; $vpd=2000; $vpf=15; H=2.5;
     // Beam slice thickness sweep( rect([50,25]), [for
     (z=[-180:1:180]) up(H*z) * back(20*sin($t*360)*sin(z))] ); ```
     - Revar |_____________________________________________|


     -- Cheers, Ken bats059@gmail.com https://vk7krj.com
     https://vk7krj.com/running.html

 A baby can be defined as an ego with a noise at one end and a
 smell at the other. Your job as parents is to teach them to
 control all three. My job as a grandad is to tell you how you are
 doing it all wrong!

Try a bit of animation, it works wonders.

@ Revar: Please see my message date stamped Thu, Nov 2, 2023 6:20 PM.


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

--
Cheers, Ken
bats059@gmail.com
https://vk7krj.com
https://vk7krj.com/running.html

A baby can be defined as an ego with a noise at one end and a smell at the other.
Your job as parents is to teach them to control all three.
My job as a grandad is to tell you how you are doing it all wrong!

Fascinating- I didn't know openscad could do that. More stuff to learn & play with- thanks. On 2023-11-03 18:05, Caddiy via Discuss wrote: > > Ken wrote: > > Revar, just for my own interest I ran this code snippet and all it > produced was a straight beam- am I missing something from the > previous discussion? (I did include BOSL2/std.scad) > > Revar Desmera wrote: > > |My post actually did have those multiplier asterisks, but I > suspect something tried to do markdown processing on it for > you. Hopefully this version takes care of that: |$vpt=[ 20, > 20, -80 ]; $vpr=[ 170, 45, 180 ]; $vpd=2000; $vpf=15; H=2.5; > // Beam slice thickness sweep( rect([50,25]), [for > (z=[-180:1:180]) up(H*z) * back(20*sin($t*360)*sin(z))] ); ``` > - Revar |_____________________________________________| > > > -- Cheers, Ken bats059@gmail.com https://vk7krj.com > https://vk7krj.com/running.html > > A baby can be defined as an ego with a noise at one end and a > smell at the other. Your job as parents is to teach them to > control all three. My job as a grandad is to tell you how you are > doing it all wrong! > > Try a bit of animation, it works wonders. > > @ Revar: Please see my message date stamped Thu, Nov 2, 2023 6:20 PM. > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org -- Cheers, Ken bats059@gmail.com https://vk7krj.com https://vk7krj.com/running.html ---------------------------------------- A baby can be defined as an ego with a noise at one end and a smell at the other. Your job as parents is to teach them to control all three. My job as a grandad is to tell you how you are doing it all wrong!
SP
Sanjeev Prabhakar
Fri, Nov 3, 2023 12:20 PM

On Fri, 3 Nov, 2023, 12:54 pm Ken via Discuss, discuss@lists.openscad.org
wrote:

Fascinating- I didn't know openscad could do that. More stuff to learn &
play with- thanks.
On 2023-11-03 18:05, Caddiy via Discuss wrote:

Ken wrote:

Revar, just for my own interest I ran this code snippet and all it
produced was a straight beam- am I missing something from the previous
discussion? (I did include BOSL2/std.scad)

Revar Desmera wrote:

My post actually did have those multiplier asterisks, but I
suspect something tried to do markdown processing on it for you.
Hopefully this version takes care of that:

|$vpt=[ 20, 20, -80 ]; $vpr=[ 170, 45, 180 ]; $vpd=2000; $vpf=15;
H=2.5; // Beam slice thickness sweep( rect([50,25]), [for
(z=[-180:1:180]) up(Hz) * back(20sin($t*360)*sin(z))] ); ``` -
Revar |_____________________________________________

-- Cheers, Ken bats059@gmail.com https://vk7krj.com
https://vk7krj.com/running.html

A baby can be defined as an ego with a noise at one end and a smell at the
other. Your job as parents is to teach them to control all three. My job as
a grandad is to tell you how you are doing it all wrong!

Try a bit of animation, it works wonders.

@ Revar: Please see my message date stamped Thu, Nov 2, 2023 6:20 PM.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--
Cheers, Kenbats059@gmail.comhttps://vk7krj.comhttps://vk7krj.com/running.html

A baby can be defined as an ego with a noise at one end and a smell at the other.
Your job as parents is to teach them to control all three.
My job as a grandad is to tell you how you are doing it all wrong!


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

On Fri, 3 Nov, 2023, 12:54 pm Ken via Discuss, <discuss@lists.openscad.org> wrote: > Fascinating- I didn't know openscad could do that. More stuff to learn & > play with- thanks. > On 2023-11-03 18:05, Caddiy via Discuss wrote: > > Ken wrote: > > Revar, just for my own interest I ran this code snippet and all it > produced was a straight beam- am I missing something from the previous > discussion? (I did include BOSL2/std.scad) > > Revar Desmera wrote: > > My post actually did have those multiplier asterisks, but I > suspect something tried to do markdown processing on it for you. > Hopefully this version takes care of that: > > |$vpt=[ 20, 20, -80 ]; $vpr=[ 170, 45, 180 ]; $vpd=2000; $vpf=15; > H=2.5; // Beam slice thickness sweep( rect([50,25]), [for > (z=[-180:1:180]) up(H*z) * back(20*sin($t*360)*sin(z))] ); ``` - > Revar |_____________________________________________ > > -- Cheers, Ken bats059@gmail.com https://vk7krj.com > https://vk7krj.com/running.html > > A baby can be defined as an ego with a noise at one end and a smell at the > other. Your job as parents is to teach them to control all three. My job as > a grandad is to tell you how you are doing it all wrong! > > Try a bit of animation, it works wonders. > > @ Revar: Please see my message date stamped Thu, Nov 2, 2023 6:20 PM. > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > -- > Cheers, Kenbats059@gmail.comhttps://vk7krj.comhttps://vk7krj.com/running.html > ---------------------------------------- > A baby can be defined as an ego with a noise at one end and a smell at the other. > Your job as parents is to teach them to control all three. > My job as a grandad is to tell you how you are doing it all wrong! > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Fri, Nov 3, 2023 10:56 PM

On 11/2/2023 3:20 PM, Caddiy via Discuss wrote:

Revar Desmera wrote:

 My post actually did have those multiplier asterisks, but I
 suspect something tried to do markdown processing on it for you.
 Hopefully this version takes care of that:

 |$vpt=[ 20, 20, -80 ]; $vpr=[ 170, 45, 180 ]; $vpd=2000; $vpf=15;
 H=2.5; // Beam slice thickness sweep( rect([50,25]), [for
 (z=[-180:1:180]) up(H*z) * back(20*sin($t*360)*sin(z))] ); - Revar |
 The code gives sine motion in one plane nicely, but I need a
 cosine motion in another plane, too. I thought I would be able to
 derive that from the code, but I can’t see how to do it. How does
 one get a compound deflection with components in two planes ?

Multiply by left(some appropriate expression), something like so:

include <BOSL2/std.scad>

//$vpt=[ 20, 20, -80 ];
//$vpr=[ 170, 45, 180 ];
//$vpd=2000;
//$vpf=15;
H=2.5; // Beam slice thickness
sweep(
    rect([50,25]),
    [for (z=[-180:1:180])
        up(H*z)
        * back(20*sin($t*360)*sin(z))
        * left(20*cos($t*360)*cos(z))]
);

BTW, please don't set the $vpX variables unless you really need to. 
They make it awkward to move the camera around, especially in an animation.

 Which language is the code?

It's OpenSCAD, using the BOSL2 library.  As he said in a followup, Revar
forgot to include the "include <BOSL2/std.scad>".

 Btw I wanted to see if I could find anything in GitHub, but I
 couldn’t get in. What’s happened to GitHub?

Works for me.  They did recently switch to requiring two-factor
authentication.

On 11/2/2023 3:20 PM, Caddiy via Discuss wrote: > > Revar Desmera wrote: > > My post actually did have those multiplier asterisks, but I > suspect something tried to do markdown processing on it for you. > Hopefully this version takes care of that: > > |$vpt=[ 20, 20, -80 ]; $vpr=[ 170, 45, 180 ]; $vpd=2000; $vpf=15; > H=2.5; // Beam slice thickness sweep( rect([50,25]), [for > (z=[-180:1:180]) up(H*z) * back(20*sin($t*360)*sin(z))] ); - Revar | > > * > > The code gives sine motion in one plane nicely, but I need a > cosine motion in another plane, too. I thought I would be able to > derive that from the code, but I can’t see how to do it. How does > one get a compound deflection with components in two planes ? > Multiply by left(some appropriate expression), something like so: include <BOSL2/std.scad> //$vpt=[ 20, 20, -80 ]; //$vpr=[ 170, 45, 180 ]; //$vpd=2000; //$vpf=15; H=2.5; // Beam slice thickness sweep( rect([50,25]), [for (z=[-180:1:180]) up(H*z) * back(20*sin($t*360)*sin(z)) * left(20*cos($t*360)*cos(z))] ); BTW, please don't set the $vpX variables unless you really need to.  They make it awkward to move the camera around, especially in an animation. > * > > Which language is the code? > It's OpenSCAD, using the BOSL2 library.  As he said in a followup, Revar forgot to include the "include <BOSL2/std.scad>". > * > > Btw I wanted to see if I could find anything in GitHub, but I > couldn’t get in. What’s happened to GitHub? > Works for me.  They did recently switch to requiring two-factor authentication.
RD
Revar Desmera
Fri, Nov 3, 2023 11:30 PM

On Nov 2, 2023, at 3:20 PM, Caddiy via Discuss discuss@lists.openscad.org wrote:
The code gives sine motion in one plane nicely, but I need a cosine motion in another plane, too. I thought I would be able to derive that from the code, but I can’t see how to do it. How does one get a compound deflection with components in two planes ?

In the BOSL2 library, the left(), right(), fwd(), back(), down(), and up() functions return transformation matrices for translations in the X-. X+, Y-, Y+, Z-, and Z+ directions respectively.  Multiplying them together creates a single transformation matrix that performs all the component translations.  The sweep() module is given a polygon and a list of transformation matrices, one for each of the positions the polygon should be swept past.  So, to add a shimmy to your beam's wave, just add something like * right(10*cos($t*360+15)*cos(z)).

include <BOSL2/std.scad>
$vpt=[ 20, 20, -80 ];
$vpr=[ 170, 45, 180 ];
$vpd=2000;
$vpf=15;
H=2.5; // Beam slice thickness
sweep(
    rect([50,25]), [
        for (z=[-180:1:180])
            up(H*z) *
                back(20*sin($t*360)*sin(z)) *
                right(10*sin($t*360+15)*sin(z))
    ]
);

You can also add rotations to the beam in a similar way, using rot(), xrot(), yrot(), and zrot() as they also return transformation matrices.

Which language is the code?

The OpenSCAD Language.

  • Revar
> On Nov 2, 2023, at 3:20 PM, Caddiy via Discuss <discuss@lists.openscad.org> wrote: > The code gives sine motion in one plane nicely, but I need a cosine motion in another plane, too. I thought I would be able to derive that from the code, but I can’t see how to do it. How does one get a compound deflection with components in two planes ? > In the BOSL2 library, the `left()`, `right()`, `fwd()`, `back()`, `down()`, and `up()` functions return transformation matrices for translations in the X-. X+, Y-, Y+, Z-, and Z+ directions respectively. Multiplying them together creates a single transformation matrix that performs all the component translations. The `sweep()` module is given a polygon and a list of transformation matrices, one for each of the positions the polygon should be swept past. So, to add a shimmy to your beam's wave, just add something like `* right(10*cos($t*360+15)*cos(z))`. ``` include <BOSL2/std.scad> $vpt=[ 20, 20, -80 ]; $vpr=[ 170, 45, 180 ]; $vpd=2000; $vpf=15; H=2.5; // Beam slice thickness sweep( rect([50,25]), [ for (z=[-180:1:180]) up(H*z) * back(20*sin($t*360)*sin(z)) * right(10*sin($t*360+15)*sin(z)) ] ); ``` You can also add rotations to the beam in a similar way, using `rot()`, `xrot()`, `yrot()`, and `zrot()` as they also return transformation matrices. > Which language is the code? > The OpenSCAD Language. - Revar
M
mikeonenine@web.de
Sat, Nov 4, 2023 1:13 AM

A big thank-you to Jordan and Revar!

The beam is actually a piston rod and will look something like this

include <BOSL2/std.scad>
/*
$vpt=[ 20, 20, 80 ]; // perspective
$vpr=[ -35, 45, 0 ]; // Isometric
$vpd=2200;
$vpf=15;
*/
H=2.5; // Beam slice thickness
translate([0,0,50*sin($t*360)])
sweep(
    circle(25), [
        for (z=[-180:1:180])
            up(H*z) *
            back(20*sin($t*360)*sin(z)) *
            right(20*cos($t*360)*cos(z/2))*
	    zrot(-10*cos($t*360))
    ]
);

though “all” I need to do now is adapt the numbers to fit the rest of the design.

A big thank-you to Jordan and Revar! The beam is actually a piston rod and will look something like this ``` include <BOSL2/std.scad> ``` ``` /* ``` ``` $vpt=[ 20, 20, 80 ]; // perspective ``` ``` $vpr=[ -35, 45, 0 ]; // Isometric ``` ``` $vpd=2200; ``` ``` $vpf=15; ``` ``` */ ``` ``` H=2.5; // Beam slice thickness ``` ``` translate([0,0,50*sin($t*360)]) ``` ``` sweep( ``` ``` circle(25), [ ``` ``` for (z=[-180:1:180]) ``` ``` up(H*z) * ``` ``` back(20*sin($t*360)*sin(z)) * ``` ``` right(20*cos($t*360)*cos(z/2))* ``` ``` zrot(-10*cos($t*360)) ``` ``` ] ``` ``` ); ``` though “all” I need to do now is adapt the numbers to fit the rest of the design.
RD
Revar Desmera
Sat, Nov 4, 2023 2:35 AM

At this point, since you're doing all three axes, you could just merge the right(), back(), and up() into one move(x,y,z) call for a slight optimization.

  • Revar

On Nov 3, 2023, at 6:13 PM, Caddiy via Discuss discuss@lists.openscad.org wrote:

A big thank-you to Jordan and Revar!

The beam is actually a piston rod and will look something like this

include <BOSL2/std.scad>
/*
$vpt=[ 20, 20, 80 ]; // perspective
$vpr=[ -35, 45, 0 ]; // Isometric
$vpd=2200;
$vpf=15;
/
H=2.5; // Beam slice thickness
translate([0,0,50
sin($t360)])
sweep(
circle(25), [
for (z=[-180:1:180])
up(H
z) *
back(20sin($t360)sin(z)) *
right(20
cos($t360)cos(z/2))
zrot(-10
cos($t*360))
]
);
though “all” I need to do now is adapt the numbers to fit the rest of the design.

<Wiggly rod.gif>_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

At this point, since you're doing all three axes, you could just merge the `right()`, `back()`, and `up()` into one `move(x,y,z)` call for a slight optimization. - Revar > On Nov 3, 2023, at 6:13 PM, Caddiy via Discuss <discuss@lists.openscad.org> wrote: > > A big thank-you to Jordan and Revar! > > The beam is actually a piston rod and will look something like this > > include <BOSL2/std.scad> > /* > $vpt=[ 20, 20, 80 ]; // perspective > $vpr=[ -35, 45, 0 ]; // Isometric > $vpd=2200; > $vpf=15; > */ > H=2.5; // Beam slice thickness > translate([0,0,50*sin($t*360)]) > sweep( > circle(25), [ > for (z=[-180:1:180]) > up(H*z) * > back(20*sin($t*360)*sin(z)) * > right(20*cos($t*360)*cos(z/2))* > zrot(-10*cos($t*360)) > ] > ); > though “all” I need to do now is adapt the numbers to fit the rest of the design. > > <Wiggly rod.gif>_______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
M
mikeonenine@web.de
Sat, Nov 4, 2023 3:40 AM

Revar Desmera wrote:

At this point, since you're doing all three axes, you could just merge the right(), back(), and up() into one move(x,y,z) call for a slight optimization.

  • Revar

That looks neat, I’ll try that.

You can see the original design below, wobble obviously exaggerated. An engineer might find fault with the rods, but it gives the general idea. I will do the trigonometry again from scratch and hope to get it right second time round.

The design looks sick? It is sick! That’s the challenge!

Revar Desmera wrote: > At this point, since you're doing all three axes, you could just merge the `right()`, `back()`, and `up()` into one `move(x,y,z)` call for a slight optimization. > > * Revar That looks neat, I’ll try that. You can see the original design below, wobble obviously exaggerated. An engineer might find fault with the rods, but it gives the general idea. I will do the trigonometry again from scratch and hope to get it right second time round. The design looks sick? It is sick! That’s the challenge!
SP
Sanjeev Prabhakar
Sat, Nov 4, 2023 4:29 AM

Wow
Wonderful animation 👌

On Sat, 4 Nov, 2023, 9:10 am Caddiy via Discuss, discuss@lists.openscad.org
wrote:

Revar Desmera wrote:

At this point, since you're doing all three axes, you could just merge the
right(), back(), and up() into one move(x,y,z) call for a slight
optimization.

-

Revar

That looks neat, I’ll try that.

You can see the original design below, wobble obviously exaggerated. An
engineer might find fault with the rods, but it gives the general idea. I
will do the trigonometry again from scratch and hope to get it right second
time round.

The design looks sick? It is sick! That’s the challenge!


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Wow Wonderful animation 👌 On Sat, 4 Nov, 2023, 9:10 am Caddiy via Discuss, <discuss@lists.openscad.org> wrote: > Revar Desmera wrote: > > At this point, since you're doing all three axes, you could just merge the > right(), back(), and up() into one move(x,y,z) call for a slight > optimization. > > - > > Revar > > That looks neat, I’ll try that. > > You can see the original design below, wobble obviously exaggerated. An > engineer might find fault with the rods, but it gives the general idea. I > will do the trigonometry again from scratch and hope to get it right second > time round. > > The design looks sick? It is sick! That’s the challenge! > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
J
jon
Sat, Nov 4, 2023 12:32 PM

That is a pretty amazing animation!

On 11/3/2023 11:40 PM, Caddiy via Discuss wrote:

Revar Desmera wrote:

 At this point, since you're doing all three axes, you could just
 merge the |right()|, |back()|, and |up()| into one |move(x,y,z)|
 call for a slight optimization.

  *

     Revar

That looks neat, I’ll try that.

You can see the original design below, wobble obviously exaggerated.
An engineer might find fault with the rods, but it gives the general
idea. I will do the trigonometry again from scratch and hope to get it
right second time round.

The design looks sick? It is sick! That’s the challenge!


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

That is a pretty amazing animation! On 11/3/2023 11:40 PM, Caddiy via Discuss wrote: > > Revar Desmera wrote: > > At this point, since you're doing all three axes, you could just > merge the |right()|, |back()|, and |up()| into one |move(x,y,z)| > call for a slight optimization. > > * > > Revar > > That looks neat, I’ll try that. > > You can see the original design below, wobble obviously exaggerated. > An engineer might find fault with the rods, but it gives the general > idea. I will do the trigonometry again from scratch and hope to get it > right second time round. > > The design looks sick? It is sick! That’s the challenge! > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
M
mikeonenine@web.de
Mon, Nov 6, 2023 11:55 PM

Sanjeev Prabhakar wrote

Sat, Nov 4, 2023 12:29 AM

Wow
Wonderful animation 👌

jon wrote

Sat, Nov 4, 2023 8:32 AM

That is a pretty amazing animation!

Thanx for the words of appreciation.

Here is the version of the rods with “sweep“ and without sparkly effects, showing the effect of precession alone. Adding reciprocation should be relatively simple.

While at -180 and +180 a cosine wave is level, a sine wave has maximum slope. So the vertical sinusoidal deflection had to be attenuated towards the ends. For that, the ends of the horizontal cosine wave had to be fixed on the centre line, so that just the middle moves, while the sine wave starts and ends at zero, as required. The ends of the rods also wandered slightly, probably because precession is spherical, not planar. This was very puzzling until it occurred to me that it might be a second order phenomenon... The correction had to be attenuated towards the middle, to avoid simply shifting the wandering there.

I'll never be able to look a plate of spaghetti in the eye again.

Caddiy

> Sanjeev Prabhakar wrote > > Sat, Nov 4, 2023 12:29 AM > > Wow \ > Wonderful animation 👌 > jon wrote > > Sat, Nov 4, 2023 8:32 AM > > That is a pretty amazing animation! Thanx for the words of appreciation. Here is the version of the rods with “sweep“ and without sparkly effects, showing the effect of precession alone. Adding reciprocation should be relatively simple. While at -180 and +180 a cosine wave is level, a sine wave has maximum slope. So the vertical sinusoidal deflection had to be attenuated towards the ends. For that, the ends of the horizontal cosine wave had to be fixed on the centre line, so that just the middle moves, while the sine wave starts and ends at zero, as required. The ends of the rods also wandered slightly, probably because precession is spherical, not planar. This was very puzzling until it occurred to me that it might be a second order phenomenon... The correction had to be attenuated towards the middle, to avoid simply shifting the wandering there. I'll never be able to look a plate of spaghetti in the eye again. Caddiy