M
mikeonenine@web.de
Fri, Nov 1, 2024 1:49 AM
It is not possible to produce a concave curve in a polygon with positive values, as with a convex curve, because the start and finish are the wrong way round. To get round that, the values have to be made negative. But OpenSCAD doesn’t like that and sends me a “deprecated” error message, but at least it works.
Is there a proper way to get a concave curve?
Example:
polygon([
[0, 0],
[0, 10],
for (i=[0:90])
[2*sin(i)+2, 2*cos(i)+8],
for (i=[-180:-270])
[2*sin(-i)+6, 2*cos(-i)+6],
[8, 4],
[8, 0],
]);
It is not possible to produce a concave curve in a polygon with positive values, as with a convex curve, because the start and finish are the wrong way round. To get round that, the values have to be made negative. But OpenSCAD doesn’t like that and sends me a “deprecated” error message, but at least it works.
Is there a proper way to get a concave curve?
Example:
`polygon([`
`[0, 0],`
`[0, 10],`
`for (i=[0:90])`
`[2*sin(i)+2, 2*cos(i)+8],`
`for (i=[-180:-270])`
`[2*sin(-i)+6, 2*cos(-i)+6],`
`[8, 4],`
`[8, 0],`
`]);`
AM
Adrian Mariano
Fri, Nov 1, 2024 1:56 AM
I have no clue what you mean about "concave curve in a polygon with
positive values" but if you write a range like [-180:-270] where the
closing value is SMALLER than the larger value then OpenSCAD interprets it
as [-270:-180] and processes it in ascending order. Normally one expects a
range like that to produce no output. To avoid getting caught by this best
practice is to always specify a step size in your ranges, so for example
[-180:-1:-270] if that's what you wanted. And never rely on the ridiculous
behavior of processing ranges in reverse order.
On Thu, Oct 31, 2024 at 9:50 PM Caddiy via Discuss <
discuss@lists.openscad.org> wrote:
It is not possible to produce a concave curve in a polygon with positive
values, as with a convex curve, because the start and finish are the wrong
way round. To get round that, the values have to be made negative. But
OpenSCAD doesn’t like that and sends me a “deprecated” error message, but
at least it works.
Is there a proper way to get a concave curve?
Example:
polygon([
[0, 0],
[0, 10],
for (i=[0:90])
[2sin(i)+2, 2cos(i)+8],
for (i=[-180:-270])
[2sin(-i)+6, 2cos(-i)+6],
[8, 4],
[8, 0],
]);
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
I have no clue what you mean about "concave curve in a polygon with
positive values" but if you write a range like [-180:-270] where the
closing value is SMALLER than the larger value then OpenSCAD interprets it
as [-270:-180] and processes it in ascending order. Normally one expects a
range like that to produce no output. To avoid getting caught by this best
practice is to always specify a step size in your ranges, so for example
[-180:-1:-270] if that's what you wanted. And never rely on the ridiculous
behavior of processing ranges in reverse order.
On Thu, Oct 31, 2024 at 9:50 PM Caddiy via Discuss <
discuss@lists.openscad.org> wrote:
> It is not possible to produce a concave curve in a polygon with positive
> values, as with a convex curve, because the start and finish are the wrong
> way round. To get round that, the values have to be made negative. But
> OpenSCAD doesn’t like that and sends me a “deprecated” error message, but
> at least it works.
>
> Is there a proper way to get a concave curve?
>
> Example:
>
> polygon([
>
> [0, 0],
>
> [0, 10],
>
> for (i=[0:90])
>
> [2*sin(i)+2, 2*cos(i)+8],
>
> for (i=[-180:-270])
>
> [2*sin(-i)+6, 2*cos(-i)+6],
>
> [8, 4],
>
> [8, 0],
>
> ]);
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
M
mikeonenine@web.de
Fri, Nov 1, 2024 2:39 AM
I have no clue what you mean about "concave curve in a polygon with
positive values" but if you write a range like [-180:-270] where the
closing value is SMALLER than the larger value then OpenSCAD interprets it
as [-270:-180] and processes it in ascending order. Normally one expects a
range like that to produce no output. To avoid getting caught by this best
practice is to always specify a step size in your ranges, so for example
[-180:-1:-270] if that's what you wanted. And never rely on the ridiculous
behavior of processing ranges in reverse order.
On Thu, Oct 31, 2024 at 9:50 PM Caddiy via Discuss <
discuss@lists.openscad.org> wrote:
It is not possible to produce a concave curve in a polygon with positive
values, as with a convex curve, because the start and finish are the wrong
way round. To get round that, the values have to be made negative. But
OpenSCAD doesn’t like that and sends me a “deprecated” error message, but
at least it works.
Is there a proper way to get a concave curve?
Example:
polygon([
[0, 0],
[0, 10],
for (i=[0:90])
[2sin(i)+2, 2cos(i)+8],
for (i=[-180:-270])
[2sin(-i)+6, 2cos(-i)+6],
[8, 4],
[8, 0],
]);
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Positive values like 0:90 give a clockwise convex curve that fits in with the order that coordinates of a polygon have to be in, but +180:+270 for a concave curve messes things up, because the start and finish are back to front. That can be cured by going negative, but a deprecated error message appears.
Inserting :-1 unfortunately doesn’t help.
The first pic shows what I want (preferably without an error message).
The first
Adrian Mariano wrote:
> I have no clue what you mean about "concave curve in a polygon with
> positive values" but if you write a range like \[-180:-270\] where the
> closing value is SMALLER than the larger value then OpenSCAD interprets it
> as \[-270:-180\] and processes it in ascending order. Normally one expects a
> range like that to produce no output. To avoid getting caught by this best
> practice is to always specify a step size in your ranges, so for example
> \[-180:-1:-270\] if that's what you wanted. And never rely on the ridiculous
> behavior of processing ranges in reverse order.
>
> On Thu, Oct 31, 2024 at 9:50 PM Caddiy via Discuss <
> discuss@lists.openscad.org> wrote:
>
> > It is not possible to produce a concave curve in a polygon with positive
> > values, as with a convex curve, because the start and finish are the wrong
> > way round. To get round that, the values have to be made negative. But
> > OpenSCAD doesn’t like that and sends me a “deprecated” error message, but
> > at least it works.
> >
> > Is there a proper way to get a concave curve?
> >
> > Example:
> >
> > polygon(\[
> >
> > \[0, 0\],
> >
> > \[0, 10\],
> >
> > for (i=\[0:90\])
> >
> > \[2*sin(i)+2, 2*cos(i)+8\],
> >
> > for (i=\[-180:-270\])
> >
> > \[2*sin(-i)+6, 2*cos(-i)+6\],
> >
> > \[8, 4\],
> >
> > \[8, 0\],
> >
> > \]);
> >
> > ---
> >
> > OpenSCAD mailing list
> > To unsubscribe send an email to discuss-leave@lists.openscad.org
Positive values like 0:90 give a clockwise convex curve that fits in with the order that coordinates of a polygon have to be in, but +180:+270 for a concave curve messes things up, because the start and finish are back to front. That can be cured by going negative, but a deprecated error message appears.
Inserting :-1 unfortunately doesn’t help.
The first pic shows what I want (preferably without an error message).
The first
M
mikeonenine@web.de
Fri, Nov 1, 2024 2:41 AM
The first pic shows what I want (preferably without an error message).
Sorry, the pix came out the wrong way round too.
The last pic is what I want.
mikeonenine@web.de wrote:
> The first pic shows what I want (preferably without an error message).
Sorry, the pix came out the wrong way round too.
The last pic is what I want.
AM
Adrian Mariano
Fri, Nov 1, 2024 3:04 AM
You need to produce the points in the required order to make the shape you
want. It's that simple. So think it through. Scribble pictures on paper
or whatever will help if it's not obvious. If you get the message about
deprecated ranges and you LIKE the result there's a simple solution: flip
the order of the items in the range to be in ascending order. If you want
to go backwards, insert a negative step size like [270:-1:180]
On Thu, Oct 31, 2024 at 10:41 PM Caddiy via Discuss <
discuss@lists.openscad.org> wrote:
mikeonenine@web.de wrote:
The first pic shows what I want (preferably without an error message).
Sorry, the pix came out the wrong way round too.
The last pic is what I want.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
You need to produce the points in the required order to make the shape you
want. It's that simple. So think it through. Scribble pictures on paper
or whatever will help if it's not obvious. If you get the message about
deprecated ranges and you LIKE the result there's a simple solution: flip
the order of the items in the range to be in ascending order. If you want
to go backwards, insert a negative step size like [270:-1:180]
On Thu, Oct 31, 2024 at 10:41 PM Caddiy via Discuss <
discuss@lists.openscad.org> wrote:
> mikeonenine@web.de wrote:
>
> The first pic shows what I want (preferably without an error message).
>
> Sorry, the pix came out the wrong way round too.
>
> The last pic is what I want.
>
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
MM
Michael Marx (spintel)
Fri, Nov 1, 2024 3:10 AM
This is your problem. 11 to 12-16 to 17, causes those spikes. (Note I increased the step size)
From: Caddiy via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 13:42
To: discuss@lists.openscad.org
Cc: mikeonenine@web.de
Subject: [OpenSCAD] Re: Deprecated fillet
mikeonenine@web.de wrote:
The first pic shows what I want (preferably without an error message).
Sorry, the pix came out the wrong way round too.
The last pic is what I want.
This is your problem. 11 to 12-16 to 17, causes those spikes. (Note I increased the step size)
_____
From: Caddiy via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 13:42
To: discuss@lists.openscad.org
Cc: mikeonenine@web.de
Subject: [OpenSCAD] Re: Deprecated fillet
mikeonenine@web.de wrote:
The first pic shows what I want (preferably without an error message).
Sorry, the pix came out the wrong way round too.
The last pic is what I want.
MM
Michael Marx (spintel)
Fri, Nov 1, 2024 3:17 AM
//code if it helps
p=[
[0, 0],
[0, 10],
for (i=[0:10:90])
[2sin(i)+2, 2cos(i)+8],
for (i=[-180:-20:-270])
[2sin(-i)+6, 2cos(-i)+6],
[8, 4],
[8, 0],
];
polygon(p);
echo(p=p);
for (i=[0:len(p)-1])
translate(p[i]) {
color("black") {
echo(i=i,p[i]);
circle(0.1);
text(size=.52,str(i));
}
}
From: Michael Marx (spintel) via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 14:10
To: 'OpenSCAD general discussion Mailing-list'
Cc: Michael Marx (spintel)
Subject: [OpenSCAD] Re: Deprecated fillet
This is your problem. 11 to 12-16 to 17, causes those spikes. (Note I increased the step size)
From: Caddiy via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 13:42
To: discuss@lists.openscad.org
Cc: mikeonenine@web.de
Subject: [OpenSCAD] Re: Deprecated fillet
mikeonenine@web.de wrote:
The first pic shows what I want (preferably without an error message).
Sorry, the pix came out the wrong way round too.
The last pic is what I want.
//code if it helps
p=[
[0, 0],
[0, 10],
for (i=[0:10:90])
[2*sin(i)+2, 2*cos(i)+8],
for (i=[-180:-20:-270])
[2*sin(-i)+6, 2*cos(-i)+6],
[8, 4],
[8, 0],
];
polygon(p);
echo(p=p);
for (i=[0:len(p)-1])
translate(p[i]) {
color("black") {
echo(i=i,p[i]);
circle(0.1);
text(size=.52,str(i));
}
}
_____
From: Michael Marx (spintel) via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 14:10
To: 'OpenSCAD general discussion Mailing-list'
Cc: Michael Marx (spintel)
Subject: [OpenSCAD] Re: Deprecated fillet
This is your problem. 11 to 12-16 to 17, causes those spikes. (Note I increased the step size)
_____
From: Caddiy via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 13:42
To: discuss@lists.openscad.org
Cc: mikeonenine@web.de
Subject: [OpenSCAD] Re: Deprecated fillet
mikeonenine@web.de wrote:
The first pic shows what I want (preferably without an error message).
Sorry, the pix came out the wrong way round too.
The last pic is what I want.
MM
Michael Marx (spintel)
Fri, Nov 1, 2024 3:21 AM
From: Michael Marx (spintel) via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 14:18
To: 'OpenSCAD general discussion Mailing-list'
Cc: Michael Marx (spintel)
Subject: [OpenSCAD] Re: Deprecated fillet
//code if it helps
p=[
[0, 0],
[0, 10],
for (i=[0:10:90])
[2sin(i)+2, 2cos(i)+8],
for (i=[-180:-20:-270])
[2sin(-i)+6, 2cos(-i)+6],
[8, 4],
[8, 0],
];
polygon(p);
echo(p=p);
for (i=[0:len(p)-1])
translate(p[i]) {
color("black") {
echo(i=i,p[i]);
circle(0.1);
text(size=.52,str(i));
}
}
From: Michael Marx (spintel) via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 14:10
To: 'OpenSCAD general discussion Mailing-list'
Cc: Michael Marx (spintel)
Subject: [OpenSCAD] Re: Deprecated fillet
This is your problem. 11 to 12-16 to 17, causes those spikes. (Note I increased the step size)
From: Caddiy via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 13:42
To: discuss@lists.openscad.org
Cc: mikeonenine@web.de
Subject: [OpenSCAD] Re: Deprecated fillet
mikeonenine@web.de wrote:
The first pic shows what I want (preferably without an error message).
Sorry, the pix came out the wrong way round too.
The last pic is what I want.
_____
From: Michael Marx (spintel) via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 14:18
To: 'OpenSCAD general discussion Mailing-list'
Cc: Michael Marx (spintel)
Subject: [OpenSCAD] Re: Deprecated fillet
//code if it helps
p=[
[0, 0],
[0, 10],
for (i=[0:10:90])
[2*sin(i)+2, 2*cos(i)+8],
for (i=[-180:-20:-270])
[2*sin(-i)+6, 2*cos(-i)+6],
[8, 4],
[8, 0],
];
polygon(p);
echo(p=p);
for (i=[0:len(p)-1])
translate(p[i]) {
color("black") {
echo(i=i,p[i]);
circle(0.1);
text(size=.52,str(i));
}
}
_____
From: Michael Marx (spintel) via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 14:10
To: 'OpenSCAD general discussion Mailing-list'
Cc: Michael Marx (spintel)
Subject: [OpenSCAD] Re: Deprecated fillet
This is your problem. 11 to 12-16 to 17, causes those spikes. (Note I increased the step size)
_____
From: Caddiy via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 13:42
To: discuss@lists.openscad.org
Cc: mikeonenine@web.de
Subject: [OpenSCAD] Re: Deprecated fillet
mikeonenine@web.de wrote:
The first pic shows what I want (preferably without an error message).
Sorry, the pix came out the wrong way round too.
The last pic is what I want.
M
mikeonenine@web.de
Fri, Nov 1, 2024 3:45 AM
there's a simple solution: flip the order of the items in the range to be in ascending order. If you want to go backwards, insert a negative step size like [270:-1:180]
Ah, that’s better and no error message. Thanx!
Adrian Mariano wrote:
> there's a simple solution: flip the order of the items in the range to be in ascending order. If you want to go backwards, insert a negative step size like \[270:-1:180\]
Ah, that’s better and no error message. Thanx!
M
mikeonenine@web.de
Fri, Nov 1, 2024 3:48 AM
Michael Marx (spintel) wrote:
From: Michael Marx (spintel) via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 14:18
To: 'OpenSCAD general discussion Mailing-list'
Cc: Michael Marx (spintel)
Subject: [OpenSCAD] Re: Deprecated fillet
//code if it helps
p=[
[0, 0],
[0, 10],
for (i=[0:10:90])
[2sin(i)+2, 2cos(i)+8],
for (i=[-180:-20:-270])
[2sin(-i)+6, 2cos(-i)+6],
[8, 4],
[8, 0],
];
polygon(p);
echo(p=p);
for (i=[0:len(p)-1])
translate(p[i]) {
color("black") {
echo(i=i,p[i]);
circle(0.1);
text(size=.52,str(i));
}
}
From: Michael Marx (spintel) via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 14:10
To: 'OpenSCAD general discussion Mailing-list'
Cc: Michael Marx (spintel)
Subject: [OpenSCAD] Re: Deprecated fillet
This is your problem. 11 to 12-16 to 17, causes those spikes. (Note I increased the step size)
From: Caddiy via Discuss [mailto:discuss@lists.openscad.org]
Sent: Fri, 1 Nov 2024 13:42
To: discuss@lists.openscad.org
Cc: mikeonenine@web.de
Subject: [OpenSCAD] Re: Deprecated fillet
mikeonenine@web.de wrote:
The first pic shows what I want (preferably without an error message).
Sorry, the pix came out the wrong way round too.
The last pic is what I want.
The code didn’t work at first but now it does.
I like the numbered coordinates - very useful for debugging. Thanx!
Michael Marx (spintel) wrote:
> ---
>
> From: Michael Marx (spintel) via Discuss \[mailto:discuss@lists.openscad.org\]
> Sent: Fri, 1 Nov 2024 14:18
> To: 'OpenSCAD general discussion Mailing-list'
> Cc: Michael Marx (spintel)
> Subject: \[OpenSCAD\] Re: Deprecated fillet
>
> //code if it helps
>
> p=\[
> \[0, 0\],
> \[0, 10\],
> for (i=\[0:10:90\])
> \[2*sin(i)+2, 2*cos(i)+8\],
> for (i=\[-180:-20:-270\])
> \[2*sin(-i)+6, 2*cos(-i)+6\],
> \[8, 4\],
> \[8, 0\],
> \];
> polygon(p);
> echo(p=p);
> for (i=\[0:len(p)-1\])
> translate(p\[i\]) {
> color("black") {
> echo(i=i,p\[i\]);
> circle(0.1);
> text(size=.52,str(i));
> }
> }
>
> ---
>
> From: Michael Marx (spintel) via Discuss \[mailto:discuss@lists.openscad.org\]
> Sent: Fri, 1 Nov 2024 14:10
> To: 'OpenSCAD general discussion Mailing-list'
> Cc: Michael Marx (spintel)
> Subject: \[OpenSCAD\] Re: Deprecated fillet
>
> This is your problem. 11 to 12-16 to 17, causes those spikes. (Note I increased the step size)
>
> ---
>
> From: Caddiy via Discuss \[mailto:discuss@lists.openscad.org\]
> Sent: Fri, 1 Nov 2024 13:42
> To: discuss@lists.openscad.org
> Cc: mikeonenine@web.de
> Subject: \[OpenSCAD\] Re: Deprecated fillet
>
> mikeonenine@web.de wrote:
> The first pic shows what I want (preferably without an error message).
> Sorry, the pix came out the wrong way round too.
> The last pic is what I want.
The code didn’t work at first but now it does.
I like the numbered coordinates - very useful for debugging. Thanx!