discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] 2dgraph; equation-based 2-D shapes in openSCAD

DE
David Eccles (gringer)
Mon, Jan 18, 2016 12:16 AM

Making parametric curves is fairly easy in OpenSCAD now that it supports list
comprehesions and concatenation:

http://forum.openscad.org/file/n15743/parametric_spiral.png

--
View this message in context: http://forum.openscad.org/2dgraph-equation-based-2-D-shapes-in-openSCAD-tp15722p15743.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Making parametric curves is fairly easy in OpenSCAD now that it supports list comprehesions and concatenation: <http://forum.openscad.org/file/n15743/parametric_spiral.png> -- View this message in context: http://forum.openscad.org/2dgraph-equation-based-2-D-shapes-in-openSCAD-tp15722p15743.html Sent from the OpenSCAD mailing list archive at Nabble.com.
CA
Carsten Arnholm
Mon, Jan 18, 2016 5:36 PM

On 18. jan. 2016 01:16, David Eccles (gringer) wrote:

Making parametric curves is fairly easy in OpenSCAD now that it supports list
comprehesions and concatenation:

http://forum.openscad.org/file/n15743/parametric_spiral.png

What does the code to create the spiral look like?

Carsten Arnholm

On 18. jan. 2016 01:16, David Eccles (gringer) wrote: > Making parametric curves is fairly easy in OpenSCAD now that it supports list > comprehesions and concatenation: > > <http://forum.openscad.org/file/n15743/parametric_spiral.png> What does the code to create the spiral look like? Carsten Arnholm
HL
Hans L
Tue, Jan 19, 2016 1:13 AM

Carsten, have a look at this github repo:
https://github.com/openscad/list-comprehension-demos

At the bottom is a 2d sprial example.

On Mon, Jan 18, 2016 at 11:36 AM, Carsten Arnholm arnholm@arnholm.org
wrote:

On 18. jan. 2016 01:16, David Eccles (gringer) wrote:

Making parametric curves is fairly easy in OpenSCAD now that it supports
list
comprehesions and concatenation:

http://forum.openscad.org/file/n15743/parametric_spiral.png

What does the code to create the spiral look like?

Carsten Arnholm


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Carsten, have a look at this github repo: https://github.com/openscad/list-comprehension-demos At the bottom is a 2d sprial example. On Mon, Jan 18, 2016 at 11:36 AM, Carsten Arnholm <arnholm@arnholm.org> wrote: > On 18. jan. 2016 01:16, David Eccles (gringer) wrote: > >> Making parametric curves is fairly easy in OpenSCAD now that it supports >> list >> comprehesions and concatenation: >> >> <http://forum.openscad.org/file/n15743/parametric_spiral.png> >> > > What does the code to create the spiral look like? > > Carsten Arnholm > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
HL
Hans L
Tue, Jan 19, 2016 1:17 AM

Interesting, I normally view this mailing list through my gmail account.
David Eccles' post does not show any code here.  However I just viewed this
thread through nabble, and there is openscad code in his post.

Any ideas why the mailing list cuts that out?

On Mon, Jan 18, 2016 at 7:13 PM, Hans L thehans@gmail.com wrote:

Carsten, have a look at this github repo:
https://github.com/openscad/list-comprehension-demos

At the bottom is a 2d sprial example.

On Mon, Jan 18, 2016 at 11:36 AM, Carsten Arnholm arnholm@arnholm.org
wrote:

On 18. jan. 2016 01:16, David Eccles (gringer) wrote:

Making parametric curves is fairly easy in OpenSCAD now that it supports
list
comprehesions and concatenation:

http://forum.openscad.org/file/n15743/parametric_spiral.png

What does the code to create the spiral look like?

Carsten Arnholm


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Interesting, I normally view this mailing list through my gmail account. David Eccles' post does not show any code here. However I just viewed this thread through nabble, and there is openscad code in his post. Any ideas why the mailing list cuts that out? On Mon, Jan 18, 2016 at 7:13 PM, Hans L <thehans@gmail.com> wrote: > Carsten, have a look at this github repo: > https://github.com/openscad/list-comprehension-demos > > At the bottom is a 2d sprial example. > > On Mon, Jan 18, 2016 at 11:36 AM, Carsten Arnholm <arnholm@arnholm.org> > wrote: > >> On 18. jan. 2016 01:16, David Eccles (gringer) wrote: >> >>> Making parametric curves is fairly easy in OpenSCAD now that it supports >>> list >>> comprehesions and concatenation: >>> >>> <http://forum.openscad.org/file/n15743/parametric_spiral.png> >>> >> >> What does the code to create the spiral look like? >> >> Carsten Arnholm >> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > >
R
runsun
Tue, Jan 19, 2016 3:44 AM

