Author Topic: Squircle Plugin  (Read 13053 times)

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 239
    • View Profile
Squircle Plugin
« on: January 18, 2015, 09:09:04 am »
I am posting the first version on my "Squircle" plugin.  A squircle is a "rounded" square or rectangle - a shape somewhere between a square (or rectangle) and a circle (or ellipse) based on the selection of a power value.  See http://en.wikipedia.org/wiki/Squircle for details.

This plugin might be useful  to generate interesting shapes for model building in CamBam.

The plugin generates a Polyline (at Z=0) based on the set parameters (see sample image attached) and inserts it into the currently active model layer.  This polyline can be further edited as required.

Please let me know of any bugs, or issues, or useful improvements.

Geoff

Note: The "Pro" version is also now available:
« Last Edit: January 24, 2015, 08:59:40 am by GeoffreyGRoy »

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4847
    • View Profile
Re: Squircle Plugin
« Reply #1 on: January 18, 2015, 14:59:02 pm »
What about making it so that algorithms could be applied to different 'primitive shapes' ?
So there would be a menu of some sort where primitives could be selected such as;

circle
square
triangle
polygon

I'm thinking that different primitives would yield shapes such as, stars, polygons with curved sides, etc. I have no idea what they would produce if the right equations were applied. Whatever they produced the key point would be, they would be hard to draw by hand.
Made in England

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3184
    • View Profile
Re: Squircle Plugin
« Reply #2 on: January 18, 2015, 15:18:52 pm »
Along the line of Eddies thinking.

 I would like to see the hex as on the bolt head. There were couple of times I needed it and I'm sure others run in to it as well.

Cheers.

BTW, NICE plugin. Thanks.
My 2¢

Win10 (64 bit, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, Endurance Laser.

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 239
    • View Profile
Re: Squircle Plugin
« Reply #3 on: January 18, 2015, 22:49:18 pm »
Thanks for the comments. A polygon plugin has already been posted at:

(http://www.cambam.co.uk/forum/index.php?topic=2959.msg18551#msg18551)

 by rodneyk    and I did not see any real justification for duplicating those capabilities.

thanks

Geoff

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8541
    • View Profile
Re: Squircle Plugin
« Reply #4 on: January 19, 2015, 00:15:02 am »
Geoff,
I think he means a polygon "squircled".

Lloyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline kvom

  • CNC Jedi
  • *****
  • Posts: 1607
    • View Profile
Re: Squircle Plugin
« Reply #5 on: January 19, 2015, 02:44:39 am »
The thing to remember here is that this is a form of a "super ellipse", and the fact that it's somewhat rectangular is a function of the exponent (4).  Different exponents give different shapes, and the squircle does not derive from a rectangle.

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4847
    • View Profile
Re: Squircle Plugin
« Reply #6 on: January 19, 2015, 08:39:27 am »
The thing to remember here is that this is a form of a "super ellipse", and the fact that it's somewhat rectangular is a function of the exponent (4).  Different exponents give different shapes, and the squircle does not derive from a rectangle.

Yes so I'm talking sbout adding forms of 'super square', 'super triangle', 'super polygon', etc. and I'm saying I can't imagine what would be produced without trying it.
Made in England

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3184
    • View Profile
Re: Squircle Plugin
« Reply #7 on: January 19, 2015, 12:33:10 pm »
Thanks for the comments. A polygon plugin has already been posted at:

(http://www.cambam.co.uk/forum/index.php?topic=2959.msg18551#msg18551)

 by rodneyk    and I did not see any real justification for duplicating those capabilities.

thanks

Geoff



It is apparent that I missed that plugin. That why I was asking for a HEX.. Oh , never mind.. Don't worry about it ;D ;D
My 2¢

Win10 (64 bit, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, Endurance Laser.

Offline BR52

  • Wookie
  • ****
  • Posts: 362
    • View Profile
Re: Squircle Plugin
« Reply #8 on: January 19, 2015, 18:36:01 pm »
Geoff
If you know how to make other geometric shape, you are free to make your way.
Never mind that the rodneyk ever done.

In Portuguese "O rodneyk pisou na bola!"

   Armando

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 239
    • View Profile
Re: Squircle Plugin
« Reply #9 on: January 19, 2015, 22:50:24 pm »
Dear Armando and others

There are, of course, many different possibilities for generating 2D shapes (with both straight and curved edges).  There will always be particular shapes that might be useful, but it is unlikely that they can be described from a small number of parameters. Sometimes families of shapes are possible (like circles, ellipses, regular polygons and even squircles!) as these can be readily generated from a small number of parameters, and as a result these primitives are often provided in CAD packages.

In general, therefore, the only practical approach is to construct more complex shapes is from combinations of more fundamental primitives (like lines, polygons, circles, perhaps splines and even "free-hand drawings"), or from purpose built code.

It is therefore not really practical to extend my Squircle Plugin to produce more general shapes.

Geoff

Offline kvom

  • CNC Jedi
  • *****
  • Posts: 1607
    • View Profile
Re: Squircle Plugin
« Reply #10 on: January 20, 2015, 12:28:17 pm »
The most straightforward change that could be done is to have separate exponents for the X and Y values.

See this page for various possibilities:  http://mathworld.wolfram.com/Superellipse.html

You can also get more varied shapes by using the polar-coordinate version of the formula.  Here's a page that will let you play around with it graphically.  http://demonstrations.wolfram.com/SuperellipseShapes/
« Last Edit: January 20, 2015, 12:35:19 pm by kvom »

Offline Bob La Londe

  • CNC Jedi
  • *****
  • Posts: 4155
  • ^ 8.5 pounds on my own hand poured bait.
    • View Profile
    • CNC Molds N Stuff
Re: Squircle Plugin
« Reply #11 on: January 20, 2015, 18:08:21 pm »
Thanks for the comments. A polygon plugin has already been posted at:

(http://www.cambam.co.uk/forum/index.php?topic=2959.msg18551#msg18551)

 by rodneyk    and I did not see any real justification for duplicating those capabilities.

thanks

Geoff



It is apparent that I missed that plugin. That why I was asking for a HEX.. Oh , never mind.. Don't worry about it ;D ;D

Also, while much slower it was always possible to generate a uniform polygon through a few more steps. 

Draw a circle.
Draw point list by dividing circle. 
Draw lines from point to point. 
Connect lines. 
Rotate polygon and position as needed. 


Getting started on CNC?  In or passing through my area?
If I have the time I'll be glad to show you a little in my shop. 

Some Stuff I Make with CamBam
http://www.CNCMOLDS.com

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 239
    • View Profile
Re: Squircle Plugin
« Reply #12 on: January 24, 2015, 08:57:40 am »
Many thanks for the feedback, and especially the reference to the Wolfram Research web site from kvom.

I have now created a "Pro" version of the plugin ("Pro" because it is is a bit more complicated to select the desired parameters!).

This new version includes the first "Simple" option also, but now a "Complex" option with 6 parameters to define the shape.  Some experimentation is required to get interesting/useful shapes - but many are possible.  Potential users might want to check out the Wolfram Research we site (http://demonstrations.wolfram.com/SuperellipseShapes/) to get some hints for parameter values.

Please let me know of any bugs.

thanks

Geoff

Offline BR52

  • Wookie
  • ****
  • Posts: 362
    • View Profile
Re: Squircle Plugin
« Reply #13 on: January 24, 2015, 11:35:05 am »
Hi Geoff

Good idea, putting complex equation in your plugin, congratulations!
I said to you that is free to make, see here.
http://www.cambam.co.uk/forum/index.php?PHPSESSID=a0196dce034c5fa3e34734540b874e12&topic=4609.0

Please put your source code here.

   Armando

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6680
    • View Profile
    • Cambam V1.0 French Doc
Re: Squircle Plugin
« Reply #14 on: April 28, 2016, 17:20:08 pm »
Hello,

I'm playing with the plugin, and I see that when I click on Make Polyline, the polyline is added to the list in the layers tree, but it is not drawn on the screen until I move the squircle plugin windows (on Win XP, not tested on 7)

++
David