discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Confused as how a this could happen

RP
Ronaldo Persiano
Mon, Jan 9, 2017 9:39 PM

Simple solution indeed. And easier to understand. I guess the hull() is an
innocuous remaining of a previous version.

Simple solution indeed. And easier to understand. I guess the hull() is an innocuous remaining of a previous version.
CA
Carsten Arnholm
Mon, Jan 9, 2017 9:45 PM

On 09. jan. 2017 22:19, nop head wrote:

Something like this ?:

$fn=8*4;
rotate_extrude(angle=45)
union() {
square([.5,.75]);
polygon([[0,.75],[.65,.75],[0,1]]);
}

Carsten Arnholm

On 09. jan. 2017 22:19, nop head wrote: > Something like this ?: $fn=8*4; rotate_extrude(angle=45) union() { square([.5,.75]); polygon([[0,.75],[.65,.75],[0,1]]); } Carsten Arnholm
NH
nop head
Mon, Jan 9, 2017 11:31 PM

Yes but Adrian said he has a version before rotate_extrude takes an angle.

And easier to understand. I guess the hull() is an innocuous remaining of

a previous version.

Yes.

On 9 January 2017 at 21:45, Carsten Arnholm arnholm@arnholm.org wrote:

On 09. jan. 2017 22:19, nop head wrote:

Something like this ?:

$fn=8*4;
rotate_extrude(angle=45)
union() {
square([.5,.75]);
polygon([[0,.75],[.65,.75],[0,1]]);
}

Carsten Arnholm


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

Yes but Adrian said he has a version before rotate_extrude takes an angle. >And easier to understand. I guess the hull() is an innocuous remaining of a previous version. Yes. On 9 January 2017 at 21:45, Carsten Arnholm <arnholm@arnholm.org> wrote: > On 09. jan. 2017 22:19, nop head wrote: > >> Something like this ?: >> > > > $fn=8*4; > rotate_extrude(angle=45) > union() { > square([.5,.75]); > polygon([[0,.75],[.65,.75],[0,1]]); > } > > > Carsten Arnholm > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
NH
nop head
Tue, Jan 10, 2017 8:14 AM

If @adrian is worried out getting whole segments then why not use $fa,
while setting $fs to a very small number?

On 9 January 2017 at 23:31, nop head nop.head@gmail.com wrote:

Yes but Adrian said he has a version before rotate_extrude takes an angle.

And easier to understand. I guess the hull() is an innocuous remaining of

a previous version.

Yes.

On 9 January 2017 at 21:45, Carsten Arnholm arnholm@arnholm.org wrote:

On 09. jan. 2017 22:19, nop head wrote:

Something like this ?:

$fn=8*4;
rotate_extrude(angle=45)
union() {
square([.5,.75]);
polygon([[0,.75],[.65,.75],[0,1]]);
}

Carsten Arnholm


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

If @adrian is worried out getting whole segments then why not use $fa, while setting $fs to a very small number? On 9 January 2017 at 23:31, nop head <nop.head@gmail.com> wrote: > Yes but Adrian said he has a version before rotate_extrude takes an angle. > > >And easier to understand. I guess the hull() is an innocuous remaining of > a previous version. > > Yes. > > On 9 January 2017 at 21:45, Carsten Arnholm <arnholm@arnholm.org> wrote: > >> On 09. jan. 2017 22:19, nop head wrote: >> >>> Something like this ?: >>> >> >> >> $fn=8*4; >> rotate_extrude(angle=45) >> union() { >> square([.5,.75]); >> polygon([[0,.75],[.65,.75],[0,1]]); >> } >> >> >> Carsten Arnholm >> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > >
P
Parkinbot
Tue, Jan 10, 2017 10:58 AM

nophead,
You already calculated the new radius. With this pie_slice() doesn't need
more than the intersection of a circle with a triag. Also negative angles
may be allowed.

module pie_slice(r, start_angle, end_angle)
intersection() {
circle(r);
polygon((r * sqrt(2) + 1)*[ [0,0],[cos(start_angle),
sin(start_angle)], [cos(end_angle), sin(end_angle)]]);
}

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

nophead, You already calculated the new radius. With this pie_slice() doesn't need more than the intersection of a circle with a triag. Also negative angles may be allowed. > module pie_slice(r, start_angle, end_angle) > intersection() { > circle(r); > polygon((r * sqrt(2) + 1)*[ [0,0],[cos(start_angle), > sin(start_angle)], [cos(end_angle), sin(end_angle)]]); > } -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p19998.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Tue, Jan 10, 2017 1:18 PM

You cant get more than 180 degrees of a pie with a triangle intersection
and its radius would tend towards infinity. I think 4 triangles is the
least needed for an angle close to 360 without the radius getting very
large.

The version I presented works up to 360. I wrote it long before
rotate_extrude took an angle and before list comprehensions and offset.

On 10 January 2017 at 10:58, Parkinbot rudolf@parkinbot.com wrote:

nophead,
You already calculated the new radius. With this pie_slice() doesn't need
more than the intersection of a circle with a triag. Also negative angles
may be allowed.

module pie_slice(r, start_angle, end_angle)
intersection() {
circle(r);
polygon((r * sqrt(2) + 1)*[ [0,0],[cos(start_angle),
sin(start_angle)], [cos(end_angle), sin(end_angle)]]);
}

--
View this message in context: http://forum.openscad.org/
Confused-as-how-a-this-could-happen-tp19958p19998.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

You cant get more than 180 degrees of a pie with a triangle intersection and its radius would tend towards infinity. I think 4 triangles is the least needed for an angle close to 360 without the radius getting very large. The version I presented works up to 360. I wrote it long before rotate_extrude took an angle and before list comprehensions and offset. On 10 January 2017 at 10:58, Parkinbot <rudolf@parkinbot.com> wrote: > nophead, > You already calculated the new radius. With this pie_slice() doesn't need > more than the intersection of a circle with a triag. Also negative angles > may be allowed. > > > > module pie_slice(r, start_angle, end_angle) > > intersection() { > > circle(r); > > polygon((r * sqrt(2) + 1)*[ [0,0],[cos(start_angle), > > sin(start_angle)], [cos(end_angle), sin(end_angle)]]); > > } > > > > > > -- > View this message in context: http://forum.openscad.org/ > Confused-as-how-a-this-could-happen-tp19958p19998.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 >
IN
Ian Nichols
Tue, Jan 10, 2017 1:59 PM

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

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)],
]);
}
}

That looks like a similar approach to something I did to make short arcs of
tube.  It boils down to making a torus by rotate_extruding a circle,
subtracting a thinner torus to make a hollow one then intersecting with the
output of this module, which produces an 8-sided wedge (which becomes a
hexagon when ang=360) by linear_extruding a polygon.

module wedge (thickness, rad, ang)

translate ([0,0,-(thickness/2)-1]) {

linear_extrude (height = thickness+2) {

polygon(points=[

[radcos(ang/2),-radsin(ang/2)],

[0,0],

[radcos(ang/2),radsin(ang/2)],

[radcos(ang/3),radsin(ang/3)],

[radcos(ang/6),radsin(ang/6)],

[rad,0],

[radcos(ang/6),-radsin(ang/6)],

[radcos(ang/3),-radsin(ang/3)]],

paths=[[0,1,2,3,4,5,6,7]]);}

}

Just remember to make rad big enough that the wedge will totally enclose
the object to be rotate_extruded.

Ian

--
Stand firm for what you believe in, until and unless logic and experience
prove you wrong.  Remember: when the emperor looks naked, the emperor is
naked, the truth and a lie are not "sort-of the same thing" and there is
no aspect, no facet, no moment of life that can't be improved with pizza.

-Daria Morgendorffer

On 9 January 2017 at 21:19, nop head <nop.head@gmail.com> wrote: > 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)], > ]); > } > } > That looks like a similar approach to something I did to make short arcs of tube. It boils down to making a torus by rotate_extruding a circle, subtracting a thinner torus to make a hollow one then intersecting with the output of this module, which produces an 8-sided wedge (which becomes a hexagon when ang=360) by linear_extruding a polygon. module wedge (thickness, rad, ang) translate ([0,0,-(thickness/2)-1]) { linear_extrude (height = thickness+2) { polygon(points=[ [rad*cos(ang/2),-rad*sin(ang/2)], [0,0], [rad*cos(ang/2),rad*sin(ang/2)], [rad*cos(ang/3),rad*sin(ang/3)], [rad*cos(ang/6),rad*sin(ang/6)], [rad,0], [rad*cos(ang/6),-rad*sin(ang/6)], [rad*cos(ang/3),-rad*sin(ang/3)]], paths=[[0,1,2,3,4,5,6,7]]);} } Just remember to make rad big enough that the wedge will totally enclose the object to be rotate_extruded. Ian -- Stand firm for what you believe in, until and unless logic and experience prove you wrong. Remember: when the emperor looks naked, the emperor *is* naked, the truth and a lie are not "sort-of the same thing" and there is no aspect, no facet, no moment of life that can't be improved with pizza. -Daria Morgendorffer
NH
nop head
Tue, Jan 10, 2017 2:07 PM