thehans wrote

Any ideas why the mailing list cuts that out?

I believe that the code uses <raw> tag, which will not be sent to
mailing list.


$  Runsun Pan, PhD

$ libs:

doctest ,

faces ( git ),

offline doc ( git ),

runscad.py( 1 , 2 , git ),

synwrite( 1 , 2 );

$ tips:

hash( 1 , 2 ),

sweep ,

var( 1 , 2 ),

lerp ,

animGif ,

precision( 1 , 2 ),

xl-control

--
View this message in context: http://forum.openscad.org/2dgraph-equation-based-2-D-shapes-in-openSCAD-tp15722p15756.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

thehans wrote > Any ideas why the mailing list cuts that out? I believe that the code uses &lt;raw&gt; tag, which will not be sent to mailing list. ----- $ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py( 1 , 2 , git ), synwrite( 1 , 2 ); $ tips: hash( 1 , 2 ), sweep , var( 1 , 2 ), lerp , animGif , precision( 1 , 2 ), xl-control -- View this message in context: http://forum.openscad.org/2dgraph-equation-based-2-D-shapes-in-openSCAD-tp15722p15756.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Tue, Jan 19, 2016 3:46 AM

If you use the < code > tags (under More button), that gets cut by nabble, a
supposed security feature I think.

Best to use < quote > ...code... < / quote >, that gets thru.
DO NOT CLICK the Quote button, that will insert the previous post.

If you didn't get the graphic, it is the plain v's MIME setting on the
mailing list.
Go  here <http:// discuss@lists.openscad.org>  login (email in field at
bottom) to change your options. Or ask me to (PM).


Newly minted Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/2dgraph-equation-based-2-D-shapes-in-openSCAD-tp15722p15757.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

If you use the < code > tags (under More button), that gets cut by nabble, a supposed security feature I think. Best to use < quote > ...code... < / quote >, that gets thru. DO NOT CLICK the Quote button, that will insert the previous post. If you didn't get the graphic, it is the plain v's MIME setting on the mailing list. Go here <http:// discuss@lists.openscad.org> login (email in field at bottom) to change your options. Or ask me to (PM). ----- Newly minted Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/2dgraph-equation-based-2-D-shapes-in-openSCAD-tp15722p15757.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Tue, Jan 19, 2016 3:48 AM

oops...yes < raw >< /raw > not < code >


Newly minted Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/2dgraph-equation-based-2-D-shapes-in-openSCAD-tp15722p15758.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

oops...yes < raw >< /raw > not < code > ----- Newly minted Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/2dgraph-equation-based-2-D-shapes-in-openSCAD-tp15722p15758.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DE
David Eccles (gringer)
Tue, Jan 19, 2016 10:06 AM

Reproduced here for completeness (without any special tags):

r=1;
thickness=2;
loops=3;
linear_extrude(height=1) polygon(points= concat(
[for(t = [90:360*loops])
[(r-thickness+t/90)*sin(t),(r-thickness+t/90)cos(t)]],
[for(t = [360
loops:-1:90])
[(r+t/90)*sin(t),(r+t/90)*cos(t)]]
));

--
View this message in context: http://forum.openscad.org/2dgraph-equation-based-2-D-shapes-in-openSCAD-tp15722p15759.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Reproduced here for completeness (without any special tags): r=1; thickness=2; loops=3; linear_extrude(height=1) polygon(points= concat( [for(t = [90:360*loops]) [(r-thickness+t/90)*sin(t),(r-thickness+t/90)*cos(t)]], [for(t = [360*loops:-1:90]) [(r+t/90)*sin(t),(r+t/90)*cos(t)]] )); -- View this message in context: http://forum.openscad.org/2dgraph-equation-based-2-D-shapes-in-openSCAD-tp15722p15759.html Sent from the OpenSCAD mailing list archive at Nabble.com.
CA
Carsten Arnholm
Tue, Jan 19, 2016 5:23 PM

On 19. jan. 2016 11:06, David Eccles (gringer) wrote:

Reproduced here for completeness (without any special tags):

r=1;
thickness=2;
loops=3;
linear_extrude(height=1) polygon(points= concat(
[for(t = [90:360*loops])
[(r-thickness+t/90)*sin(t),(r-thickness+t/90)cos(t)]],
[for(t = [360
loops:-1:90])
[(r+t/90)*sin(t),(r+t/90)*cos(t)]]
));

Thank you for sharing! It is rather "dense" syntax, I find it hard to
follow.

Before you posted it, I tried the spiral using AngelScript CSG, here is
the code for comparison
http://arnholm.org/software/as_csg/sweep_spiral.as

OpenSCAD csg file generated
http://arnholm.org/software/as_csg/sweep_spiral.csg

OpenSCAD view
http://arnholm.org/software/as_csg/sweep_spiral.png

The two include files:
http://arnholm.org/software/as_csg/lib_sweep.as
http://arnholm.org/software/as_csg/lib_degrees.as

Carsten Arnholm

On 19. jan. 2016 11:06, David Eccles (gringer) wrote: > Reproduced here for completeness (without any special tags): > > r=1; > thickness=2; > loops=3; > linear_extrude(height=1) polygon(points= concat( > [for(t = [90:360*loops]) > [(r-thickness+t/90)*sin(t),(r-thickness+t/90)*cos(t)]], > [for(t = [360*loops:-1:90]) > [(r+t/90)*sin(t),(r+t/90)*cos(t)]] > )); > Thank you for sharing! It is rather "dense" syntax, I find it hard to follow. Before you posted it, I tried the spiral using AngelScript CSG, here is the code for comparison http://arnholm.org/software/as_csg/sweep_spiral.as OpenSCAD csg file generated http://arnholm.org/software/as_csg/sweep_spiral.csg OpenSCAD view http://arnholm.org/software/as_csg/sweep_spiral.png The two include files: http://arnholm.org/software/as_csg/lib_sweep.as http://arnholm.org/software/as_csg/lib_degrees.as Carsten Arnholm
NH
nop head
Tue, Jan 19, 2016 5:43 PM

Is this easier to follow?

r = 1;
thickness = 2;
loops = 3;

start_angle = 90;
end_angle = 360 * loops;

function spiral(r, t) = let(r = (r + t / 90)) [r * sin(t), r * cos(t)];

inner = [for(t = [start_angle : end_angle]) spiral(r - thickness, t) ];

outer = [for(t = [end_angle : -1 : start_angle]) spiral(r, t) ];

polygon(concat(inner, outer));

On 19 January 2016 at 17:23, Carsten Arnholm arnholm@arnholm.org wrote:

On 19. jan. 2016 11:06, David Eccles (gringer) wrote:

Reproduced here for completeness (without any special tags):

r=1;
thickness=2;
loops=3;
linear_extrude(height=1) polygon(points= concat(
[for(t = [90:360*loops])
[(r-thickness+t/90)*sin(t),(r-thickness+t/90)cos(t)]],
[for(t = [360
loops:-1:90])
[(r+t/90)*sin(t),(r+t/90)*cos(t)]]
));

Thank you for sharing! It is rather "dense" syntax, I find it hard to
follow.

Before you posted it, I tried the spiral using AngelScript CSG, here is
the code for comparison
http://arnholm.org/software/as_csg/sweep_spiral.as

OpenSCAD csg file generated
http://arnholm.org/software/as_csg/sweep_spiral.csg

OpenSCAD view
http://arnholm.org/software/as_csg/sweep_spiral.png

The two include files:
http://arnholm.org/software/as_csg/lib_sweep.as
http://arnholm.org/software/as_csg/lib_degrees.as

Carsten Arnholm


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Is this easier to follow? r = 1; thickness = 2; loops = 3; start_angle = 90; end_angle = 360 * loops; function spiral(r, t) = let(r = (r + t / 90)) [r * sin(t), r * cos(t)]; inner = [for(t = [start_angle : end_angle]) spiral(r - thickness, t) ]; outer = [for(t = [end_angle : -1 : start_angle]) spiral(r, t) ]; polygon(concat(inner, outer)); On 19 January 2016 at 17:23, Carsten Arnholm <arnholm@arnholm.org> wrote: > On 19. jan. 2016 11:06, David Eccles (gringer) wrote: > >> Reproduced here for completeness (without any special tags): >> >> r=1; >> thickness=2; >> loops=3; >> linear_extrude(height=1) polygon(points= concat( >> [for(t = [90:360*loops]) >> [(r-thickness+t/90)*sin(t),(r-thickness+t/90)*cos(t)]], >> [for(t = [360*loops:-1:90]) >> [(r+t/90)*sin(t),(r+t/90)*cos(t)]] >> )); >> >> > > Thank you for sharing! It is rather "dense" syntax, I find it hard to > follow. > > Before you posted it, I tried the spiral using AngelScript CSG, here is > the code for comparison > http://arnholm.org/software/as_csg/sweep_spiral.as > > OpenSCAD csg file generated > http://arnholm.org/software/as_csg/sweep_spiral.csg > > OpenSCAD view > http://arnholm.org/software/as_csg/sweep_spiral.png > > The two include files: > http://arnholm.org/software/as_csg/lib_sweep.as > http://arnholm.org/software/as_csg/lib_degrees.as > > Carsten Arnholm > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >