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:36 PM

Ronaldo wrote

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:

My premise wasn't wrong, but my wording was.  ;) Yes, I know that $fn can be
a floating point number, but it will be coerced into a integer in the
context that I was referring to.

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

Ronaldo wrote > > 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: My premise wasn't wrong, but my wording was. ;) Yes, I know that $fn can be a floating point number, but it will be coerced into a integer in the context that I was referring to. -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19981.html Sent from the OpenSCAD mailing list archive at Nabble.com.
A
arnholm@arnholm.org
Mon, Jan 9, 2017 2:49 PM

On 2017-01-09 15:00, adrian wrote:

cacb 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.

When you cut a cake, you will always get a whole number of slices, there
is simply no other way....

Carsten Arnholm

On 2017-01-09 15:00, adrian wrote: > cacb 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. When you cut a cake, you will always get a whole number of slices, there is simply no other way.... Carsten Arnholm
A
adrian
Mon, Jan 9, 2017 3:06 PM

So given the following:

I would get this:
http://forum.openscad.org/file/n19983/my-rotate-extrude.png

Changing the last parameter in test1() to false, I would get this:
http://forum.openscad.org/file/n19983/2016-rotate-extrude.png
If you notice, in my implementation, the extrusion is broken up into 6
parts, 4 of which are 10 degrees in size and the other 2, the remaining 2
being 2.3/2 (1.15) in size.  In the builtin, it is only 4 segments,
presumably 10.575 degrees in size.

I'm not saying anything is wrong with that, even if you can't control the
maximum rotation segment angle, but there is still a matter of the fit of my
implementation that I find odd.  AFAICS, this should fit properly and I'm
trying to confirm that this is due to a rounding error or not.

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

So given the following: I would get this: <http://forum.openscad.org/file/n19983/my-rotate-extrude.png> Changing the last parameter in test1() to false, I would get this: <http://forum.openscad.org/file/n19983/2016-rotate-extrude.png> If you notice, in my implementation, the extrusion is broken up into 6 parts, 4 of which are 10 degrees in size and the other 2, the remaining 2 being 2.3/2 (1.15) in size. In the builtin, it is only 4 segments, presumably 10.575 degrees in size. I'm not saying anything is wrong with that, even if you can't control the maximum rotation segment angle, but there is still a matter of the fit of my implementation that I find odd. AFAICS, this should fit properly and I'm trying to confirm that this is due to a rounding error or not. -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19983.html Sent from the OpenSCAD mailing list archive at Nabble.com.
A
adrian
Mon, Jan 9, 2017 3:11 PM

cacb wrote

On 2017-01-09 15:00, adrian wrote:

cacb 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.

When you cut a cake, you will always get a whole number of slices, there
is simply no other way....

Depends on your definition of "whole".  You can't get half a piece as each
piece is a whole piece, but there is no stipulation that each piece must be
exactly the same size. I could cut it into 10 slices of totally different
sizes.

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

cacb wrote > On 2017-01-09 15:00, adrian wrote: >> cacb 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. > > When you cut a cake, you will always get a whole number of slices, there > is simply no other way.... Depends on your definition of "whole". You can't get half a piece as each piece is a whole piece, but there is no stipulation that each piece must be exactly the same size. I could cut it into 10 slices of totally different sizes. -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19984.html Sent from the OpenSCAD mailing list archive at Nabble.com.
A
adrian
Mon, Jan 9, 2017 3:29 PM

adrian wrote

cacb wrote

On 2017-01-09 15:00, adrian wrote:

cacb 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.

When you cut a cake, you will always get a whole number of slices, there
is simply no other way....

Depends on your definition of "whole".  You can't get half a piece as each
piece is a whole piece, but there is no stipulation that each piece must
be exactly the same size. I could cut it into 10 slices of totally
different sizes.

In any case, this question has gone beyond the original.  I'm trying to
determine why there seems to be fitting errors and if they are due to
something I did or just rounding errors.

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

adrian wrote > > cacb wrote >> On 2017-01-09 15:00, adrian wrote: >>> cacb 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. >> >> When you cut a cake, you will always get a whole number of slices, there >> is simply no other way.... > Depends on your definition of "whole". You can't get half a piece as each > piece is a whole piece, but there is no stipulation that each piece must > be exactly the same size. I could cut it into 10 slices of totally > different sizes. In any case, this question has gone beyond the original. I'm trying to determine why there seems to be fitting errors and if they are due to something I did or just rounding errors. -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19985.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Mon, Jan 9, 2017 4:08 PM

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.

I still don't understand what your original issue is so I can't understand
what your replacement module is trying to do.

The angle value for rotate_extruder does not need to divide evenly into
360. The end of the object should have exactly the angle you specify. Is
that the not the case? Or is it something to do with how $fn creates the
facets that you find wrong?

On 9 January 2017 at 15:29, adrian adrianh.bsc@gmail.com wrote:

adrian wrote

cacb wrote

On 2017-01-09 15:00, adrian wrote:

cacb 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.

When you cut a cake, you will always get a whole number of slices, there
is simply no other way....

Depends on your definition of "whole".  You can't get half a piece as

each

piece is a whole piece, but there is no stipulation that each piece must
be exactly the same size. I could cut it into 10 slices of totally
different sizes.

In any case, this question has gone beyond the original.  I'm trying to
determine why there seems to be fitting errors and if they are due to
something I did or just rounding errors.

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


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

>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. I still don't understand what your original issue is so I can't understand what your replacement module is trying to do. The angle value for rotate_extruder does not need to divide evenly into 360. The end of the object should have exactly the angle you specify. Is that the not the case? Or is it something to do with how $fn creates the facets that you find wrong? On 9 January 2017 at 15:29, adrian <adrianh.bsc@gmail.com> wrote: > adrian wrote > > > > cacb wrote > >> On 2017-01-09 15:00, adrian wrote: > >>> cacb 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. > >> > >> When you cut a cake, you will always get a whole number of slices, there > >> is simply no other way.... > > Depends on your definition of "whole". You can't get half a piece as > each > > piece is a whole piece, but there is no stipulation that each piece must > > be exactly the same size. I could cut it into 10 slices of totally > > different sizes. > > In any case, this question has gone beyond the original. I'm trying to > determine why there seems to be fitting errors and if they are due to > something I did or just rounding errors. > > > > -- > View this message in context: http://forum.openscad.org/ > Confused-as-how-a-this-could-happen-tp19958p19985.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
A
adrian
Mon, Jan 9, 2017 4:43 PM

The original issue is no longer an issue.  Turns out that it will force the
correct angle segment size in 2016 which is close to 360/$fn such that it
will evenly divide the sweeping angle.

I was in 2015 so there wasn't an angle parameter, so I was trying to make
something that would do the same thing.  That is what the above programme
does.  The issue that I am pointing out here is only related to that thread
because that is how this started.  Ignore that thread now.

The issue that I am having is that I am trying to determine why the code
that I wrote doesn't result in sections that fit together exactly.  Is this
not working because the multiple transforms are causing the coordinate of
the objects to drift enough to see the issue that can be seen in the above
images where the surfaces are out of alignment?

Thanks,

A

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

The original issue is no longer an issue. Turns out that it will force the correct angle segment size in 2016 which is close to 360/$fn such that it will evenly divide the sweeping angle. I was in 2015 so there wasn't an angle parameter, so I was trying to make something that would do the same thing. That is what the above programme does. The issue that I am pointing out here is only related to that thread because that is how this started. *Ignore that thread now*. The issue that I am having is that I am trying to determine why the code that I wrote doesn't result in sections that fit together exactly. Is this not working because the multiple transforms are causing the coordinate of the objects to drift enough to see the issue that can be seen in the above images where the surfaces are out of alignment? Thanks, A -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19987.html Sent from the OpenSCAD mailing list archive at Nabble.com.
N
nophead
Mon, Jan 9, 2017 7:35 PM

Adding a # to extrude_end_segments shows that they overlap the middle of the
object, angle wise. So I think that might be why there is a step radially.

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

Adding a # to extrude_end_segments shows that they overlap the middle of the object, angle wise. So I think that might be why there is a step radially. -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19991.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Mon, Jan 9, 2017 8:58 PM

I am struggling to understand why it is so complicated. Why do you do the
end bits separately and not just intersect some oversized wedges with
rotate_extrude?

On 9 January 2017 at 19:35, nophead nop.head@gmail.com wrote:

Adding a # to extrude_end_segments shows that they overlap the middle of
the
object, angle wise. So I think that might be why there is a step radially.

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


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

I am struggling to understand why it is so complicated. Why do you do the end bits separately and not just intersect some oversized wedges with rotate_extrude? On 9 January 2017 at 19:35, nophead <nop.head@gmail.com> wrote: > Adding a # to extrude_end_segments shows that they overlap the middle of > the > object, angle wise. So I think that might be why there is a step radially. > > > > -- > View this message in context: http://forum.openscad.org/ > Confused-as-how-a-this-could-happen-tp19958p19991.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
NH
nop head
Mon, Jan 9, 2017 9:19 PM

Something like this ?:

module pie_slice(r, start_angle, end_angle) {
R = r * sqrt(2) + 1;
a0 = (4 * start_angle + 0 * end_angle) / 4;
a1 = (3 * start_angle + 1 * end_angle) / 4;
a2 = (2 * start_angle + 2 * end_angle) / 4;
a3 = (1 * start_angle + 3 * end_angle) / 4;
a4 = (0 * start_angle + 4 * end_angle) / 4;
if(end_angle > start_angle)
intersection() {
circle(r);
polygon([
[0,0],
[R * cos(a0), R * sin(a0)],
[R * cos(a1), R * sin(a1)],
[R * cos(a2), R * sin(a2)],
[R * cos(a3), R * sin(a3)],
[R * cos(a4), R * sin(a4)],
]);
}
}

$fn = 32;

module rotate_extrude_angle(angle, radius, convexity)
intersection() {
rotate_extrude(convexity = convexity)
children();

    hull()
        linear_extrude(height = 1, convexity = convexity)
            pie_slice(radius, 0, angle);

}

rotate_extrude_angle(angle=45, radius=1, convexity=5)
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]]);
}

On 9 January 2017 at 20:58, nop head nop.head@gmail.com wrote:

I am struggling to understand why it is so complicated. Why do you do the
end bits separately and not just intersect some oversized wedges with
rotate_extrude?

On 9 January 2017 at 19:35, nophead nop.head@gmail.com wrote:

Adding a # to extrude_end_segments shows that they overlap the middle of
the
object, angle wise. So I think that might be why there is a step radially.

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


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

Something like this ?: module pie_slice(r, start_angle, end_angle) { R = r * sqrt(2) + 1; a0 = (4 * start_angle + 0 * end_angle) / 4; a1 = (3 * start_angle + 1 * end_angle) / 4; a2 = (2 * start_angle + 2 * end_angle) / 4; a3 = (1 * start_angle + 3 * end_angle) / 4; a4 = (0 * start_angle + 4 * end_angle) / 4; if(end_angle > start_angle) intersection() { circle(r); polygon([ [0,0], [R * cos(a0), R * sin(a0)], [R * cos(a1), R * sin(a1)], [R * cos(a2), R * sin(a2)], [R * cos(a3), R * sin(a3)], [R * cos(a4), R * sin(a4)], ]); } } $fn = 32; module rotate_extrude_angle(angle, radius, convexity) intersection() { rotate_extrude(convexity = convexity) children(); hull() linear_extrude(height = 1, convexity = convexity) pie_slice(radius, 0, angle); } rotate_extrude_angle(angle=45, radius=1, convexity=5) 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]]); } On 9 January 2017 at 20:58, nop head <nop.head@gmail.com> wrote: > I am struggling to understand why it is so complicated. Why do you do the > end bits separately and not just intersect some oversized wedges with > rotate_extrude? > > On 9 January 2017 at 19:35, nophead <nop.head@gmail.com> wrote: > >> Adding a # to extrude_end_segments shows that they overlap the middle of >> the >> object, angle wise. So I think that might be why there is a step radially. >> >> >> >> -- >> View this message in context: http://forum.openscad.org/Conf >> used-as-how-a-this-could-happen-tp19958p19991.html >> Sent from the OpenSCAD mailing list archive at Nabble.com. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > >