On 27 Apr 2019 at 22:21, nop head wrote:
> It isn't the notation it the fact that in maths you don't let x mean one thing and then on the next line > make it mean some else. Again reinforcing my happiness in using a program instead of math. > There are lots of programming languages where you > can't mutate variables. And yet they are still called variables. Fascinating. -- Magic trumps science for most people, and wishful thinking drives a lot of decision-making. - Joe Haldeman _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Yes they are still called variable because they can take any value at run time but can only be assigned once. See
https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html This is how I would code Adrian's problem, although I haven't needed such a construct myself yet. r_h = is_undef(a) ? let(h = F(b), r = G(h, b)) [r, h] : let(r = f(a), h = g(r, a)) [r, h]; r = r_h[0]; h = r_h[1]; Or a slightly more compact version but I think less readable: r_h = is_undef(a) ? let(h = F(b)) [G(h, b), h] : let(r = f(a)) [r, g(r, a)]; r = r_h[0]; h = r_h[1]; On Sun, 28 Apr 2019 at 06:09, <[hidden email]> wrote: On 27 Apr 2019 at 22:21, nop head wrote: _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
I noticed that (at least) two people felt like the coding problem I noted was
sufficiently interesting that they tried to implement it. There is no other language I know where this would even be an interesting problem---it would just be trivial. The fact that more than one person thought my coding problem was a sufficient challenge that it was worth doing I think demonstrates the issue with the language. But that's not why I'm posting. I'm posting because I finally completed my rounded_extrude module which made this possible: box = [[0,0], [0,50], [255,50], [255,0]]; rbox = roundcorners(box, curve="smooth", type="cut", all=4); difference(){ rounded_extrude(rbox, height=50, r1=2, r2=1, steps = 22, edge1="teardrop", self_intersection=false); translate([0,0,2]) rounded_extrude(pathoffset(rbox, r=-2, closed=true), height=48, r1=4, r2=-1,steps=22,extra2=1,self_intersection=false); } So I have a rounded box with a teardrop edge at the base, a rounded top edge, and a more rounded interior bottom edge. <http://forum.openscad.org/file/t2477/fbox1.png> -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
On 2019-05-03 11:58, adrianv wrote:
> So I have a rounded box with a teardrop edge at the base, a rounded top > edge, and a more rounded interior bottom edge. > > <http://forum.openscad.org/file/t2477/fbox1.png> That's very, very nice (and clever)! But what is a "teardrop edge" precisely? Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
I use an inverted truncated rotate_extruded teardrop on the bottom edges of my rounded objects so they don't need support when printing. I assume that is what a "teardrop edge" is. On Fri, 3 May 2019 at 12:05, <[hidden email]> wrote: On 2019-05-03 11:58, adrianv wrote: _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
I've been working through this sort of thing myself, and have been working up a series of basic modules which do rounded edged (and optionally bottomed) pockets so as to model projects for a hobby CNC. The problem of course is working up a reasonable definition of the shapes in terms of parameters --- I believe the field which covers this sort of thing is topology? Does anyone know of any good texts on this which might be approachable to a layman? William On Fri, May 3, 2019 at 7:11 AM nop head <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
I don't think topology is what you mean. For example a doughnut and a teacup with a handle are topologically the same. On Fri, 3 May 2019 at 14:54, William Adams <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Okay. Discussion of a list of two-dimensional shapes, mathematical/programmatic techniques for dividing shapes into regions, and the possible shapes which one can use in such deconstruction. Suggested text/terminology, esp. a book suited to a layman. Eventually the project may work up to 3 dimensional shapes, but for now, trying to limit it to stacks of two-dimensional shapes cut into a three-dimensional stock. William On Fri, May 3, 2019 at 10:43 AM nop head <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
I think the correct term is Constructional Solid Geometry https://en.wikipedia.org/wiki/Constructive_solid_geometry You might find books on that but they are probably more about theory than actually how to make specific shapes with it. On Fri, 3 May 2019 at 16:03, William Adams <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by William Adams-2
Yes, what I meant by "teardrop" is an edge which combines 45 degrees of a
circular arc with a bevel at 45 deg so that the edge can be 3d printed without support---with the bevel down there are no unsupported areas at lower than a 45 deg angle. William Adams-2 wrote > Okay. Discussion of a list of two-dimensional shapes, > mathematical/programmatic techniques for dividing shapes into regions, and > the possible shapes which one can use in such deconstruction. I really don't understand your question. When people talk of dividing 2d shapes into regions they usually mean triangulating the shape. But it sounds like you mean something else. Maybe you should give a specific example? -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by William Adams-2
Okay, a quick survey of an encyclopedia / dictionary yielded: * 0 ** circle ** oval/ellipse (requires some sort of non-arc curve) *** egg-shaped (requires some sort of non-arc curve) ** annulus (one circle within another forming a ring) ** superellipse (see astroid below) * 1 ** cone with rounded end (arc) * 2 ** semicircle/circular segment (arc and a straight line) ** lens/vesical piscis (two convex curves) ** lune/crescent (one convex one concave curve) ** heart (two curves) ** tomoe (comma shape) --- requires non arc curves * 3 ** triangle *** equilateral *** isosceles *** scalene ** sector (two straight edges, one convex arc) ** two straight edges, one concave arc ** Deltoid curve (three concave arcs) ** Reuleaux triangle (three convex arcs) ** Arbelos (one convex, two concave arcs) * 4 ** square ** rectangle ** parallelogram ** rhombus ** trapezoid/trapezium ** kite ** astroid (four concave arcs) ** salinon (four semicircles) any obvious corrections or additions? Other suggestions? William On Fri, May 3, 2019 at 11:03 AM William Adams <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by adrianv
I'm hoping to eventually work up a general algorithm for subdividing an arbitrary shape/area so that it can then be cut out using macros/modules which I'll be defining in OpenSCAD (so as to have a 3D preview of a project) and in some other programming languages as well (METAPOST seems possible, Javascript/TPL (Tool Path Language) another, Python, or LiveCode distant possibilities. Basically I want to be able to have rounded ends on the dividers in: instead of the sharp points. William On Fri, May 3, 2019 at 11:32 AM adrianv <[hidden email]> wrote: Yes, what I meant by "teardrop" is an edge which combines 45 degrees of a _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
I would make the shape by a cylinder and two linear extrudes stacked on top of each other. To round the divider I would use offset(r) offset(-2 * r) offset(r). That leaves the dimension the same but rounds both internal an external corners. On Fri, 3 May 2019 at 16:55, William Adams <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Thanks! I've got a module which I'm calling which checks for endmill shape and either puts a ball-nose on it or not (debating on adding support for V shapes as well). On Fri, May 3, 2019 at 12:08 PM nop head <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by adrianv
adrianv wrote
> I really don't understand your question. When people talk of dividing 2d > shapes into regions they usually mean triangulating the shape. But it > sounds like you mean something else. Maybe you should give a specific > example? For example, given a rectangular outline of a box, I might like to split that box into two compartments, and then I might want to further split one of those compartments into three compartments (but sliced in the opposite direction). I actually did write a module for doing this (for rectangular boxes and subdivisions). It needs dusting off, though. Ray -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
That's exactly what I've been working up --- I got rectangles done, now I'm starting in on circles, next will be regular polygons, then we'll see if we can do ovals and other shapes. William On Fri, May 3, 2019 at 12:20 PM RayBellis <[hidden email]> wrote: adrianv wrote _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
I spent a LOT of time writing code to do this, and triangulation of polygons. Dues to implementation issues I ended up implementing a convexifyPolygon function which turns an arbitrary non-self-intersecting polygon into a list of convex polygons, and a triangulariseConvexPolygon which triangulates the convex polygons. To implement those I needed various splitting and clipping functions On Fri, 3 May 2019, 12:50 William Adams, <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by William Adams-2
You just want to round the junctions? I think you can do that for an
arbitrary 2d shape using offset(), with something like this (which was previously mentioned many posts ago on this thread): module round2d(or, ir) { offset(or) offset(-ir-or) offset(delta=ir) children(); } As long as your walls aren't too thin relative to the curvature you want (which looks small in your examples) I think that the above will actually do the job of rounding any box you want to make. round2d(or=.4, ir=1){ difference(){ square([20,20],center=true); square([18,18],center=true); } translate([10,0,0]) difference(){ circle(d=20); circle(d=18); } } If you set or>-0.5 then you get in trouble because the walls vanish. But if you round the outside shape first (before cutting out the middle) you can resolve this problem. <http://forum.openscad.org/file/t2477/roundedthing.png> I'm not sure what you mean about the "algorithm for subdividing" part of your project, though. -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by William Adams-2
Can you be more specific about what you are trying to do? You want to divide
a circle up into compartments with circular arcs? I mean, it seems like the basic task of dividing a region into smaller regions with paths is mainly difficult due to the interface part of the problem: how do you specify what you want to create? William Adams-2 wrote > That's exactly what I've been working up --- I got rectangles done, now > I'm > starting in on circles, next will be regular polygons, then we'll see if > we > can do ovals and other shapes. > > William > > On Fri, May 3, 2019 at 12:20 PM RayBellis < > openscad@.me > > wrote: > >> adrianv wrote >> > I really don't understand your question. When people talk of dividing >> 2d >> > shapes into regions they usually mean triangulating the shape. But it >> > sounds like you mean something else. Maybe you should give a specific >> > example? >> >> For example, given a rectangular outline of a box, I might like to split >> that box into two compartments, and then I might want to further split >> one >> of those compartments into three compartments (but sliced in the opposite >> direction). >> >> I actually did write a module for doing this (for rectangular boxes and >> subdivisions). It needs dusting off, though. >> >> Ray >> >> >> >> -- >> Sent from: http://forum.openscad.org/ >> >> _______________________________________________ >> OpenSCAD mailing list >> > Discuss@.openscad >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Here's another example of a rounded box, this time with a more complex shape.
Note how the rounded edges of the tips vanish in the roundover at the bottom. (One of the challenges here is that the number of vertices is not the same in each layer.) <http://forum.openscad.org/file/t2477/fstarbox1.png> <http://forum.openscad.org/file/t2477/fstarbox2.png> -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Free forum by Nabble | Edit this page |