discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Confused as how a this could happen

A
adrian
Mon, Jan 9, 2017 2:51 AM

I was writing a module to replace rotate_extrude() so that I could deal with
the issue that I mentioned in the  Does rotate_extrude angle property allow
for values that don't divide 360 evenly?
http://forum.openscad.org/Does-rotate-extrude-angle-property-allow-for-values-that-don-t-divide-360-evenly-td19835.html
thread.  However, I got some weird error which I can only describe as a
rounding error, but I am not exactly positive that it is.

Here is the full executable code:

and this is what I'm getting at the interface between the rotate_extrude()
and the extrude_end_segments():

http://forum.openscad.org/file/n19958/rounding_error.png

Note that the extrude_end_segments() is producing an object that is not the
same size as the rotate_extrude().  However, since these are only supposed
to be rotations, should there be that much of a change in size?  Looks to be
in the 1-0.1 unit range.  Is this indeed a rounding error?

Thanks,

A

--
View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I was writing a module to replace rotate_extrude() so that I could deal with the issue that I mentioned in the Does rotate_extrude angle property allow for values that don't divide 360 evenly? <http://forum.openscad.org/Does-rotate-extrude-angle-property-allow-for-values-that-don-t-divide-360-evenly-td19835.html> thread. However, I got some weird error which I can only describe as a rounding error, but I am not exactly positive that it is. Here is the full executable code: and this is what I'm getting at the interface between the rotate_extrude() and the extrude_end_segments(): <http://forum.openscad.org/file/n19958/rounding_error.png> Note that the extrude_end_segments() is producing an object that is not the same size as the rotate_extrude(). However, since these are only supposed to be rotations, should there be that much of a change in size? Looks to be in the 1-0.1 unit range. Is this indeed a rounding error? Thanks, A -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958.html Sent from the OpenSCAD mailing list archive at Nabble.com.
A
arnholm@arnholm.org
Mon, Jan 9, 2017 10:02 AM

On 2017-01-09 03:51, adrian wrote:

I was writing a module to replace rotate_extrude() so that I could deal
with
the issue that I mentioned in the  Does rotate_extrude angle property
allow
for values that don't divide 360 evenly?

I don't understand the premise of the problem. Where does this idea of
"values that don't divide 360 evenly" come from? That is just weird.
There is no such limitation, or at least there should not be. The only
thing is that in versions prior to 2016.xx, the angle parameter is
silently ignored and assumed to be 360.

Just use whatever angle you want with rotate_extrude. Granted, I have
not tried OpenSCAD 2016.xx yet, so if there is an issue it should be
identified and fixed. I think a simple example demonstrating the problem
should be provided, for example:

rotate_extrude(angle=57.295779513082320876798154814105)
translate([50,0,0]) circle(10);

Doesn't it work in 2016.xx ?

Carsten Arnholm

On 2017-01-09 03:51, adrian wrote: > I was writing a module to replace rotate_extrude() so that I could deal > with > the issue that I mentioned in the Does rotate_extrude angle property > allow > for values that don't divide 360 evenly? I don't understand the premise of the problem. Where does this idea of "values that don't divide 360 evenly" come from? That is just weird. There is no such limitation, or at least there should not be. The only thing is that in versions prior to 2016.xx, the angle parameter is silently ignored and assumed to be 360. Just use whatever angle you want with rotate_extrude. Granted, I have not tried OpenSCAD 2016.xx yet, so if there is an issue it should be identified and fixed. I think a simple example demonstrating the problem should be provided, for example: rotate_extrude(angle=57.295779513082320876798154814105) translate([50,0,0]) circle(10); Doesn't it work in 2016.xx ? Carsten Arnholm
P
Parkinbot
Mon, Jan 9, 2017 10:17 AM

cacb wrote

rotate_extrude(angle=57.295779513082320876798154814105)
translate([50,0,0]) circle(10);

Doesn't it work in 2016.xx ?

well, you won't get more than 7 digits (single) or so resolved, but of
course it works.

Where is the problem to download a 2016.xx and test it?

--
View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19963.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

cacb wrote > rotate_extrude(angle=57.295779513082320876798154814105) > translate([50,0,0]) circle(10); > > Doesn't it work in 2016.xx ? well, you won't get more than 7 digits (single) or so resolved, but of course it works. Where is the problem to download a 2016.xx and test it? -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19963.html Sent from the OpenSCAD mailing list archive at Nabble.com.
A
arnholm@arnholm.org
Mon, Jan 9, 2017 10:32 AM

On 2017-01-09 11:17, Parkinbot wrote:

Where is the problem to download a 2016.xx and test it?

The problem is not here. I have been using other software recently...
:-) I just figured the link to 2016.xx was at the bottom of the download
page. As could be expected my little example works, so the whole issue
is a non-problem.

Carsten Arnholm

On 2017-01-09 11:17, Parkinbot wrote: > > Where is the problem to download a 2016.xx and test it? The problem is not here. I have been using other software recently... :-) I just figured the link to 2016.xx was at the bottom of the download page. As could be expected my little example works, so the whole issue is a non-problem. Carsten Arnholm
P
Parkinbot
Mon, Jan 9, 2017 11:07 AM

cacb wrote

the whole issue is a non-problem.

Yes and no. A solution based on sweep() can easily be extended to something
more general than just a rotate_extrude. Remember our discussion about
threads http://www.thingiverse.com/thing:1659079  .

Adrian, this is your code using 2016.xx, some odd angle and an arbitrary
resolution.

rotate_extrude(angle = 42.234, $fn = 200) arrow_2d(1, .5, .25);
module arrow_2d(l,w,a)  polygon([[0,0],[w,0],[w,l-a],[w*1.3,l-a],[0,l]]);

--
View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19965.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

cacb wrote > the whole issue is a non-problem. Yes and no. A solution based on sweep() can easily be extended to something more general than just a rotate_extrude. Remember our discussion about threads <http://www.thingiverse.com/thing:1659079> . Adrian, this is your code using 2016.xx, some odd angle and an arbitrary resolution. > rotate_extrude(angle = 42.234, $fn = 200) arrow_2d(1, .5, .25); > module arrow_2d(l,w,a) polygon([[0,0],[w,0],[w,l-a],[w*1.3,l-a],[0,l]]); -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19965.html Sent from the OpenSCAD mailing list archive at Nabble.com.
A
arnholm@arnholm.org
Mon, Jan 9, 2017 12:15 PM

On 2017-01-09 12:07, Parkinbot wrote:

cacb wrote

the whole issue is a non-problem.

Yes and no. A solution based on sweep() can easily be extended to
something
more general than just a rotate_extrude. Remember our discussion about
threads http://www.thingiverse.com/thing:1659079  .

The non-problem referred to the value of the angle parameter.

Sure, a general sweep would be extremely useful, I agree. However, when
talking specifically about threads, one can imagine extending
rotate_extrude to take a pitch parameter and allow angles spanning
several whole revolutions. The model below was created using my own
variant of rotate_extrude (on top of carve), rotating 15*360 degrees and
with a suitable pitch. It is smart enough to protest if self
intersections will occur, so in practice it works.

http://www.thingiverse.com/thing:1445033

Carsten Arnholm

On 2017-01-09 12:07, Parkinbot wrote: > cacb wrote >> the whole issue is a non-problem. > > Yes and no. A solution based on sweep() can easily be extended to > something > more general than just a rotate_extrude. Remember our discussion about > threads <http://www.thingiverse.com/thing:1659079> . The non-problem referred to the value of the angle parameter. Sure, a general sweep would be extremely useful, I agree. However, when talking specifically about threads, one can imagine extending rotate_extrude to take a pitch parameter and allow angles spanning several whole revolutions. The model below was created using my own variant of rotate_extrude (on top of carve), rotating 15*360 degrees and with a suitable pitch. It is smart enough to protest if self intersections will occur, so in practice it works. http://www.thingiverse.com/thing:1445033 Carsten Arnholm
A
adrian
Mon, Jan 9, 2017 2:00 PM

cacb wrote

On 2017-01-09 03:51, adrian wrote:

I was writing a module to replace rotate_extrude() so that I could deal
with
the issue that I mentioned in the  Does rotate_extrude angle property
allow
for values that don't divide 360 evenly?

I don't understand the premise of the problem. Where does this idea of
"values that don't divide 360 evenly" come from? That is just weird.
There is no such limitation, or at least there should not be. The only
thing is that in versions prior to 2016.xx, the angle parameter is
silently ignored and assumed to be 360.

The premise is that $fn must be an integer, so you cannot have a
rotate_extrude produce an extrusion that doesn't result in a whole number of
angled segments.

cacb wrote

Just use whatever angle you want with rotate_extrude. Granted, I have
not tried OpenSCAD 2016.xx yet, so if there is an issue it should be
identified and fixed. I think a simple example demonstrating the problem
should be provided, for example:

rotate_extrude(angle=57.295779513082320876798154814105)
translate([50,0,0]) circle(10);

Doesn't it work in 2016.xx ?

I never got a clear answer if the angle of the extrusion would have a
complete, 100% scaled, 2d representation of the original on either end of
the extrusion.

--
View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19976.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

cacb wrote > On 2017-01-09 03:51, adrian wrote: >> I was writing a module to replace rotate_extrude() so that I could deal >> with >> the issue that I mentioned in the Does rotate_extrude angle property >> allow >> for values that don't divide 360 evenly? > > I don't understand the premise of the problem. Where does this idea of > "values that don't divide 360 evenly" come from? That is just weird. > There is no such limitation, or at least there should not be. The only > thing is that in versions prior to 2016.xx, the angle parameter is > silently ignored and assumed to be 360. The premise is that $fn must be an integer, so you cannot have a rotate_extrude produce an extrusion that doesn't result in a whole number of angled segments. cacb wrote > Just use whatever angle you want with rotate_extrude. Granted, I have > not tried OpenSCAD 2016.xx yet, so if there is an issue it should be > identified and fixed. I think a simple example demonstrating the problem > should be provided, for example: > > rotate_extrude(angle=57.295779513082320876798154814105) > translate([50,0,0]) circle(10); > > Doesn't it work in 2016.xx ? I never got a clear answer if the angle of the extrusion would have a complete, 100% scaled, 2d representation of the original on either end of the extrusion. -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19976.html Sent from the OpenSCAD mailing list archive at Nabble.com.
A
adrian
Mon, Jan 9, 2017 2:01 PM

Parkinbot wrote

Where is the problem to download a 2016.xx and test it?

I've not bothered as yet because afaik, I would have to build it and I'm
just too lazy.

--
View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19977.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Parkinbot wrote > Where is the problem to download a 2016.xx and test it? I've not bothered as yet because afaik, I would have to build it and I'm just too lazy. -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19977.html Sent from the OpenSCAD mailing list archive at Nabble.com.
A
adrian
Mon, Jan 9, 2017 2:07 PM

cacb wrote

On 2017-01-09 11:17, Parkinbot wrote:

Where is the problem to download a 2016.xx and test it?

The problem is not here. I have been using other software recently...
:-) I just figured the link to 2016.xx was at the bottom of the download
page. As could be expected my little example works, so the whole issue
is a non-problem.

Good to know about that.  Never bothered to go down the page recently.  I'll
try it out. :)

--
View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19978.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

cacb wrote > On 2017-01-09 11:17, Parkinbot wrote: >> >> Where is the problem to download a 2016.xx and test it? > > The problem is not here. I have been using other software recently... > :-) I just figured the link to 2016.xx was at the bottom of the download > page. As could be expected my little example works, so the whole issue > is a non-problem. Good to know about that. Never bothered to go down the page recently. I'll try it out. :) -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19978.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Mon, Jan 9, 2017 2:23 PM

adrian wrote

The premise is that $fn must be an integer, so you cannot have a
rotate_extrude produce an extrusion that doesn't result in a whole number
of angled segments.

Your premise is wrong. You may assign a fraction value to $fn: it will be
adjusted to an integer (with floor, I guess). If an angle is specified in
rotate_extrude, $fn is adjusted in order to ensure that the total angle is
met. See this example from above and bellow to confirm a perfect match:

color("blue")
translate([0,0,-7])
rotate_extrude(r=10, $fn=14.5)
translate([10,0]) square(5,center=true);

rotate_extrude(r=10, angle=360/7, $fn=14)
translate([10,0]) square(5,center=true);

color("red")
translate([0,0,7])
rotate_extrude(r=10, angle=360/7, $fn=18.5)
translate([10,0]) square(5,center=true);

--
View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19980.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

adrian wrote > The premise is that $fn must be an integer, so you cannot have a > rotate_extrude produce an extrusion that doesn't result in a whole number > of angled segments. Your premise is wrong. You may assign a fraction value to $fn: it will be adjusted to an integer (with floor, I guess). If an angle is specified in rotate_extrude, $fn is adjusted in order to ensure that the total angle is met. See this example from above and bellow to confirm a perfect match: > color("blue") > translate([0,0,-7]) > rotate_extrude(r=10, $fn=14.5) > translate([10,0]) square(5,center=true); > > rotate_extrude(r=10, angle=360/7, $fn=14) > translate([10,0]) square(5,center=true); > > color("red") > translate([0,0,7]) > rotate_extrude(r=10, angle=360/7, $fn=18.5) > translate([10,0]) square(5,center=true); -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19980.html Sent from the OpenSCAD mailing list archive at Nabble.com.