Yes but since rotate extrude now takes an angle these workarounds are just
an exercise.

On 10 January 2017 at 13:59, Ian Nichols ian.a.nichols@gmail.com wrote:

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

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)],
]);
}
}

That looks like a similar approach to something I did to make short arcs
of tube.  It boils down to making a torus by rotate_extruding a circle,
subtracting a thinner torus to make a hollow one then intersecting with the
output of this module, which produces an 8-sided wedge (which becomes a
hexagon when ang=360) by linear_extruding a polygon.

module wedge (thickness, rad, ang)

translate ([0,0,-(thickness/2)-1]) {

linear_extrude (height = thickness+2) {

polygon(points=[

[radcos(ang/2),-radsin(ang/2)],

[0,0],

[radcos(ang/2),radsin(ang/2)],

[radcos(ang/3),radsin(ang/3)],

[radcos(ang/6),radsin(ang/6)],

[rad,0],

[radcos(ang/6),-radsin(ang/6)],

[radcos(ang/3),-radsin(ang/3)]],

paths=[[0,1,2,3,4,5,6,7]]);}

}

Just remember to make rad big enough that the wedge will totally enclose
the object to be rotate_extruded.

Ian

--
Stand firm for what you believe in, until and unless logic and experience
prove you wrong.  Remember: when the emperor looks naked, the emperor is
naked, the truth and a lie are not "sort-of the same thing" and there is
no aspect, no facet, no moment of life that can't be improved with pizza.

-Daria Morgendorffer


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

Yes but since rotate extrude now takes an angle these workarounds are just an exercise. On 10 January 2017 at 13:59, Ian Nichols <ian.a.nichols@gmail.com> wrote: > > On 9 January 2017 at 21:19, nop head <nop.head@gmail.com> wrote: > >> 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)], >> ]); >> } >> } >> > > That looks like a similar approach to something I did to make short arcs > of tube. It boils down to making a torus by rotate_extruding a circle, > subtracting a thinner torus to make a hollow one then intersecting with the > output of this module, which produces an 8-sided wedge (which becomes a > hexagon when ang=360) by linear_extruding a polygon. > > > module wedge (thickness, rad, ang) > > translate ([0,0,-(thickness/2)-1]) { > > linear_extrude (height = thickness+2) { > > polygon(points=[ > > [rad*cos(ang/2),-rad*sin(ang/2)], > > [0,0], > > [rad*cos(ang/2),rad*sin(ang/2)], > > [rad*cos(ang/3),rad*sin(ang/3)], > > [rad*cos(ang/6),rad*sin(ang/6)], > > [rad,0], > > [rad*cos(ang/6),-rad*sin(ang/6)], > > [rad*cos(ang/3),-rad*sin(ang/3)]], > > paths=[[0,1,2,3,4,5,6,7]]);} > > } > > Just remember to make rad big enough that the wedge will totally enclose > the object to be rotate_extruded. > > Ian > > > -- > Stand firm for what you believe in, until and unless logic and experience > prove you wrong. Remember: when the emperor looks naked, the emperor *is* > naked, the truth and a lie are not "sort-of the same thing" and there is > no aspect, no facet, no moment of life that can't be improved with pizza. > > -Daria Morgendorffer > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
P
Parkinbot
Tue, Jan 10, 2017 2:51 PM

Sorry, of course you are right ...

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

Sorry, of course you are right ... -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p20003.html Sent from the OpenSCAD mailing list archive at Nabble.com.
A
adrian
Tue, Jan 10, 2017 6:26 PM

Hi @nophead,

I'll have to take a look at your solution later to see what you've done.
However, I have discovered the reason for the issue I was having.  The wedge
extrude when centred around the xy plane, was too big.The problem was that
the ends were not scaled on the x-axis properly to make the end faces fit.
Here is my solution (I updated the module comment to show how width is
calculated and added a comment in module where the change was made):

This will make the pieces fit perfectly.

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

Hi @nophead, I'll have to take a look at your solution later to see what you've done. However, I have discovered the reason for the issue I was having. The wedge extrude when centred around the xy plane, was too big.The problem was that the ends were not scaled on the x-axis properly to make the end faces fit. Here is my solution (I updated the module comment to show how width is calculated and added a comment in module where the change was made): This will make the pieces fit perfectly. -- View this message in context: http://forum.openscad.org/Confused-as-how-a-this-could-happen-tp19958p20004.html Sent from the OpenSCAD mailing list archive at Nabble.com.