discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Morphing irregular shape while extruding?

T
Terry
Thu, Jan 19, 2023 3:53 PM

Haven't done any printing for ages, and more than a bit rusty, so...

I have a garden 'blower' that I want to improvise for an unusual
purpose. I need to print a PLA add-on I can temporarily push inside its
open end. That end of the part must obviously roughly match the blower
tube's shape. Although not an OpenSCAD issue, any tips on the best way
to capture that closed curve would be welcome. The best two
I've come up with so far:

  1. Wrap some stiff wire tightly around the blower near its end. Or
    perhaps better, a long but thin strip of aluminium; slide that off and
    make an SVG.in Inkscape (when I've relearnt how to do that).

  2. Use the rough pencil trace I've made as the SVG basis. Then in
    OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor
    would be b/h estimated from the photo.

Precision won't be an issue as I'll glue some thin but flexible stuff to
the outside.

The more difficult aspect is that the other end of the print must be a
cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner
diameter. (I'll be attaching a hose or similar.) This would obviously be
trivial if the starting shape was circular, but what is the general
approach for extruding from an irregular shape to a circle?


While preparing this a simpler idea dawned, and it would take a fraction
of the time to prepare. A rectangular piece of plywood or similar
covering the entire end of the blower, secured by screws or velcro to
the adjacent plastic area. The 3d print (if an existing piece of tubing
cannot be found) would be a simple cylinder, friction fitted inside a
hole in the wood's centre.

But I'd still like to learn how to 'morph' from one 2D shape to another
please.

Image attached, or here:
https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1

Terry, UK

Haven't done any printing for ages, and more than a bit rusty, so... I have a garden 'blower' that I want to improvise for an unusual purpose. I need to print a PLA add-on I can temporarily push inside its open end. That end of the part must obviously roughly match the blower tube's shape. Although not an OpenSCAD issue, any tips on the best way to capture that closed curve would be welcome. The best two I've come up with so far: 1. Wrap some stiff wire tightly around the blower near its end. Or perhaps better, a long but thin strip of aluminium; slide that off and make an SVG.in Inkscape (when I've relearnt how to do that). 2. Use the rough pencil trace I've made as the SVG basis. Then in OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor would be b/h estimated from the photo. Precision won't be an issue as I'll glue some thin but flexible stuff to the outside. The more difficult aspect is that the other end of the print must be a cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner diameter. (I'll be attaching a hose or similar.) This would obviously be trivial if the starting shape was circular, but what is the general approach for extruding from an irregular shape to a circle? -------------------- While preparing this a simpler idea dawned, and it would take a fraction of the time to prepare. A rectangular piece of plywood or similar covering the entire end of the blower, secured by screws or velcro to the adjacent plastic area. The 3d print (if an existing piece of tubing cannot be found) would be a simple cylinder, friction fitted inside a hole in the wood's centre. But I'd still like to learn how to 'morph' from one 2D shape to another please. Image attached, or here: https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1 Terry, UK
F
fred
Thu, Jan 19, 2023 4:06 PM

I'm not going to say this is THE answer, but it might still work as desired. Your SVG tracing can be imported and extruded to a minimal height. A circle of the appropriate dimensions also created to a minimal height, then translated to the desired distance.
Hull() the pair twice, rescale the x/y for the second hull(), then difference them.
This idea stems from a web search for "OpenSCAD loft" which presented an Instructable that didn't really help, but twisted the alleged mind in this direction.

On Thursday, January 19, 2023 at 10:55:30 AM EST, Terry <terrypingm@gmail.com> wrote:  

Haven't done any printing for ages, and more than a bit rusty, so...

I have a garden 'blower' that I want to improvise for an unusual
purpose. I need to print a PLA add-on I can temporarily push inside its
open end. That end of the part must obviously roughly match the blower
tube's shape. Although not an OpenSCAD issue, any tips on the best way
to capture that closed curve would be welcome. The best two
I've come up with so far:

  1. Wrap some stiff wire tightly around the blower near its end. Or
    perhaps better, a long but thin strip of aluminium; slide that off and
    make an SVG.in Inkscape (when I've relearnt how to do that).

  2. Use the rough pencil trace I've made as the SVG basis. Then in
    OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor
    would be b/h estimated from the photo.

Precision won't be an issue as I'll glue some thin but flexible stuff to
the outside.

The more difficult aspect is that the other end of the print must be a
cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner
diameter. (I'll be attaching a hose or similar.) This would obviously be
trivial if the starting shape was circular, but what is the general
approach for extruding from an irregular shape to a circle?


While preparing this a simpler idea dawned, and it would take a fraction
of the time to prepare. A rectangular piece of plywood or similar
covering the entire end of the blower, secured by screws or velcro to
the adjacent plastic area. The 3d print (if an existing piece of tubing
cannot be found) would be a simple cylinder, friction fitted inside a
hole in the wood's centre.

But I'd still like to learn how to 'morph' from one 2D shape to another
please.

Image attached, or here:
https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1

Terry, UK


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I'm not going to say this is THE answer, but it might still work as desired. Your SVG tracing can be imported and extruded to a minimal height. A circle of the appropriate dimensions also created to a minimal height, then translated to the desired distance. Hull() the pair twice, rescale the x/y for the second hull(), then difference them. This idea stems from a web search for "OpenSCAD loft" which presented an Instructable that didn't really help, but twisted the alleged mind in this direction. On Thursday, January 19, 2023 at 10:55:30 AM EST, Terry <terrypingm@gmail.com> wrote: Haven't done any printing for ages, and more than a bit rusty, so... I have a garden 'blower' that I want to improvise for an unusual purpose. I need to print a PLA add-on I can temporarily push inside its open end. That end of the part must obviously roughly match the blower tube's shape. Although not an OpenSCAD issue, any tips on the best way to capture that closed curve would be welcome. The best two I've come up with so far: 1. Wrap some stiff wire tightly around the blower near its end. Or perhaps better, a long but thin strip of aluminium; slide that off and make an SVG.in Inkscape (when I've relearnt how to do that). 2. Use the rough pencil trace I've made as the SVG basis. Then in OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor would be b/h estimated from the photo. Precision won't be an issue as I'll glue some thin but flexible stuff to the outside. The more difficult aspect is that the other end of the print must be a cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner diameter. (I'll be attaching a hose or similar.) This would obviously be trivial if the starting shape was circular, but what is the general approach for extruding from an irregular shape to a circle? -------------------- While preparing this a simpler idea dawned, and it would take a fraction of the time to prepare. A rectangular piece of plywood or similar covering the entire end of the blower, secured by screws or velcro to the adjacent plastic area. The 3d print (if an existing piece of tubing cannot be found) would be a simple cylinder, friction fitted inside a hole in the wood's centre. But I'd still like to learn how to 'morph' from one 2D shape to another please. Image attached, or here: https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1 Terry, UK _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org
RW
Rogier Wolff
Fri, Jan 20, 2023 12:02 PM

Hi,

I think we should generalize the "linear_extrude" module. Split it
into two parts.

For now it creates a surface between a bunch of 2D objects placed at
different heights. Currently it can do two (or more?) transformations
to the given 2D object at each height.

the first is
rotate (cur_height/total_height * rotation_angle)

and the second is a scale. Maybe there are more.

But somewhere down there there is now a "children ()".

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

That'd make say extruding a pipe with a spline function as the
diameter way more elegant than calculating the points by hand and
calling polyhedron at the end.

Roger. 

On Thu, Jan 19, 2023 at 03:53:59PM +0000, Terry wrote:

Haven't done any printing for ages, and more than a bit rusty, so...

I have a garden 'blower' that I want to improvise for an unusual
purpose. I need to print a PLA add-on I can temporarily push inside its
open end. That end of the part must obviously roughly match the blower
tube's shape. Although not an OpenSCAD issue, any tips on the best way
to capture that closed curve would be welcome. The best two
I've come up with so far:

  1. Wrap some stiff wire tightly around the blower near its end. Or
    perhaps better, a long but thin strip of aluminium; slide that off and
    make an SVG.in Inkscape (when I've relearnt how to do that).

  2. Use the rough pencil trace I've made as the SVG basis. Then in
    OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor
    would be b/h estimated from the photo.

Precision won't be an issue as I'll glue some thin but flexible stuff to
the outside.

The more difficult aspect is that the other end of the print must be a
cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner
diameter. (I'll be attaching a hose or similar.) This would obviously be
trivial if the starting shape was circular, but what is the general
approach for extruding from an irregular shape to a circle?


While preparing this a simpler idea dawned, and it would take a fraction
of the time to prepare. A rectangular piece of plywood or similar
covering the entire end of the blower, secured by screws or velcro to
the adjacent plastic area. The 3d print (if an existing piece of tubing
cannot be found) would be a simple cylinder, friction fitted inside a
hole in the wood's centre.

But I'd still like to learn how to 'morph' from one 2D shape to another
please.

Image attached, or here:
https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1

Terry, UK


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

Hi, I think we should generalize the "linear_extrude" module. Split it into two parts. For now it creates a surface between a bunch of 2D objects placed at different heights. Currently it can do two (or more?) transformations to the given 2D object at each height. the first is rotate (cur_height/total_height * rotation_angle) and the second is a scale. Maybe there are more. But somewhere down there there is now a "children ()". If instead we'd pass a extrude_position=... parameter to the to be instantiated children, those modules can do other (more generic) morphing than just rotate and scale. That'd make say extruding a pipe with a spline function as the diameter way more elegant than calculating the points by hand and calling polyhedron at the end. Roger. On Thu, Jan 19, 2023 at 03:53:59PM +0000, Terry wrote: > Haven't done any printing for ages, and more than a bit rusty, so... > > I have a garden 'blower' that I want to improvise for an unusual > purpose. I need to print a PLA add-on I can temporarily push inside its > open end. That end of the part must obviously roughly match the blower > tube's shape. Although not an OpenSCAD issue, any tips on the best way > to capture that closed curve would be welcome. The best two > I've come up with so far: > > 1. Wrap some stiff wire tightly around the blower near its end. Or > perhaps better, a long but thin strip of aluminium; slide that off and > make an SVG.in Inkscape (when I've relearnt how to do that). > > 2. Use the rough pencil trace I've made as the SVG basis. Then in > OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor > would be b/h estimated from the photo. > > Precision won't be an issue as I'll glue some thin but flexible stuff to > the outside. > > The more difficult aspect is that the other end of the print must be a > cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner > diameter. (I'll be attaching a hose or similar.) This would obviously be > trivial if the starting shape was circular, but what is the general > approach for extruding from an irregular shape to a circle? > > -------------------- > > While preparing this a simpler idea dawned, and it would take a fraction > of the time to prepare. A rectangular piece of plywood or similar > covering the entire end of the blower, secured by screws or velcro to > the adjacent plastic area. The 3d print (if an existing piece of tubing > cannot be found) would be a simple cylinder, friction fitted inside a > hole in the wood's centre. > > But I'd still like to learn how to 'morph' from one 2D shape to another > please. > > Image attached, or here: > https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1 > > Terry, UK > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.
SL
Steve Lelievre
Fri, Jan 20, 2023 4:41 PM

Terry,

I had another thought - simplistic but I think it should be enough for
your needs:

Make a solid object by importing your SVG and using linear_extrude to
convert it into a cone (by setting the scale parameter to 0). Add a
cylinder to match the required inside radius of your hose end and tall
enough to protrude by the distance you need. Add a straight-sided
linear_extruded section at the bottom to make a connector for your
blower end.

Repeat to make a second object, but this time offset the SVG to make it
a bit bigger and also widen the cylinder to the required outer radius.

Take the difference of the two objects, second minus first, to produce a
hollow funnel.

The following sample code does the job. You might have to alter the
bottom outline depending on whether you want your blower to fit inside
or outside the funnel, and for the specific dimensions and connector
lengths you need (and of course, if the exact wall thickness is
important you would have to use minkowski  to form the outer shape.)

file = "footprint.svg";
$fn = 60;
difference() {
   union() {
      linear_extrude(100, scale = 0) offset(2) import(file);
      cylinder(100, r = 15 + 2);
      translate([0, 0, -10]) linear_extrude(10) offset(2) import(file);
   }
   union() {
      linear_extrude(100, scale = 0) import(file);
      cylinder(100, r = 15);
      translate([0, 0, -10])linear_extrude(10) import(file);
   }
}

And here's a screenshot using an arbitrary footprint.

Cheers,

Steve

On 2023-01-19 7:53 a.m., Terry wrote:

Haven't done any printing for ages, and more than a bit rusty, so...

