Scaling polygons via sine waves

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

Scaling polygons via sine waves

Chaoticenigma
Ive just figured out how tl extrude a polygon on a loop, to create this
spiral pattern. But my next feat is trying to scale each of these polygons,
via a sinewave function of some sort, to create vase shapes, and patterns.
Im new to this program so any help would be appreciated! Heres the code i
have so far.


layers = 30;
layer_height = 7;
z_rot = 10;
amp = 40;


vase();

module vase(){
  for(z = [0:1:layers]) {
     
     
    translate([0, 0, z * layer_height]){
       
       
      rotate (z * -z_rot){
         
         
        linear_extrude(layer_height, twist = z_rot){
           
           
           polygon (points=[
            [10,-25],
            [25,-10],
            [25,10],
            [10,25],
            [-10,25],
            [-25,10],
            [-25,-10],
            [-10,-25]
            ]);
            }
         }
      }
  }
}



--
Sent from: http://forum.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: Scaling polygons via sine waves

cacb
On 2020-02-13 04:42, Chaoticenigma wrote:
> Ive just figured out how tl extrude a polygon on a loop, to create this
> spiral pattern. But my next feat is trying to scale each of these
> polygons,
> via a sinewave function of some sort, to create vase shapes, and
> patterns.
> Im new to this program so any help would be appreciated! Heres the code
> i
> have so far.

To create vase shapes using only linear_extrude in OpenSCAD, you can
possibly accomplish what you want using a scale parameter taking a
vector, but I have not tried it. It is stretching the concept of
"linear_extrude" since it is no longer linear.

As you say, you need to be able to scale the profile using e.g. a sine
function in a sweep operation. I did exactly that to create a vase some
time ago, but using AngelCAD where a sweep function exists for such
purposes, see https://www.thingiverse.com/thing:2335400

Carsten Arnholm



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

Re: Scaling polygons via sine waves

Parkinbot
In reply to this post by Chaoticenigma
There is code for thousands of vases in Thingiverse. Have a look there.
Just a note: linear_extrude() has more parameters like *slices* and *scale*.
Try them out.



--
Sent from: http://forum.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: Scaling polygons via sine waves

caterpillar
In reply to this post by Chaoticenigma
Do you want to create a vase such as this?
https://cults3d.com/en/3d-model/art/superformula-vase

<http://forum.openscad.org/file/t1825/super.png>

I use the path_scaling_sections function (and other modules) of  dotSCAD
<https://github.com/JustinSDK/dotSCAD>   to create it. You might give it a
try.


<http://forum.openscad.org/file/t1825/lib-path_scaling_sections-2.jpg>




-----
https://openhome.cc
--
Sent from: http://forum.openscad.org/

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