discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

I'm sure this is trivial, but...

J
jon
Sun, Dec 13, 2015 12:37 PM

Not sure how to make the shape() function do the "obvious" thing.

use <sweep.scad>

function f(t) = [
(t / 1.5 + 0.5) * 10 * cos(1.5 * 360 * t),
(t / 1.5 + 0.5) * 10 * sin(1.5 * 360 * t),
100 * (1 - t)
];

function shape() =
[
for (a = [0:15])
(a%2 == 0) ? [5sin(a * 45/2), 5sin(a * 45/2] : [10sin(a *
45/2), 10
sin(a * 45/2];
]

/*    [
[ 0, 10],
[ 0, 10],
[10, 10],
[10,  0]
];
/
/
    [
[-10, -1],
[-10,  6],
[ -7,  6],
[ -7,  1],
[  7,  1],
[  7,  6],
[ 10,  6],
[ 10, -1]];
*/

step = 0.005;
path = [for (t=[0:step:1-step]) f(t)];
path_transforms = construct_transform_path(path);
sweep(shape(), path_transforms);

Not sure how to make the shape() function do the "obvious" thing. use <sweep.scad> function f(t) = [ (t / 1.5 + 0.5) * 10 * cos(1.5 * 360 * t), (t / 1.5 + 0.5) * 10 * sin(1.5 * 360 * t), 100 * (1 - t) ]; function shape() = [ for (a = [0:15]) (a%2 == 0) ? [5*sin(a * 45/2), 5*sin(a * 45/2] : [10*sin(a * 45/2), 10*sin(a * 45/2]; ] /* [ [ 0, 10], [ 0, 10], [10, 10], [10, 0] ]; */ /* [ [-10, -1], [-10, 6], [ -7, 6], [ -7, 1], [ 7, 1], [ 7, 6], [ 10, 6], [ 10, -1]]; */ step = 0.005; path = [for (t=[0:step:1-step]) f(t)]; path_transforms = construct_transform_path(path); sweep(shape(), path_transforms);
TP
Torsten Paul
Sun, Dec 13, 2015 12:44 PM

On 12/13/2015 01:37 PM, jon wrote:

Not sure how to make the shape() function do the "obvious" thing.

Um, why not explain what you are trying to do?

While I'm motivated to help, I'm not going to reverse engineer the
code trying to guess what the target is...

ciao,
Torsten.

On 12/13/2015 01:37 PM, jon wrote: > Not sure how to make the shape() function do the "obvious" thing. > Um, why not explain what you are trying to do? While I'm motivated to help, I'm not going to reverse engineer the code trying to guess what the target is... ciao, Torsten.
J
jon
Sun, Dec 13, 2015 12:55 PM

I was trying to get the loop to emit a series of 16 [x,y] positions to
create the shape.  The details of exactly which points are where is
probably irrelevant.

Does that help?

On 12/13/2015 7:44 AM, Torsten Paul wrote:

On 12/13/2015 01:37 PM, jon wrote:

Not sure how to make the shape() function do the "obvious" thing.

Um, why not explain what you are trying to do?

While I'm motivated to help, I'm not going to reverse engineer the
code trying to guess what the target is...

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org
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.7294 / Virus Database: 4483/11165 - Release Date: 12/12/15

I was trying to get the loop to emit a series of 16 [x,y] positions to create the shape. The details of exactly which points are where is probably irrelevant. Does that help? On 12/13/2015 7:44 AM, Torsten Paul wrote: > On 12/13/2015 01:37 PM, jon wrote: >> Not sure how to make the shape() function do the "obvious" thing. >> > Um, why not explain what you are trying to do? > > While I'm motivated to help, I'm not going to reverse engineer the > code trying to guess what the target is... > > ciao, > Torsten. > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > 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.7294 / Virus Database: 4483/11165 - Release Date: 12/12/15 > >
TP
Torsten Paul
Sun, Dec 13, 2015 1:07 PM

On 12/13/2015 01:55 PM, jon wrote:

I was trying to get the loop to emit a series of 16 [x,y] positions to
create the shape.  The details of exactly which points are where is
probably irrelevant.

Like so for an ellipse?:

function shape() = [ for (a = [0 : 35]) [ 5 * sin(a * 10), 8 * cos(a * 10) ] ];

// easy way to test just the shape :-)
polygon(shape());


Or to show the separate things going on in more detail:

function x(a) = (10 + sin(a * 10)) * sin(a);

function y(a) = (10 + sin(a * 10)) * cos(a);

function point(a) = [ x(a), y(a) ];

function shape() = [ for (a = [0 : 359]) point(a) ];

polygon(shape());

ciao,
Torsten.

On 12/13/2015 01:55 PM, jon wrote: > I was trying to get the loop to emit a series of 16 [x,y] positions to > create the shape. The details of exactly which points are where is > probably irrelevant. > Like so for an ellipse?: function shape() = [ for (a = [0 : 35]) [ 5 * sin(a * 10), 8 * cos(a * 10) ] ]; // easy way to test just the shape :-) polygon(shape()); ----- Or to show the separate things going on in more detail: function x(a) = (10 + sin(a * 10)) * sin(a); function y(a) = (10 + sin(a * 10)) * cos(a); function point(a) = [ x(a), y(a) ]; function shape() = [ for (a = [0 : 359]) point(a) ]; polygon(shape()); ciao, Torsten.
J
jon
Sun, Dec 13, 2015 1:14 PM

Thanks.  Those examples helped a lot in getting the syntax tweaked!

On 12/13/2015 8:07 AM, Torsten Paul wrote:

On 12/13/2015 01:55 PM, jon wrote:

I was trying to get the loop to emit a series of 16 [x,y] positions to
create the shape.  The details of exactly which points are where is
probably irrelevant.

Like so for an ellipse?:

function shape() = [ for (a = [0 : 35]) [ 5 * sin(a * 10), 8 * cos(a * 10) ] ];

// easy way to test just the shape :-)
polygon(shape());


Or to show the separate things going on in more detail:

function x(a) = (10 + sin(a * 10)) * sin(a);

function y(a) = (10 + sin(a * 10)) * cos(a);

function point(a) = [ x(a), y(a) ];

function shape() = [ for (a = [0 : 359]) point(a) ];

polygon(shape());

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org
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.7294 / Virus Database: 4483/11165 - Release Date: 12/12/15

Thanks. Those examples helped a lot in getting the syntax tweaked! On 12/13/2015 8:07 AM, Torsten Paul wrote: > On 12/13/2015 01:55 PM, jon wrote: >> I was trying to get the loop to emit a series of 16 [x,y] positions to >> create the shape. The details of exactly which points are where is >> probably irrelevant. >> > Like so for an ellipse?: > > function shape() = [ for (a = [0 : 35]) [ 5 * sin(a * 10), 8 * cos(a * 10) ] ]; > > // easy way to test just the shape :-) > polygon(shape()); > > ----- > > Or to show the separate things going on in more detail: > > function x(a) = (10 + sin(a * 10)) * sin(a); > > function y(a) = (10 + sin(a * 10)) * cos(a); > > function point(a) = [ x(a), y(a) ]; > > function shape() = [ for (a = [0 : 359]) point(a) ]; > > polygon(shape()); > > ciao, > Torsten. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > 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.7294 / Virus Database: 4483/11165 - Release Date: 12/12/15 > >