I have a garden 'blower' that I want to improvise for an unusual
purpose. I need to print a PLA add-on I can temporarily push inside its
open end. That end of the part must obviously roughly match the blower
tube's shape. Although not an OpenSCAD issue, any tips on the best way
to capture that closed curve would be welcome. The best two
I've come up with so far:

  1. Wrap some stiff wire tightly around the blower near its end. Or
    perhaps better, a long but thin strip of aluminium; slide that off and
    make an SVG.in Inkscape (when I've relearnt how to do that).

  2. Use the rough pencil trace I've made as the SVG basis. Then in
    OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor
    would be b/h estimated from the photo.

Precision won't be an issue as I'll glue some thin but flexible stuff to
the outside.

The more difficult aspect is that the other end of the print must be a
cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner
diameter. (I'll be attaching a hose or similar.) This would obviously be
trivial if the starting shape was circular, but what is the general
approach for extruding from an irregular shape to a circle?


While preparing this a simpler idea dawned, and it would take a fraction
of the time to prepare. A rectangular piece of plywood or similar
covering the entire end of the blower, secured by screws or velcro to
the adjacent plastic area. The 3d print (if an existing piece of tubing
cannot be found) would be a simple cylinder, friction fitted inside a
hole in the wood's centre.

But I'd still like to learn how to 'morph' from one 2D shape to another
please.

Image attached, or here:
https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1

Terry, UK


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

Terry, I had another thought - simplistic but I think it should be enough for your needs: Make a solid object by importing your SVG and using linear_extrude to convert it into a cone (by setting the scale parameter to 0). Add a cylinder to match the required inside radius of your hose end and tall enough to protrude by the distance you need. Add a straight-sided linear_extruded section at the bottom to make a connector for your blower end. Repeat to make a second object, but this time offset the SVG to make it a bit bigger and also widen the cylinder to the required outer radius. Take the difference of the two objects, second minus first, to produce a hollow funnel. The following sample code does the job. You might have to alter the bottom outline depending on whether you want your blower to fit inside or outside the funnel, and for the specific dimensions and connector lengths you need (and of course, if the exact wall thickness is important you would have to use minkowski  to form the outer shape.) > file = "footprint.svg"; > $fn = 60; > difference() { >    union() { >       linear_extrude(100, scale = 0) offset(2) import(file); >       cylinder(100, r = 15 + 2); >       translate([0, 0, -10]) linear_extrude(10) offset(2) import(file); >    } >    union() { >       linear_extrude(100, scale = 0) import(file); >       cylinder(100, r = 15); >       translate([0, 0, -10])linear_extrude(10) import(file); >    } > } And here's a screenshot using an arbitrary footprint. Cheers, Steve On 2023-01-19 7:53 a.m., Terry wrote: > Haven't done any printing for ages, and more than a bit rusty, so... > > I have a garden 'blower' that I want to improvise for an unusual > purpose. I need to print a PLA add-on I can temporarily push inside its > open end. That end of the part must obviously roughly match the blower > tube's shape. Although not an OpenSCAD issue, any tips on the best way > to capture that closed curve would be welcome. The best two > I've come up with so far: > > 1. Wrap some stiff wire tightly around the blower near its end. Or > perhaps better, a long but thin strip of aluminium; slide that off and > make an SVG.in Inkscape (when I've relearnt how to do that). > > 2. Use the rough pencil trace I've made as the SVG basis. Then in > OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor > would be b/h estimated from the photo. > > Precision won't be an issue as I'll glue some thin but flexible stuff to > the outside. > > The more difficult aspect is that the other end of the print must be a > cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner > diameter. (I'll be attaching a hose or similar.) This would obviously be > trivial if the starting shape was circular, but what is the general > approach for extruding from an irregular shape to a circle? > > -------------------- > > While preparing this a simpler idea dawned, and it would take a fraction > of the time to prepare. A rectangular piece of plywood or similar > covering the entire end of the blower, secured by screws or velcro to > the adjacent plastic area. The 3d print (if an existing piece of tubing > cannot be found) would be a simple cylinder, friction fitted inside a > hole in the wood's centre. > > But I'd still like to learn how to 'morph' from one 2D shape to another > please. > > Image attached, or here: > https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1 > > Terry, UK > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
T
terrypingm@gmail.com
Fri, Jan 20, 2023 6:28 PM

Thanks Steve. But why the hollow ‘wedge’ extension? Without that, it looks like my original intention. Which was already somewhat OTT on reflection.

Anyway, learning exercise apart, for a task that will be rarely used I’m pretty sure I’ll go with the previously discussed crude approach!

--

Terry

On 20 Jan 2023, at 16:42, Steve Lelievre <steve.lelievre.canada@gmail.com> wrote:

 Terry,

I had another thought - simplistic but I think it should be enough for your needs:

Make a solid object by importing your SVG and using linear_extrude to convert it into a cone (by setting the scale parameter to 0). Add a cylinder to match the required inside radius of your hose end and tall enough to protrude by the distance you need. Add a straight-sided linear_extruded section at the bottom to make a connector for your blower end.

Repeat to make a second object, but this time offset the SVG to make it a bit bigger and also widen the cylinder to the required outer radius.

Take the difference of the two objects, second minus first, to produce a hollow funnel.

The following sample code does the job. You might have to alter the bottom outline depending on whether you want your blower to fit inside or outside the funnel, and for the specific dimensions and connector lengths you need (and of course, if the exact wall thickness is important you would have to use minkowski to form the outer shape.)

file = "footprint.svg";
$fn = 60;
difference() {
union() {
linear_extrude(100, scale = 0) offset(2) import(file);
cylinder(100, r = 15 + 2);
translate([0, 0, -10]) linear_extrude(10) offset(2) import(file);
}
union() {
linear_extrude(100, scale = 0) import(file);
cylinder(100, r = 15);
translate([0, 0, -10])linear_extrude(10) import(file);
}
}

And here's a screenshot using an arbitrary footprint.

<00AwiOdUczn1Et7F.png>

Cheers,

Steve

On 2023-01-19 7:53 a.m., Terry wrote:

<pre class="moz-quote-pre" wrap="">Haven't done any printing for ages, and more than a bit rusty, so...

I have a garden 'blower' that I want to improvise for an unusual
purpose. I need to print a PLA add-on I can temporarily push inside its
open end. That end of the part must obviously roughly match the blower
tube's shape. Although not an OpenSCAD issue, any tips on the best way
to capture that closed curve would be welcome. The best two
I've come up with so far:

1. Wrap some stiff wire tightly around the blower near its end. Or
perhaps better, a long but thin strip of aluminium; slide that off and
make an SVG.in Inkscape (when I've relearnt how to do that).

2. Use the rough pencil trace I've made as the SVG basis. Then in
OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor
would be b/h estimated from the photo. 

Precision won't be an issue as I'll glue some thin but flexible stuff to
the outside.

The more difficult aspect is that the other end of the print must be a
cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner
diameter. (I'll be attaching a hose or similar.) This would obviously be
trivial if the starting shape was circular, but what is the general
approach for extruding from an irregular shape to a circle?

--------------------

While preparing this a simpler idea dawned, and it would take a fraction
of the time to prepare. A rectangular piece of plywood or similar
covering the entire end of the blower, secured by screws or velcro to
the adjacent plastic area. The 3d print (if an existing piece of tubing
cannot be found) would be a simple cylinder, friction fitted inside a
hole in the wood's centre.

But I'd still like to learn how to 'morph' from one 2D shape to another
please.

Image attached, or here:
<a class="moz-txt-link-freetext" href="https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1">https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1</a>

Terry, UK
<pre class="moz-quote-pre" wrap="">_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to <a class="moz-txt-link-abbreviated" href="mailto:discuss-leave@lists.openscad.org">discuss-leave@lists.openscad.org</a>

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

SL
Steve Lelievre
Fri, Jan 20, 2023 6:33 PM

On 2023-01-20 10:28 a.m., terrypingm@gmail.com wrote:

Thanks Steve. But why the hollow ‘wedge’ extension? Without that, it
looks like my original intention.

It just means l wasn't quite clear about the shape you wanted.

Steve

On 2023-01-20 10:28 a.m., terrypingm@gmail.com wrote: > Thanks Steve. But why the hollow ‘wedge’ extension? Without that, it > looks like my original intention. It just means l wasn't quite clear about the shape you wanted. Steve
JB
Jordan Brown
Fri, Jan 20, 2023 9:07 PM

On 1/20/2023 4:02 AM, Rogier Wolff wrote:

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

I believe the current linear extrude takes advantage of the fact that
each successive layer has the same vertices, and connects them. 
Connecting two arbitrary 2D shapes is a much harder problem.

I believe some of the libraries (like BOSL2) have more general sweep
functions that can tolerate changes in the shape, but I don't know what
the limitations are.

On 1/20/2023 4:02 AM, Rogier Wolff wrote: > If instead we'd pass a extrude_position=... parameter to the to be > instantiated children, those modules can do other (more generic) > morphing than just rotate and scale. I believe the current linear extrude takes advantage of the fact that each successive layer has the same vertices, and connects them.  Connecting two arbitrary 2D shapes is a much harder problem. I believe some of the libraries (like BOSL2) have more general sweep functions that can tolerate changes in the shape, but I don't know what the limitations are.
AM
Adrian Mariano
Fri, Jan 20, 2023 10:25 PM

Rogier, it sounds like you're asking for something like the sweep() module
that has been implemented in various libraries, going back to the original
list-comprehension-demos library.  But still not available directly in
OpenSCAD.

On Fri, Jan 20, 2023 at 7:03 AM Rogier Wolff R.E.Wolff@bitwizard.nl wrote:

Hi,

I think we should generalize the "linear_extrude" module. Split it
into two parts.

For now it creates a surface between a bunch of 2D objects placed at
different heights. Currently it can do two (or more?) transformations
to the given 2D object at each height.

the first is
rotate (cur_height/total_height * rotation_angle)

and the second is a scale. Maybe there are more.

But somewhere down there there is now a "children ()".

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

That'd make say extruding a pipe with a spline function as the
diameter way more elegant than calculating the points by hand and
calling polyhedron at the end.

     Roger.

On Thu, Jan 19, 2023 at 03:53:59PM +0000, Terry wrote:

Haven't done any printing for ages, and more than a bit rusty, so...

I have a garden 'blower' that I want to improvise for an unusual
purpose. I need to print a PLA add-on I can temporarily push inside its
open end. That end of the part must obviously roughly match the blower
tube's shape. Although not an OpenSCAD issue, any tips on the best way
to capture that closed curve would be welcome. The best two
I've come up with so far:

  1. Wrap some stiff wire tightly around the blower near its end. Or
    perhaps better, a long but thin strip of aluminium; slide that off and
    make an SVG.in Inkscape (when I've relearnt how to do that).

  2. Use the rough pencil trace I've made as the SVG basis. Then in
    OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor
    would be b/h estimated from the photo.

Precision won't be an issue as I'll glue some thin but flexible stuff to
the outside.

The more difficult aspect is that the other end of the print must be a
cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner
diameter. (I'll be attaching a hose or similar.) This would obviously be
trivial if the starting shape was circular, but what is the general
approach for extruding from an irregular shape to a circle?


While preparing this a simpler idea dawned, and it would take a fraction
of the time to prepare. A rectangular piece of plywood or similar
covering the entire end of the blower, secured by screws or velcro to
the adjacent plastic area. The 3d print (if an existing piece of tubing
cannot be found) would be a simple cylinder, friction fitted inside a
hole in the wood's centre.

But I'd still like to learn how to 'morph' from one 2D shape to another
please.

Image attached, or here:
https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1

Terry, UK


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
**
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Rogier, it sounds like you're asking for something like the sweep() module that has been implemented in various libraries, going back to the original list-comprehension-demos library. But still not available directly in OpenSCAD. On Fri, Jan 20, 2023 at 7:03 AM Rogier Wolff <R.E.Wolff@bitwizard.nl> wrote: > Hi, > > I think we should generalize the "linear_extrude" module. Split it > into two parts. > > For now it creates a surface between a bunch of 2D objects placed at > different heights. Currently it can do two (or more?) transformations > to the given 2D object at each height. > > the first is > rotate (cur_height/total_height * rotation_angle) > > and the second is a scale. Maybe there are more. > > But somewhere down there there is now a "children ()". > > If instead we'd pass a extrude_position=... parameter to the to be > instantiated children, those modules can do other (more generic) > morphing than just rotate and scale. > > That'd make say extruding a pipe with a spline function as the > diameter way more elegant than calculating the points by hand and > calling polyhedron at the end. > > Roger. > > > > On Thu, Jan 19, 2023 at 03:53:59PM +0000, Terry wrote: > > Haven't done any printing for ages, and more than a bit rusty, so... > > > > I have a garden 'blower' that I want to improvise for an unusual > > purpose. I need to print a PLA add-on I can temporarily push inside its > > open end. That end of the part must obviously roughly match the blower > > tube's shape. Although not an OpenSCAD issue, any tips on the best way > > to capture that closed curve would be welcome. The best two > > I've come up with so far: > > > > 1. Wrap some stiff wire tightly around the blower near its end. Or > > perhaps better, a long but thin strip of aluminium; slide that off and > > make an SVG.in Inkscape (when I've relearnt how to do that). > > > > 2. Use the rough pencil trace I've made as the SVG basis. Then in > > OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor > > would be b/h estimated from the photo. > > > > Precision won't be an issue as I'll glue some thin but flexible stuff to > > the outside. > > > > The more difficult aspect is that the other end of the print must be a > > cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner > > diameter. (I'll be attaching a hose or similar.) This would obviously be > > trivial if the starting shape was circular, but what is the general > > approach for extruding from an irregular shape to a circle? > > > > -------------------- > > > > While preparing this a simpler idea dawned, and it would take a fraction > > of the time to prepare. A rectangular piece of plywood or similar > > covering the entire end of the blower, secured by screws or velcro to > > the adjacent plastic area. The 3d print (if an existing piece of tubing > > cannot be found) would be a simple cylinder, friction fitted inside a > > hole in the wood's centre. > > > > But I'd still like to learn how to 'morph' from one 2D shape to another > > please. > > > > Image attached, or here: > > https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1 > > > > Terry, UK > > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > -- > ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 > ** > ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** > f equals m times a. When your f is steady, and your m is going down > your a is going up. -- Chris Hadfield about flying up the space shuttle. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
AM
Adrian Mariano
Fri, Jan 20, 2023 10:35 PM

It sounded like Rogier was talking about applying a transformation to the
children, so that means you have a vertex mapping from cross section to
cross section.

Connecting two arbitrary 2d shapes is hard.  I have written code to do it
in BOSL2.

https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-skin

There are several methods provided that may work for different situations.
It's hard to say what exactly the limitations are.  You should be able to
connect any two convex shapes and get a valid and generally reasonable
result if you pick the right options.  If you go to concave shapes, it may
be difficult to get a good result in some cases unless you manually
establish the vertex mapping by adding extra points (possibly coincident).

On Fri, Jan 20, 2023 at 4:07 PM Jordan Brown openscad@jordan.maileater.net
wrote:

On 1/20/2023 4:02 AM, Rogier Wolff wrote:

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

I believe the current linear extrude takes advantage of the fact that each
successive layer has the same vertices, and connects them.  Connecting two
arbitrary 2D shapes is a much harder problem.

I believe some of the libraries (like BOSL2) have more general sweep
functions that can tolerate changes in the shape, but I don't know what the
limitations are.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

It sounded like Rogier was talking about applying a transformation to the children, so that means you have a vertex mapping from cross section to cross section. Connecting two arbitrary 2d shapes is hard. I have written code to do it in BOSL2. https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-skin There are several methods provided that may work for different situations. It's hard to say what exactly the limitations are. You should be able to connect any two convex shapes and get a valid and generally reasonable result if you pick the right options. If you go to concave shapes, it may be difficult to get a good result in some cases unless you manually establish the vertex mapping by adding extra points (possibly coincident). On Fri, Jan 20, 2023 at 4:07 PM Jordan Brown <openscad@jordan.maileater.net> wrote: > On 1/20/2023 4:02 AM, Rogier Wolff wrote: > > If instead we'd pass a extrude_position=... parameter to the to be > instantiated children, those modules can do other (more generic) > morphing than just rotate and scale. > > > I believe the current linear extrude takes advantage of the fact that each > successive layer has the same vertices, and connects them. Connecting two > arbitrary 2D shapes is a much harder problem. > > I believe some of the libraries (like BOSL2) have more general sweep > functions that can tolerate changes in the shape, but I don't know what the > limitations are. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RW
Rogier Wolff
Sat, Jan 21, 2023 2:30 PM

On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote:

On 1/20/2023 4:02 AM, Rogier Wolff wrote:

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

I believe the current linear extrude takes advantage of the fact that
each successive layer has the same vertices, and connects them. 
Connecting two arbitrary 2D shapes is a much harder problem.

In the meanwhile, I thought of that too, and devised a test.

linear_extrude (height=40, twist=10) circle (50);

When you increase the twist at some point the sides flip back.... So no
it is not using the corresponding points....

And then I tried this:

module obj ()
{
translate ([0,0,0])  circle (50);
translate ([50,0,0])  circle (5);
}

linear_extrude (height=40, twist=1800, slices = 10 ) obj ();

which clearly shows that it IS using corresponding points.

So I'm afraid you're right after all: it is assuming something about
corresponding points.

While I agree that it IS much harder, I think it is "doable" and it
would be beneficial to move in that direction. But of course I don't
have the time to put in the legwork. So I'm not "demanding" that this
be implemented. If someone finds it useful to generalize the linear
extrusion: I think it is a good idea and you have my support.

Roger. 

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote: > On 1/20/2023 4:02 AM, Rogier Wolff wrote: > > If instead we'd pass a extrude_position=... parameter to the to be > > instantiated children, those modules can do other (more generic) > > morphing than just rotate and scale. > > I believe the current linear extrude takes advantage of the fact that > each successive layer has the same vertices, and connects them.  > Connecting two arbitrary 2D shapes is a much harder problem. In the meanwhile, I thought of that too, and devised a test. linear_extrude (height=40, twist=10) circle (50); When you increase the twist at some point the sides flip back.... So no it is not using the corresponding points.... And then I tried this: module obj () { translate ([0,0,0]) circle (50); translate ([50,0,0]) circle (5); } linear_extrude (height=40, twist=1800, slices = 10 ) obj (); which clearly shows that it IS using corresponding points. So I'm afraid you're right after all: it is assuming something about corresponding points. While I agree that it IS much harder, I think it is "doable" and it would be beneficial to move in that direction. But of course I don't have the time to put in the legwork. So I'm not "demanding" that this be implemented. If someone finds it useful to generalize the linear extrusion: I think it is a good idea and you have my support. Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.
AM
Adrian Mariano
Sat, Jan 21, 2023 3:07 PM

Actually whether it is "doable" to have a form of linear extrude which can
join sections with mismatched point count is debatable.  As I found in my
work on skin() for BOSL2, there is no one right way to join sections.
Sometimes you need one approach, and sometimes another.  Sometimes
multiple approaches give different, reasonable results and the user ought
to be given a choice.  Most likely major issues will arise with strongly
concave inputs---such an algorithm cannot be robust to all inputs.  For
example, what happens in joining a ring (with an internal hole) to a
square?  Is it acceptable for an OpenSCAD built-in module to fail on some
inputs?  Even if we deem bad output acceptable on some inputs, you end up
with a very complicated interface.  Again, take a look at the interface to
skin() in BOSL2.  It is not simple.  The same problem afflicts the idea of
path_sweep(), a concept people have been talking about for years, but which
has enormous hidden complexity that, it seems, has prevented it from being
implemented as a built-in module.

You talk of moving in that direction.  What kind of movement could be done
that avoids all of these complications?  Perhaps if you can come up with a
well-formed idea someone may some day implement it.

On Sat, Jan 21, 2023 at 9:30 AM Rogier Wolff R.E.Wolff@bitwizard.nl wrote:

On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote:

On 1/20/2023 4:02 AM, Rogier Wolff wrote:

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

I believe the current linear extrude takes advantage of the fact that
each successive layer has the same vertices, and connects them.
Connecting two arbitrary 2D shapes is a much harder problem.

In the meanwhile, I thought of that too, and devised a test.

linear_extrude (height=40, twist=10) circle (50);

When you increase the twist at some point the sides flip back.... So no
it is not using the corresponding points....

And then I tried this:

module obj ()
{
translate ([0,0,0])  circle (50);
translate ([50,0,0])  circle (5);
}

linear_extrude (height=40, twist=1800, slices = 10 ) obj ();

which clearly shows that it IS using corresponding points.

So I'm afraid you're right after all: it is assuming something about
corresponding points.

While I agree that it IS much harder, I think it is "doable" and it
would be beneficial to move in that direction. But of course I don't
have the time to put in the legwork. So I'm not "demanding" that this
be implemented. If someone finds it useful to generalize the linear
extrusion: I think it is a good idea and you have my support.

     Roger.

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
**
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Actually whether it is "doable" to have a form of linear extrude which can join sections with mismatched point count is debatable. As I found in my work on skin() for BOSL2, there is no one right way to join sections. Sometimes you need one approach, and sometimes another. Sometimes multiple approaches give different, reasonable results and the user ought to be given a choice. Most likely major issues will arise with strongly concave inputs---such an algorithm cannot be robust to all inputs. For example, what happens in joining a ring (with an internal hole) to a square? Is it acceptable for an OpenSCAD built-in module to fail on some inputs? Even if we deem bad output acceptable on some inputs, you end up with a very complicated interface. Again, take a look at the interface to skin() in BOSL2. It is not simple. The same problem afflicts the idea of path_sweep(), a concept people have been talking about for years, but which has enormous hidden complexity that, it seems, has prevented it from being implemented as a built-in module. You talk of moving in that direction. What kind of movement could be done that avoids all of these complications? Perhaps if you can come up with a well-formed idea someone may some day implement it. On Sat, Jan 21, 2023 at 9:30 AM Rogier Wolff <R.E.Wolff@bitwizard.nl> wrote: > On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote: > > On 1/20/2023 4:02 AM, Rogier Wolff wrote: > > > If instead we'd pass a extrude_position=... parameter to the to be > > > instantiated children, those modules can do other (more generic) > > > morphing than just rotate and scale. > > > > I believe the current linear extrude takes advantage of the fact that > > each successive layer has the same vertices, and connects them. > > Connecting two arbitrary 2D shapes is a much harder problem. > > In the meanwhile, I thought of that too, and devised a test. > > linear_extrude (height=40, twist=10) circle (50); > > When you increase the twist at some point the sides flip back.... So no > it is not using the corresponding points.... > > And then I tried this: > > module obj () > { > translate ([0,0,0]) circle (50); > translate ([50,0,0]) circle (5); > } > > linear_extrude (height=40, twist=1800, slices = 10 ) obj (); > > which clearly shows that it IS using corresponding points. > > So I'm afraid you're right after all: it is assuming something about > corresponding points. > > While I agree that it IS much harder, I think it is "doable" and it > would be beneficial to move in that direction. But of course I don't > have the time to put in the legwork. So I'm not "demanding" that this > be implemented. If someone finds it useful to generalize the linear > extrusion: I think it is a good idea and you have my support. > > Roger. > > > -- > ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 > ** > ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** > f equals m times a. When your f is steady, and your m is going down > your a is going up. -- Chris Hadfield about flying up the space shuttle. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
SP
Sanjeev Prabhakar
Sat, Jan 21, 2023 6:02 PM

If there are 2 sections who's points needs to be matched are say a and b.

Consider rays emanating from the center of section a outwards at 360
degrees.

If each ray intersects the sections a and b at exactly 1 point it should be
doable, otherwise I don't think it will be possible.

On Sat, 21 Jan, 2023, 8:38 pm Adrian Mariano, avm4@cornell.edu wrote:

Actually whether it is "doable" to have a form of linear extrude which can
join sections with mismatched point count is debatable.  As I found in my
work on skin() for BOSL2, there is no one right way to join sections.
Sometimes you need one approach, and sometimes another.  Sometimes
multiple approaches give different, reasonable results and the user ought
to be given a choice.  Most likely major issues will arise with strongly
concave inputs---such an algorithm cannot be robust to all inputs.  For
example, what happens in joining a ring (with an internal hole) to a
square?  Is it acceptable for an OpenSCAD built-in module to fail on some
inputs?  Even if we deem bad output acceptable on some inputs, you end up
with a very complicated interface.  Again, take a look at the interface to
skin() in BOSL2.  It is not simple.  The same problem afflicts the idea of
path_sweep(), a concept people have been talking about for years, but which
has enormous hidden complexity that, it seems, has prevented it from being
implemented as a built-in module.

You talk of moving in that direction.  What kind of movement could be done
that avoids all of these complications?  Perhaps if you can come up with a
well-formed idea someone may some day implement it.

On Sat, Jan 21, 2023 at 9:30 AM Rogier Wolff R.E.Wolff@bitwizard.nl
wrote:

On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote:

On 1/20/2023 4:02 AM, Rogier Wolff wrote:

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

I believe the current linear extrude takes advantage of the fact that
each successive layer has the same vertices, and connects them.
Connecting two arbitrary 2D shapes is a much harder problem.

In the meanwhile, I thought of that too, and devised a test.

linear_extrude (height=40, twist=10) circle (50);

When you increase the twist at some point the sides flip back.... So no
it is not using the corresponding points....

And then I tried this:

module obj ()
{
translate ([0,0,0])  circle (50);
translate ([50,0,0])  circle (5);
}

linear_extrude (height=40, twist=1800, slices = 10 ) obj ();

which clearly shows that it IS using corresponding points.

So I'm afraid you're right after all: it is assuming something about
corresponding points.

While I agree that it IS much harder, I think it is "doable" and it
would be beneficial to move in that direction. But of course I don't
have the time to put in the legwork. So I'm not "demanding" that this
be implemented. If someone finds it useful to generalize the linear
extrusion: I think it is a good idea and you have my support.

     Roger.

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
**
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233
**
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

If there are 2 sections who's points needs to be matched are say a and b. Consider rays emanating from the center of section a outwards at 360 degrees. If each ray intersects the sections a and b at exactly 1 point it should be doable, otherwise I don't think it will be possible. On Sat, 21 Jan, 2023, 8:38 pm Adrian Mariano, <avm4@cornell.edu> wrote: > Actually whether it is "doable" to have a form of linear extrude which can > join sections with mismatched point count is debatable. As I found in my > work on skin() for BOSL2, there is no one right way to join sections. > Sometimes you need one approach, and sometimes another. Sometimes > multiple approaches give different, reasonable results and the user ought > to be given a choice. Most likely major issues will arise with strongly > concave inputs---such an algorithm cannot be robust to all inputs. For > example, what happens in joining a ring (with an internal hole) to a > square? Is it acceptable for an OpenSCAD built-in module to fail on some > inputs? Even if we deem bad output acceptable on some inputs, you end up > with a very complicated interface. Again, take a look at the interface to > skin() in BOSL2. It is not simple. The same problem afflicts the idea of > path_sweep(), a concept people have been talking about for years, but which > has enormous hidden complexity that, it seems, has prevented it from being > implemented as a built-in module. > > You talk of moving in that direction. What kind of movement could be done > that avoids all of these complications? Perhaps if you can come up with a > well-formed idea someone may some day implement it. > > On Sat, Jan 21, 2023 at 9:30 AM Rogier Wolff <R.E.Wolff@bitwizard.nl> > wrote: > >> On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote: >> > On 1/20/2023 4:02 AM, Rogier Wolff wrote: >> > > If instead we'd pass a extrude_position=... parameter to the to be >> > > instantiated children, those modules can do other (more generic) >> > > morphing than just rotate and scale. >> > >> > I believe the current linear extrude takes advantage of the fact that >> > each successive layer has the same vertices, and connects them. >> > Connecting two arbitrary 2D shapes is a much harder problem. >> >> In the meanwhile, I thought of that too, and devised a test. >> >> linear_extrude (height=40, twist=10) circle (50); >> >> When you increase the twist at some point the sides flip back.... So no >> it is not using the corresponding points.... >> >> And then I tried this: >> >> module obj () >> { >> translate ([0,0,0]) circle (50); >> translate ([50,0,0]) circle (5); >> } >> >> linear_extrude (height=40, twist=1800, slices = 10 ) obj (); >> >> which clearly shows that it IS using corresponding points. >> >> So I'm afraid you're right after all: it is assuming something about >> corresponding points. >> >> While I agree that it IS much harder, I think it is "doable" and it >> would be beneficial to move in that direction. But of course I don't >> have the time to put in the legwork. So I'm not "demanding" that this >> be implemented. If someone finds it useful to generalize the linear >> extrusion: I think it is a good idea and you have my support. >> >> Roger. >> >> >> -- >> ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 >> ** >> ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 >> ** >> f equals m times a. When your f is steady, and your m is going down >> your a is going up. -- Chris Hadfield about flying up the space shuttle. >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
AM
Adrian Mariano
Sat, Jan 21, 2023 6:24 PM

I think your condition is sufficient by not necessary.  If section A and
section B don't overlap, for example, but they are otherwise well behaved,
it is likely that they can still be aligned.  There may be non-convex cases
where some algorithm exists that produces a reasonable alignment, for
example by resampling both sections to have a fine sampling with the same
number of points, sampling uniformly in length---assuming a suitable
starting point is identified somehow.

The other thing is that your condition doesn't actually provide an
alignment algorithm that always produces a good result.  For example, in
connecting a pentagon to a square the result of such an algorithm will be
ugly.  You need instead to match up the vertices somehow, and collapse two
pentagon vertices onto one square vertex.

On Sat, Jan 21, 2023 at 1:02 PM Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

If there are 2 sections who's points needs to be matched are say a and b.

Consider rays emanating from the center of section a outwards at 360
degrees.

If each ray intersects the sections a and b at exactly 1 point it should
be doable, otherwise I don't think it will be possible.

On Sat, 21 Jan, 2023, 8:38 pm Adrian Mariano, avm4@cornell.edu wrote:

Actually whether it is "doable" to have a form of linear extrude which
can join sections with mismatched point count is debatable.  As I found in
my work on skin() for BOSL2, there is no one right way to join sections.
Sometimes you need one approach, and sometimes another.  Sometimes
multiple approaches give different, reasonable results and the user ought
to be given a choice.  Most likely major issues will arise with strongly
concave inputs---such an algorithm cannot be robust to all inputs.  For
example, what happens in joining a ring (with an internal hole) to a
square?  Is it acceptable for an OpenSCAD built-in module to fail on some
inputs?  Even if we deem bad output acceptable on some inputs, you end up
with a very complicated interface.  Again, take a look at the interface to
skin() in BOSL2.  It is not simple.  The same problem afflicts the idea of
path_sweep(), a concept people have been talking about for years, but which
has enormous hidden complexity that, it seems, has prevented it from being
implemented as a built-in module.

You talk of moving in that direction.  What kind of movement could be
done that avoids all of these complications?  Perhaps if you can come up
with a well-formed idea someone may some day implement it.

On Sat, Jan 21, 2023 at 9:30 AM Rogier Wolff R.E.Wolff@bitwizard.nl
wrote:

On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote:

On 1/20/2023 4:02 AM, Rogier Wolff wrote:

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

I believe the current linear extrude takes advantage of the fact that
each successive layer has the same vertices, and connects them.
Connecting two arbitrary 2D shapes is a much harder problem.

In the meanwhile, I thought of that too, and devised a test.

linear_extrude (height=40, twist=10) circle (50);

When you increase the twist at some point the sides flip back.... So no
it is not using the corresponding points....

And then I tried this:

module obj ()
{
translate ([0,0,0])  circle (50);
translate ([50,0,0])  circle (5);
}

linear_extrude (height=40, twist=1800, slices = 10 ) obj ();

which clearly shows that it IS using corresponding points.

So I'm afraid you're right after all: it is assuming something about
corresponding points.

While I agree that it IS much harder, I think it is "doable" and it
would be beneficial to move in that direction. But of course I don't
have the time to put in the legwork. So I'm not "demanding" that this
be implemented. If someone finds it useful to generalize the linear
extrusion: I think it is a good idea and you have my support.

     Roger.

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ **
+31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233
**
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I think your condition is sufficient by not necessary. If section A and section B don't overlap, for example, but they are otherwise well behaved, it is likely that they can still be aligned. There may be non-convex cases where some algorithm exists that produces a reasonable alignment, for example by resampling both sections to have a fine sampling with the same number of points, sampling uniformly in length---assuming a suitable starting point is identified somehow. The other thing is that your condition doesn't actually provide an alignment algorithm that always produces a good result. For example, in connecting a pentagon to a square the result of such an algorithm will be ugly. You need instead to match up the vertices somehow, and collapse two pentagon vertices onto one square vertex. On Sat, Jan 21, 2023 at 1:02 PM Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > If there are 2 sections who's points needs to be matched are say a and b. > > Consider rays emanating from the center of section a outwards at 360 > degrees. > > If each ray intersects the sections a and b at exactly 1 point it should > be doable, otherwise I don't think it will be possible. > > > > On Sat, 21 Jan, 2023, 8:38 pm Adrian Mariano, <avm4@cornell.edu> wrote: > >> Actually whether it is "doable" to have a form of linear extrude which >> can join sections with mismatched point count is debatable. As I found in >> my work on skin() for BOSL2, there is no one right way to join sections. >> Sometimes you need one approach, and sometimes another. Sometimes >> multiple approaches give different, reasonable results and the user ought >> to be given a choice. Most likely major issues will arise with strongly >> concave inputs---such an algorithm cannot be robust to all inputs. For >> example, what happens in joining a ring (with an internal hole) to a >> square? Is it acceptable for an OpenSCAD built-in module to fail on some >> inputs? Even if we deem bad output acceptable on some inputs, you end up >> with a very complicated interface. Again, take a look at the interface to >> skin() in BOSL2. It is not simple. The same problem afflicts the idea of >> path_sweep(), a concept people have been talking about for years, but which >> has enormous hidden complexity that, it seems, has prevented it from being >> implemented as a built-in module. >> >> You talk of moving in that direction. What kind of movement could be >> done that avoids all of these complications? Perhaps if you can come up >> with a well-formed idea someone may some day implement it. >> >> On Sat, Jan 21, 2023 at 9:30 AM Rogier Wolff <R.E.Wolff@bitwizard.nl> >> wrote: >> >>> On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote: >>> > On 1/20/2023 4:02 AM, Rogier Wolff wrote: >>> > > If instead we'd pass a extrude_position=... parameter to the to be >>> > > instantiated children, those modules can do other (more generic) >>> > > morphing than just rotate and scale. >>> > >>> > I believe the current linear extrude takes advantage of the fact that >>> > each successive layer has the same vertices, and connects them. >>> > Connecting two arbitrary 2D shapes is a much harder problem. >>> >>> In the meanwhile, I thought of that too, and devised a test. >>> >>> linear_extrude (height=40, twist=10) circle (50); >>> >>> When you increase the twist at some point the sides flip back.... So no >>> it is not using the corresponding points.... >>> >>> And then I tried this: >>> >>> module obj () >>> { >>> translate ([0,0,0]) circle (50); >>> translate ([50,0,0]) circle (5); >>> } >>> >>> linear_extrude (height=40, twist=1800, slices = 10 ) obj (); >>> >>> which clearly shows that it IS using corresponding points. >>> >>> So I'm afraid you're right after all: it is assuming something about >>> corresponding points. >>> >>> While I agree that it IS much harder, I think it is "doable" and it >>> would be beneficial to move in that direction. But of course I don't >>> have the time to put in the legwork. So I'm not "demanding" that this >>> be implemented. If someone finds it useful to generalize the linear >>> extrusion: I think it is a good idea and you have my support. >>> >>> Roger. >>> >>> >>> -- >>> ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** >>> +31-15-2049110 ** >>> ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 >>> ** >>> f equals m times a. When your f is steady, and your m is going down >>> your a is going up. -- Chris Hadfield about flying up the space shuttle. >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
SP
Sanjeev Prabhakar
Sat, Jan 21, 2023 6:30 PM

This is for complex use cases.

For pentagon to square can be a nearest point mapping, which is fairly easy
to achieve.

Regards

On Sat, 21 Jan, 2023, 11:55 pm Adrian Mariano, avm4@cornell.edu wrote:

I think your condition is sufficient by not necessary.  If section A and
section B don't overlap, for example, but they are otherwise well behaved,
it is likely that they can still be aligned.  There may be non-convex cases
where some algorithm exists that produces a reasonable alignment, for
example by resampling both sections to have a fine sampling with the same
number of points, sampling uniformly in length---assuming a suitable
starting point is identified somehow.

The other thing is that your condition doesn't actually provide an
alignment algorithm that always produces a good result.  For example, in
connecting a pentagon to a square the result of such an algorithm will be
ugly.  You need instead to match up the vertices somehow, and collapse two
pentagon vertices onto one square vertex.

On Sat, Jan 21, 2023 at 1:02 PM Sanjeev Prabhakar <
sprabhakar2006@gmail.com> wrote:

If there are 2 sections who's points needs to be matched are say a and b.

Consider rays emanating from the center of section a outwards at 360
degrees.

If each ray intersects the sections a and b at exactly 1 point it should
be doable, otherwise I don't think it will be possible.

On Sat, 21 Jan, 2023, 8:38 pm Adrian Mariano, avm4@cornell.edu wrote:

Actually whether it is "doable" to have a form of linear extrude which
can join sections with mismatched point count is debatable.  As I found in
my work on skin() for BOSL2, there is no one right way to join sections.
Sometimes you need one approach, and sometimes another.  Sometimes
multiple approaches give different, reasonable results and the user ought
to be given a choice.  Most likely major issues will arise with strongly
concave inputs---such an algorithm cannot be robust to all inputs.  For
example, what happens in joining a ring (with an internal hole) to a
square?  Is it acceptable for an OpenSCAD built-in module to fail on some
inputs?  Even if we deem bad output acceptable on some inputs, you end up
with a very complicated interface.  Again, take a look at the interface to
skin() in BOSL2.  It is not simple.  The same problem afflicts the idea of
path_sweep(), a concept people have been talking about for years, but which
has enormous hidden complexity that, it seems, has prevented it from being
implemented as a built-in module.

You talk of moving in that direction.  What kind of movement could be
done that avoids all of these complications?  Perhaps if you can come up
with a well-formed idea someone may some day implement it.

On Sat, Jan 21, 2023 at 9:30 AM Rogier Wolff R.E.Wolff@bitwizard.nl
wrote:

On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote:

On 1/20/2023 4:02 AM, Rogier Wolff wrote:

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

I believe the current linear extrude takes advantage of the fact that
each successive layer has the same vertices, and connects them.
Connecting two arbitrary 2D shapes is a much harder problem.

In the meanwhile, I thought of that too, and devised a test.

linear_extrude (height=40, twist=10) circle (50);

When you increase the twist at some point the sides flip back.... So no
it is not using the corresponding points....

And then I tried this:

module obj ()
{
translate ([0,0,0])  circle (50);
translate ([50,0,0])  circle (5);
}

linear_extrude (height=40, twist=1800, slices = 10 ) obj ();

which clearly shows that it IS using corresponding points.

So I'm afraid you're right after all: it is assuming something about
corresponding points.

While I agree that it IS much harder, I think it is "doable" and it
would be beneficial to move in that direction. But of course I don't
have the time to put in the legwork. So I'm not "demanding" that this
be implemented. If someone finds it useful to generalize the linear
extrusion: I think it is a good idea and you have my support.

     Roger.

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ **
+31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233
**
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space
shuttle.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

This is for complex use cases. For pentagon to square can be a nearest point mapping, which is fairly easy to achieve. Regards On Sat, 21 Jan, 2023, 11:55 pm Adrian Mariano, <avm4@cornell.edu> wrote: > I think your condition is sufficient by not necessary. If section A and > section B don't overlap, for example, but they are otherwise well behaved, > it is likely that they can still be aligned. There may be non-convex cases > where some algorithm exists that produces a reasonable alignment, for > example by resampling both sections to have a fine sampling with the same > number of points, sampling uniformly in length---assuming a suitable > starting point is identified somehow. > > The other thing is that your condition doesn't actually provide an > alignment algorithm that always produces a good result. For example, in > connecting a pentagon to a square the result of such an algorithm will be > ugly. You need instead to match up the vertices somehow, and collapse two > pentagon vertices onto one square vertex. > > > On Sat, Jan 21, 2023 at 1:02 PM Sanjeev Prabhakar < > sprabhakar2006@gmail.com> wrote: > >> If there are 2 sections who's points needs to be matched are say a and b. >> >> Consider rays emanating from the center of section a outwards at 360 >> degrees. >> >> If each ray intersects the sections a and b at exactly 1 point it should >> be doable, otherwise I don't think it will be possible. >> >> >> >> On Sat, 21 Jan, 2023, 8:38 pm Adrian Mariano, <avm4@cornell.edu> wrote: >> >>> Actually whether it is "doable" to have a form of linear extrude which >>> can join sections with mismatched point count is debatable. As I found in >>> my work on skin() for BOSL2, there is no one right way to join sections. >>> Sometimes you need one approach, and sometimes another. Sometimes >>> multiple approaches give different, reasonable results and the user ought >>> to be given a choice. Most likely major issues will arise with strongly >>> concave inputs---such an algorithm cannot be robust to all inputs. For >>> example, what happens in joining a ring (with an internal hole) to a >>> square? Is it acceptable for an OpenSCAD built-in module to fail on some >>> inputs? Even if we deem bad output acceptable on some inputs, you end up >>> with a very complicated interface. Again, take a look at the interface to >>> skin() in BOSL2. It is not simple. The same problem afflicts the idea of >>> path_sweep(), a concept people have been talking about for years, but which >>> has enormous hidden complexity that, it seems, has prevented it from being >>> implemented as a built-in module. >>> >>> You talk of moving in that direction. What kind of movement could be >>> done that avoids all of these complications? Perhaps if you can come up >>> with a well-formed idea someone may some day implement it. >>> >>> On Sat, Jan 21, 2023 at 9:30 AM Rogier Wolff <R.E.Wolff@bitwizard.nl> >>> wrote: >>> >>>> On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote: >>>> > On 1/20/2023 4:02 AM, Rogier Wolff wrote: >>>> > > If instead we'd pass a extrude_position=... parameter to the to be >>>> > > instantiated children, those modules can do other (more generic) >>>> > > morphing than just rotate and scale. >>>> > >>>> > I believe the current linear extrude takes advantage of the fact that >>>> > each successive layer has the same vertices, and connects them. >>>> > Connecting two arbitrary 2D shapes is a much harder problem. >>>> >>>> In the meanwhile, I thought of that too, and devised a test. >>>> >>>> linear_extrude (height=40, twist=10) circle (50); >>>> >>>> When you increase the twist at some point the sides flip back.... So no >>>> it is not using the corresponding points.... >>>> >>>> And then I tried this: >>>> >>>> module obj () >>>> { >>>> translate ([0,0,0]) circle (50); >>>> translate ([50,0,0]) circle (5); >>>> } >>>> >>>> linear_extrude (height=40, twist=1800, slices = 10 ) obj (); >>>> >>>> which clearly shows that it IS using corresponding points. >>>> >>>> So I'm afraid you're right after all: it is assuming something about >>>> corresponding points. >>>> >>>> While I agree that it IS much harder, I think it is "doable" and it >>>> would be beneficial to move in that direction. But of course I don't >>>> have the time to put in the legwork. So I'm not "demanding" that this >>>> be implemented. If someone finds it useful to generalize the linear >>>> extrusion: I think it is a good idea and you have my support. >>>> >>>> Roger. >>>> >>>> >>>> -- >>>> ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** >>>> +31-15-2049110 ** >>>> ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 >>>> ** >>>> f equals m times a. When your f is steady, and your m is going down >>>> your a is going up. -- Chris Hadfield about flying up the space >>>> shuttle. >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
SP
Sanjeev Prabhakar
Sat, Jan 21, 2023 6:38 PM

I mean of both the sections are convex it should be simpler

If either or both the sections are concave it would be a little or more
complex based on the shape

On Sun, 22 Jan, 2023, 12:00 am Sanjeev Prabhakar, sprabhakar2006@gmail.com
wrote:

This is for complex use cases.

For pentagon to square can be a nearest point mapping, which is fairly
easy to achieve.

Regards

On Sat, 21 Jan, 2023, 11:55 pm Adrian Mariano, avm4@cornell.edu wrote:

I think your condition is sufficient by not necessary.  If section A and
section B don't overlap, for example, but they are otherwise well behaved,
it is likely that they can still be aligned.  There may be non-convex cases
where some algorithm exists that produces a reasonable alignment, for
example by resampling both sections to have a fine sampling with the same
number of points, sampling uniformly in length---assuming a suitable
starting point is identified somehow.

The other thing is that your condition doesn't actually provide an
alignment algorithm that always produces a good result.  For example, in
connecting a pentagon to a square the result of such an algorithm will be
ugly.  You need instead to match up the vertices somehow, and collapse two
pentagon vertices onto one square vertex.

On Sat, Jan 21, 2023 at 1:02 PM Sanjeev Prabhakar <
sprabhakar2006@gmail.com> wrote:

If there are 2 sections who's points needs to be matched are say a and b.

Consider rays emanating from the center of section a outwards at 360
degrees.

If each ray intersects the sections a and b at exactly 1 point it should
be doable, otherwise I don't think it will be possible.

On Sat, 21 Jan, 2023, 8:38 pm Adrian Mariano, avm4@cornell.edu wrote:

Actually whether it is "doable" to have a form of linear extrude which
can join sections with mismatched point count is debatable.  As I found in
my work on skin() for BOSL2, there is no one right way to join sections.
Sometimes you need one approach, and sometimes another.  Sometimes
multiple approaches give different, reasonable results and the user ought
to be given a choice.  Most likely major issues will arise with strongly
concave inputs---such an algorithm cannot be robust to all inputs.  For
example, what happens in joining a ring (with an internal hole) to a
square?  Is it acceptable for an OpenSCAD built-in module to fail on some
inputs?  Even if we deem bad output acceptable on some inputs, you end up
with a very complicated interface.  Again, take a look at the interface to
skin() in BOSL2.  It is not simple.  The same problem afflicts the idea of
path_sweep(), a concept people have been talking about for years, but which
has enormous hidden complexity that, it seems, has prevented it from being
implemented as a built-in module.

You talk of moving in that direction.  What kind of movement could be
done that avoids all of these complications?  Perhaps if you can come up
with a well-formed idea someone may some day implement it.

On Sat, Jan 21, 2023 at 9:30 AM Rogier Wolff R.E.Wolff@bitwizard.nl
wrote:

On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote:

On 1/20/2023 4:02 AM, Rogier Wolff wrote:

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

I believe the current linear extrude takes advantage of the fact that
each successive layer has the same vertices, and connects them.
Connecting two arbitrary 2D shapes is a much harder problem.

In the meanwhile, I thought of that too, and devised a test.

linear_extrude (height=40, twist=10) circle (50);

When you increase the twist at some point the sides flip back.... So no
it is not using the corresponding points....

And then I tried this:

module obj ()
{
translate ([0,0,0])  circle (50);
translate ([50,0,0])  circle (5);
}

linear_extrude (height=40, twist=1800, slices = 10 ) obj ();

which clearly shows that it IS using corresponding points.

So I'm afraid you're right after all: it is assuming something about
corresponding points.

While I agree that it IS much harder, I think it is "doable" and it
would be beneficial to move in that direction. But of course I don't
have the time to put in the legwork. So I'm not "demanding" that this
be implemented. If someone finds it useful to generalize the linear
extrusion: I think it is a good idea and you have my support.

     Roger.

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ **
+31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233
**
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space
shuttle.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I mean of both the sections are convex it should be simpler If either or both the sections are concave it would be a little or more complex based on the shape On Sun, 22 Jan, 2023, 12:00 am Sanjeev Prabhakar, <sprabhakar2006@gmail.com> wrote: > This is for complex use cases. > > For pentagon to square can be a nearest point mapping, which is fairly > easy to achieve. > > Regards > > On Sat, 21 Jan, 2023, 11:55 pm Adrian Mariano, <avm4@cornell.edu> wrote: > >> I think your condition is sufficient by not necessary. If section A and >> section B don't overlap, for example, but they are otherwise well behaved, >> it is likely that they can still be aligned. There may be non-convex cases >> where some algorithm exists that produces a reasonable alignment, for >> example by resampling both sections to have a fine sampling with the same >> number of points, sampling uniformly in length---assuming a suitable >> starting point is identified somehow. >> >> The other thing is that your condition doesn't actually provide an >> alignment algorithm that always produces a good result. For example, in >> connecting a pentagon to a square the result of such an algorithm will be >> ugly. You need instead to match up the vertices somehow, and collapse two >> pentagon vertices onto one square vertex. >> >> >> On Sat, Jan 21, 2023 at 1:02 PM Sanjeev Prabhakar < >> sprabhakar2006@gmail.com> wrote: >> >>> If there are 2 sections who's points needs to be matched are say a and b. >>> >>> Consider rays emanating from the center of section a outwards at 360 >>> degrees. >>> >>> If each ray intersects the sections a and b at exactly 1 point it should >>> be doable, otherwise I don't think it will be possible. >>> >>> >>> >>> On Sat, 21 Jan, 2023, 8:38 pm Adrian Mariano, <avm4@cornell.edu> wrote: >>> >>>> Actually whether it is "doable" to have a form of linear extrude which >>>> can join sections with mismatched point count is debatable. As I found in >>>> my work on skin() for BOSL2, there is no one right way to join sections. >>>> Sometimes you need one approach, and sometimes another. Sometimes >>>> multiple approaches give different, reasonable results and the user ought >>>> to be given a choice. Most likely major issues will arise with strongly >>>> concave inputs---such an algorithm cannot be robust to all inputs. For >>>> example, what happens in joining a ring (with an internal hole) to a >>>> square? Is it acceptable for an OpenSCAD built-in module to fail on some >>>> inputs? Even if we deem bad output acceptable on some inputs, you end up >>>> with a very complicated interface. Again, take a look at the interface to >>>> skin() in BOSL2. It is not simple. The same problem afflicts the idea of >>>> path_sweep(), a concept people have been talking about for years, but which >>>> has enormous hidden complexity that, it seems, has prevented it from being >>>> implemented as a built-in module. >>>> >>>> You talk of moving in that direction. What kind of movement could be >>>> done that avoids all of these complications? Perhaps if you can come up >>>> with a well-formed idea someone may some day implement it. >>>> >>>> On Sat, Jan 21, 2023 at 9:30 AM Rogier Wolff <R.E.Wolff@bitwizard.nl> >>>> wrote: >>>> >>>>> On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote: >>>>> > On 1/20/2023 4:02 AM, Rogier Wolff wrote: >>>>> > > If instead we'd pass a extrude_position=... parameter to the to be >>>>> > > instantiated children, those modules can do other (more generic) >>>>> > > morphing than just rotate and scale. >>>>> > >>>>> > I believe the current linear extrude takes advantage of the fact that >>>>> > each successive layer has the same vertices, and connects them. >>>>> > Connecting two arbitrary 2D shapes is a much harder problem. >>>>> >>>>> In the meanwhile, I thought of that too, and devised a test. >>>>> >>>>> linear_extrude (height=40, twist=10) circle (50); >>>>> >>>>> When you increase the twist at some point the sides flip back.... So no >>>>> it is not using the corresponding points.... >>>>> >>>>> And then I tried this: >>>>> >>>>> module obj () >>>>> { >>>>> translate ([0,0,0]) circle (50); >>>>> translate ([50,0,0]) circle (5); >>>>> } >>>>> >>>>> linear_extrude (height=40, twist=1800, slices = 10 ) obj (); >>>>> >>>>> which clearly shows that it IS using corresponding points. >>>>> >>>>> So I'm afraid you're right after all: it is assuming something about >>>>> corresponding points. >>>>> >>>>> While I agree that it IS much harder, I think it is "doable" and it >>>>> would be beneficial to move in that direction. But of course I don't >>>>> have the time to put in the legwork. So I'm not "demanding" that this >>>>> be implemented. If someone finds it useful to generalize the linear >>>>> extrusion: I think it is a good idea and you have my support. >>>>> >>>>> Roger. >>>>> >>>>> >>>>> -- >>>>> ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** >>>>> +31-15-2049110 ** >>>>> ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 >>>>> ** >>>>> f equals m times a. When your f is steady, and your m is going down >>>>> your a is going up. -- Chris Hadfield about flying up the space >>>>> shuttle. >>>>> _______________________________________________ >>>>> OpenSCAD mailing list >>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >
JB
Jordan Brown
Sat, Jan 21, 2023 7:39 PM

On 1/21/2023 10:24 AM, Adrian Mariano wrote:

The other thing is that your condition doesn't actually provide an
alignment algorithm that always produces a good result.  For example,
in connecting a pentagon to a square the result of such an algorithm
will be ugly.  You need instead to match up the vertices somehow, and
collapse two pentagon vertices onto one square vertex. 

I was curious what a "match up by angle" algorithm would produce, so I
wrote something kind of similar.  It samples both polygons the same
number of times, linearly along the perimeter, and connects them.  The
result is ... interesting.  I don't know that it's right, but I also
don't know that it's wrong.  Most disturbing is that one side ends up
flat while the others end up curved.

sides_a = 4;
sides_b = 5;
n = 80;
ir = 10;
h = 20;

samples_per_side_a = n / sides_a;
samples_per_side_b = n / sides_b;

// Generate points for one side of a polygon, as a vertical line in +X,
// centered around Y=0.
function points(ir, side, n) = [
for (i=[0:n-1]) [ ir, i*side/n - side/2 ]
];

// Given a 2D point and an angle, rotate the point.
function rot(p, a) = p * [ [ cos(a), sin(a) ], [-sin(a), cos(a)] ];

// Calculate the points for each polygon by generating N sides and rotating them.
pts_a = [ for (i=[0:sides_a-1]) let(a=i360/sides_a) each [ for (p=points(ir, 2tan(360/sides_a/2)*ir, samples_per_side_a)) rot(p, a) ] ];

pts_b = [ for (i=[0:sides_b-1]) let(a=i360/sides_b) each [ for (p=points(ir, 2tan(360/sides_b/2)*ir, samples_per_side_b)) rot(p, a) ] ];

// All of the points of the polyhedron.
points = [
for (p = pts_a) [ p.x, p.y, 0 ],
for (p = pts_b) [ p.x, p.y, h ]
];

// All of the faces - bottom, top, sides.
faces = [
[ for (i = [0:n-1]) i ],
[ for (i = [n-1:-1:0]) n+i ],
for (i = [0:n-1]) [ i, i+n, (i+1)%n ],
for (i = [0:n-1]) [ (i+1)%n, i+n, (i+1)%n + n ]
];

polyhedron(points=points, faces=faces);

On 1/21/2023 10:24 AM, Adrian Mariano wrote: > The other thing is that your condition doesn't actually provide an > alignment algorithm that always produces a good result.  For example, > in connecting a pentagon to a square the result of such an algorithm > will be ugly.  You need instead to match up the vertices somehow, and > collapse two pentagon vertices onto one square vertex.  I was curious what a "match up by angle" algorithm would produce, so I wrote something kind of similar.  It samples both polygons the same number of times, linearly along the perimeter, and connects them.  The result is ... interesting.  I don't know that it's right, but I also don't know that it's wrong.  Most disturbing is that one side ends up flat while the others end up curved. sides_a = 4; sides_b = 5; n = 80; ir = 10; h = 20; samples_per_side_a = n / sides_a; samples_per_side_b = n / sides_b; // Generate points for one side of a polygon, as a vertical line in +X, // centered around Y=0. function points(ir, side, n) = [ for (i=[0:n-1]) [ ir, i*side/n - side/2 ] ]; // Given a 2D point and an angle, rotate the point. function rot(p, a) = p * [ [ cos(a), sin(a) ], [-sin(a), cos(a)] ]; // Calculate the points for each polygon by generating N sides and rotating them. pts_a = [ for (i=[0:sides_a-1]) let(a=i*360/sides_a) each [ for (p=points(ir, 2*tan(360/sides_a/2)*ir, samples_per_side_a)) rot(p, a) ] ]; pts_b = [ for (i=[0:sides_b-1]) let(a=i*360/sides_b) each [ for (p=points(ir, 2*tan(360/sides_b/2)*ir, samples_per_side_b)) rot(p, a) ] ]; // All of the points of the polyhedron. points = [ for (p = pts_a) [ p.x, p.y, 0 ], for (p = pts_b) [ p.x, p.y, h ] ]; // All of the faces - bottom, top, sides. faces = [ [ for (i = [0:n-1]) i ], [ for (i = [n-1:-1:0]) n+i ], for (i = [0:n-1]) [ i, i+n, (i+1)%n ], for (i = [0:n-1]) [ (i+1)%n, i+n, (i+1)%n + n ] ]; polyhedron(points=points, faces=faces);
SL
Steve Lelievre
Sat, Jan 21, 2023 8:24 PM

On 2023-01-21 10:38 a.m., Sanjeev Prabhakar wrote:

I mean of both the sections are convex it should be simpler

Indeed. And if I have understood the enhancement being discussed, in the
case of two convex ends you can already achieve the required effect with
current OpenSCAD facilities. That is, if both ends of the extruded shape
are fully convex (continuously convex along the perimeters) then the
required morphing can be achieved using hull of two 'cones', one of
which is inverted. The method requires that both starting 2D shapes must
surround the z axis/x-y origin, but you can use multmatrix afterwards to
skew the 3D shape if you need to have one end outside the z axis.

In the example below, I made the cones from SVG outlines by using
linear_extrude with scale = 0. For an end that is an ordinary polygon, I
would create a cone using the cylinder command with one of the r
parameters set to zero and a suitable $fn value (maybe also rotating it
around z axis to get a nice outline).

hull() {
   linear_extrude(50,scale=0)import("convex1.svg");
translate([0,0,50])mirror([0,0,1])linear_extrude(50,scale=0)import("convex2.svg");
}

Here, red is the inverted cone, green the upright cone, grey is the
hulled object.

Steve

On 2023-01-21 10:38 a.m., Sanjeev Prabhakar wrote: > I mean of both the sections are convex it should be simpler Indeed. And if I have understood the enhancement being discussed, in the case of two convex ends you can already achieve the required effect with current OpenSCAD facilities. That is, if both ends of the extruded shape are fully convex (continuously convex along the perimeters) then the required morphing can be achieved using hull of two 'cones', one of which is inverted. The method requires that both starting 2D shapes must surround the z axis/x-y origin, but you can use multmatrix afterwards to skew the 3D shape if you need to have one end outside the z axis. In the example below, I made the cones from SVG outlines by using linear_extrude with scale = 0. For an end that is an ordinary polygon, I would create a cone using the cylinder command with one of the r parameters set to zero and a suitable $fn value (maybe also rotating it around z axis to get a nice outline). > hull() { >    linear_extrude(50,scale=0)import("convex1.svg"); > translate([0,0,50])mirror([0,0,1])linear_extrude(50,scale=0)import("convex2.svg"); > } Here, red is the inverted cone, green the upright cone, grey is the hulled object. Steve
JB
Jordan Brown
Sat, Jan 21, 2023 8:43 PM

On 1/21/2023 12:24 PM, Steve Lelievre wrote:

the required morphing can be achieved using hull of two 'cones', one
of which is inverted.

I'm missing what the cone-ness brings to the picture, versus just having
each of them infinitesimally thin and then hulling them.

(But note that hull won't help if the figures aren't convex.)

On 1/21/2023 12:24 PM, Steve Lelievre wrote: > the required morphing can be achieved using hull of two 'cones', one > of which is inverted. I'm missing what the cone-ness brings to the picture, versus just having each of them infinitesimally thin and then hulling them. (But note that hull won't help if the figures aren't convex.)
NH
nop head
Sat, Jan 21, 2023 9:07 PM

If you use very thin cylinders you get extra edges very close together,
which can cause issues. Cones avoid that as the base is a single edge
rather than two very close together.

On Sat, 21 Jan 2023 at 20:45, Jordan Brown openscad@jordan.maileater.net
wrote:

On 1/21/2023 12:24 PM, Steve Lelievre wrote:

the required morphing can be achieved using hull of two 'cones', one of
which is inverted.

I'm missing what the cone-ness brings to the picture, versus just having
each of them infinitesimally thin and then hulling them.

(But note that hull won't help if the figures aren't convex.)


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

If you use very thin cylinders you get extra edges very close together, which can cause issues. Cones avoid that as the base is a single edge rather than two very close together. On Sat, 21 Jan 2023 at 20:45, Jordan Brown <openscad@jordan.maileater.net> wrote: > On 1/21/2023 12:24 PM, Steve Lelievre wrote: > > the required morphing can be achieved using hull of two 'cones', one of > which is inverted. > > > I'm missing what the cone-ness brings to the picture, versus just having > each of them infinitesimally thin and then hulling them. > > (But note that hull won't help if the figures aren't convex.) > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
SL
Steve Lelievre
Sat, Jan 21, 2023 9:24 PM

Jordan,

I like the cones because they only involve the one perimeter at the wide
end so the shape produced is completely 'correct' in geometrical terms.
As well, to me the code required is just as simple as it is for flat end
shapes.

And yes, I agree (and also mentioned) that the hulling option is only
valid for convex end shapes. The good thing about it is that it's here now.

Steve

On 2023-01-21 12:43 p.m., Jordan Brown wrote:

On 1/21/2023 12:24 PM, Steve Lelievre wrote:

the required morphing can be achieved using hull of two 'cones', one
of which is inverted.

I'm missing what the cone-ness brings to the picture, versus just
having each of them infinitesimally thin and then hulling them.

(But note that hull won't help if the figures aren't convex.)

Jordan, I like the cones because they only involve the one perimeter at the wide end so the shape produced is completely 'correct' in geometrical terms. As well, to me the code required is just as simple as it is for flat end shapes. And yes, I agree (and also mentioned) that the hulling option is only valid for convex end shapes. The good thing about it is that it's here now. Steve On 2023-01-21 12:43 p.m., Jordan Brown wrote: > On 1/21/2023 12:24 PM, Steve Lelievre wrote: >> the required morphing can be achieved using hull of two 'cones', one >> of which is inverted. > > I'm missing what the cone-ness brings to the picture, versus just > having each of them infinitesimally thin and then hulling them. > > (But note that hull won't help if the figures aren't convex.)