discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Cutting a Cylindrical shell

JB
Jordan Brown
Fri, Apr 23, 2021 11:24 PM

On 4/23/2021 4:17 PM, Jordan Brown wrote:

On 4/23/2021 4:03 PM, Sayandeep Khan wrote:

­How can we extract such faces from a shell given some conditions?

I'd be happy to cook up a demonstration, but I don't have time right now.

Here's the basic theory...

Have you looked at how you build a polyhedron?  You define a bunch of
points, and then you connect groups of those points into faces that
all add up to being the polyhedron.

The idea here is that you're going to build a polyhedron that mostly
looks like a cylinder a bit bigger than the cylinder that you're going
to cut, except that the top of this polyhedron is wavy, using your
Bezier curve.

[ And on autopilot I hit Ctrl+Enter and sent the message when I wasn't
ready to... ]

If you have N points in your Bezier curve, you're probably going to have
3N, or maybe 2N+1 faces:

  • Your top surface is a bunch of triangles with their outside vertices
    along the Bezier curve that's wrapped around the cylinder, and the
    inside vertex at the center of the cylinder at some
    middle-of-the-road Z value
  • The shell is a bunch of quadrilaterals with those same outside
    vertices as the top vertices, and the bottom vertices being those
    same X/Y values and Z just below the base of the cylinder to be cut.
  • The bottom surface might be a set of triangles similar to the top
    surface, but all with that same just-below-the-base Z value, or
    maybe you can do it as one big N-gon.

Doing this is a bit intricate, but isn't all that hard once you get
the pattern down.  Mostly it's a bunch of list comprehensions, and some
light trigonometry to walk around the circumference of the cylinder-like
polyhedron that you're constructing.

On 4/23/2021 4:17 PM, Jordan Brown wrote: > On 4/23/2021 4:03 PM, Sayandeep Khan wrote: >> ­How can we extract such faces from a shell given some conditions? > > I'd be happy to cook up a demonstration, but I don't have time right now. > > Here's the basic theory... > > Have you looked at how you build a polyhedron?  You define a bunch of > points, and then you connect groups of those points into faces that > all add up to being the polyhedron. > > The idea here is that you're going to build a polyhedron that mostly > looks like a cylinder a bit bigger than the cylinder that you're going > to cut, except that the top of this polyhedron is wavy, using your > Bezier curve. [ And on autopilot I hit Ctrl+Enter and sent the message when I wasn't ready to... ] If you have N points in your Bezier curve, you're probably going to have 3*N, or maybe 2*N+1 faces: * Your top surface is a bunch of triangles with their outside vertices along the Bezier curve that's wrapped around the cylinder, and the inside vertex at the center of the cylinder at some middle-of-the-road Z value * The shell is a bunch of quadrilaterals with those same outside vertices as the top vertices, and the bottom vertices being those same X/Y values and Z just below the base of the cylinder to be cut. * The bottom surface might be a set of triangles similar to the top surface, but all with that same just-below-the-base Z value, or maybe you can do it as one big N-gon. Doing this is a bit intricate, but isn't all that *hard* once you get the pattern down.  Mostly it's a bunch of list comprehensions, and some light trigonometry to walk around the circumference of the cylinder-like polyhedron that you're constructing.