discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

I'm still confused about Manifold

SL
Steve Lelievre
Fri, Mar 22, 2024 7:50 PM

I realize the topic of what makes a shape manifold or not has been
discussed here many times, but I'm still a bit confused.

As I understand it (or misunderstand it), for a shape to be manifold
every edge should be connected to two faces and those faces should be
non-zero in area. This code:

$fn = 10;
difference() {
  cylinder(r = 3, h = 3);
    translate([0, 0, 1]) cylinder(r1 = 0, r2 = 2, h = 2);
}

seems to comply but OpenSCAD tells me "WARNING: PolySet -> Manifold
conversion failed: NotManifold. Trying to repair and reconstruct mesh." 
If I turn off the 'stop after first warning' option, it figures it out
and happily completes the render - but why does it need to resort to the
fallback method?

Windows 10 with Dev Snapshot 2024.03.22

Cheers,

Steve

I realize the topic of what makes a shape manifold or not has been discussed here many times, but I'm still a bit confused. As I understand it (or misunderstand it), for a shape to be manifold every edge should be connected to two faces and those faces should be non-zero in area. This code: $fn = 10; difference() {   cylinder(r = 3, h = 3);     translate([0, 0, 1]) cylinder(r1 = 0, r2 = 2, h = 2); } seems to comply but OpenSCAD tells me "WARNING: PolySet -> Manifold conversion failed: NotManifold. Trying to repair and reconstruct mesh."  If I turn off the 'stop after first warning' option, it figures it out and happily completes the render - but why does it need to resort to the fallback method? Windows 10 with Dev Snapshot 2024.03.22 Cheers, Steve
NH
nop head
Fri, Mar 22, 2024 10:00 PM

I don't get any warning with the version I am using: version 2024.01.26
(git 358af340c), so it looks like a regression.

Compiling design (CSG Tree generation)...

Compiling design (CSG Products generation)...

Geometries in cache: 4

Geometry cache size in bytes: 5344

CGAL Polyhedrons in cache: 0

CGAL cache size in bytes: 0

Compiling design (CSG Products normalization)...

Normalized tree has 2 elements!

Compile and preview finished.

Total rendering time: 0:00:00.030

You could try making the cone a little bit taller than the cylinder to see
if that gets rid of the warning. Coincident surfaces can cause problems.

On Fri, 22 Mar 2024 at 19:51, Steve Lelievre via Discuss <
discuss@lists.openscad.org> wrote:

I realize the topic of what makes a shape manifold or not has been
discussed here many times, but I'm still a bit confused.

As I understand it (or misunderstand it), for a shape to be manifold
every edge should be connected to two faces and those faces should be
non-zero in area. This code:

$fn = 10;
difference() {
cylinder(r = 3, h = 3);
translate([0, 0, 1]) cylinder(r1 = 0, r2 = 2, h = 2);
}

seems to comply but OpenSCAD tells me "WARNING: PolySet -> Manifold
conversion failed: NotManifold. Trying to repair and reconstruct mesh."
If I turn off the 'stop after first warning' option, it figures it out
and happily completes the render - but why does it need to resort to the
fallback method?

Windows 10 with Dev Snapshot 2024.03.22

Cheers,

Steve


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

I don't get any warning with the version I am using: version 2024.01.26 (git 358af340c), so it looks like a regression. Compiling design (CSG Tree generation)... Compiling design (CSG Products generation)... Geometries in cache: 4 Geometry cache size in bytes: 5344 CGAL Polyhedrons in cache: 0 CGAL cache size in bytes: 0 Compiling design (CSG Products normalization)... Normalized tree has 2 elements! Compile and preview finished. Total rendering time: 0:00:00.030 You could try making the cone a little bit taller than the cylinder to see if that gets rid of the warning. Coincident surfaces can cause problems. On Fri, 22 Mar 2024 at 19:51, Steve Lelievre via Discuss < discuss@lists.openscad.org> wrote: > I realize the topic of what makes a shape manifold or not has been > discussed here many times, but I'm still a bit confused. > > As I understand it (or misunderstand it), for a shape to be manifold > every edge should be connected to two faces and those faces should be > non-zero in area. This code: > > > $fn = 10; > difference() { > cylinder(r = 3, h = 3); > translate([0, 0, 1]) cylinder(r1 = 0, r2 = 2, h = 2); > } > > > seems to comply but OpenSCAD tells me "WARNING: PolySet -> Manifold > conversion failed: NotManifold. Trying to repair and reconstruct mesh." > If I turn off the 'stop after first warning' option, it figures it out > and happily completes the render - but why does it need to resort to the > fallback method? > > Windows 10 with Dev Snapshot 2024.03.22 > > Cheers, > > Steve > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
LH
Lenore Horner
Fri, Mar 22, 2024 10:08 PM

I would expect a problem with this because the top of your cut-out is flush with the top of the cylinder it cuts from.  Try making the cut-out ever so slightly taller or higher.
Cheers,
Lenore

On Mar 22, 2024, at 15:50, Steve Lelievre via Discuss discuss@lists.openscad.org wrote:

I realize the topic of what makes a shape manifold or not has been discussed here many times, but I'm still a bit confused.

As I understand it (or misunderstand it), for a shape to be manifold every edge should be connected to two faces and those faces should be non-zero in area. This code:

$fn = 10;
difference() {
cylinder(r = 3, h = 3);
translate([0, 0, 1]) cylinder(r1 = 0, r2 = 2, h = 2);
}

seems to comply but OpenSCAD tells me "WARNING: PolySet -> Manifold conversion failed: NotManifold. Trying to repair and reconstruct mesh."  If I turn off the 'stop after first warning' option, it figures it out and happily completes the render - but why does it need to resort to the fallback method?

Windows 10 with Dev Snapshot 2024.03.22

Cheers,

Steve


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

I would expect a problem with this because the top of your cut-out is flush with the top of the cylinder it cuts from. Try making the cut-out ever so slightly taller or higher. Cheers, Lenore > On Mar 22, 2024, at 15:50, Steve Lelievre via Discuss <discuss@lists.openscad.org> wrote: > > I realize the topic of what makes a shape manifold or not has been discussed here many times, but I'm still a bit confused. > > As I understand it (or misunderstand it), for a shape to be manifold every edge should be connected to two faces and those faces should be non-zero in area. This code: > > > $fn = 10; > difference() { > cylinder(r = 3, h = 3); > translate([0, 0, 1]) cylinder(r1 = 0, r2 = 2, h = 2); > } > > > seems to comply but OpenSCAD tells me "WARNING: PolySet -> Manifold conversion failed: NotManifold. Trying to repair and reconstruct mesh." If I turn off the 'stop after first warning' option, it figures it out and happily completes the render - but why does it need to resort to the fallback method? > > Windows 10 with Dev Snapshot 2024.03.22 > > Cheers, > > Steve > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
RD
Revar Desmera
Fri, Mar 22, 2024 11:04 PM

On Mar 22, 2024, at 12:51 PM, Steve Lelievre via Discuss discuss@lists.openscad.org wrote:

As I understand it (or misunderstand it), for a shape to be manifold every edge should be connected to two faces and those faces should be non-zero in area.

Also, no two faces should intersect, and no two faces should overlap on the same plane.

OpenSCAD, notably, is known to occasionally leave infinitely thin cleavages in its output when subtracting shapes that have coinciding faces, thus violating the last requirement. This is caused by either a bug or a floating point rounding error in the various libraries that OpenSCAD can use to process its boolean shape operations.

Solution: make sure the shapes you difference away are bigger than the shape you are subtracting from.

-Revar

> On Mar 22, 2024, at 12:51 PM, Steve Lelievre via Discuss <discuss@lists.openscad.org> wrote: > > As I understand it (or misunderstand it), for a shape to be manifold every edge should be connected to two faces and those faces should be non-zero in area. Also, no two faces should intersect, and no two faces should overlap on the same plane. OpenSCAD, notably, is known to occasionally leave infinitely thin cleavages in its output when subtracting shapes that have coinciding faces, thus violating the last requirement. This is caused by either a bug or a floating point rounding error in the various libraries that OpenSCAD can use to process its boolean shape operations. Solution: make sure the shapes you difference away are bigger than the shape you are subtracting from. -Revar
NH
nop head
Fri, Mar 22, 2024 11:07 PM

Although in this case the dimensions are all integers, so the faces are
exactly coincident, a situation CGAL would handle correctly.

On Fri, 22 Mar 2024 at 23:05, Revar Desmera via Discuss <
discuss@lists.openscad.org> wrote:

On Mar 22, 2024, at 12:51 PM, Steve Lelievre via Discuss <

As I understand it (or misunderstand it), for a shape to be manifold

every edge should be connected to two faces and those faces should be
non-zero in area.

Also, no two faces should intersect, and no two faces should overlap on
the same plane.

OpenSCAD, notably, is known to occasionally leave infinitely thin
cleavages in its output when subtracting shapes that have coinciding faces,
thus violating the last requirement. This is caused by either a bug or a
floating point rounding error in the various libraries that OpenSCAD can
use to process its boolean shape operations.

Solution: make sure the shapes you difference away are bigger than the
shape you are subtracting from.

-Revar


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

Although in this case the dimensions are all integers, so the faces are exactly coincident, a situation CGAL would handle correctly. On Fri, 22 Mar 2024 at 23:05, Revar Desmera via Discuss < discuss@lists.openscad.org> wrote: > > > On Mar 22, 2024, at 12:51 PM, Steve Lelievre via Discuss < > discuss@lists.openscad.org> wrote: > > > > As I understand it (or misunderstand it), for a shape to be manifold > every edge should be connected to two faces and those faces should be > non-zero in area. > > Also, no two faces should intersect, and no two faces should overlap on > the same plane. > > OpenSCAD, notably, is known to occasionally leave infinitely thin > cleavages in its output when subtracting shapes that have coinciding faces, > thus violating the last requirement. This is caused by either a bug or a > floating point rounding error in the various libraries that OpenSCAD can > use to process its boolean shape operations. > > Solution: make sure the shapes you difference away are bigger than the > shape you are subtracting from. > > -Revar > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
SL
Steve Lelievre
Fri, Mar 22, 2024 11:10 PM

Thanks for the reply.

For sure, I can tinker with the design but actually my question was
intended to be about what makes it appear non-manifold to the software. So
for example in terms of the reply, why (computationally)would oversizing
the cutout make the problem go away?

Steve

On Fri, 22 Mar 2024 at 15:08, Lenore Horner via Discuss <
discuss@lists.openscad.org> wrote:

I would expect a problem with this because the top of your cut-out is
flush with the top of the cylinder it cuts from.  Try making the cut-out
ever so slightly taller or higher.
Cheers,
Lenore

On Mar 22, 2024, at 15:50, Steve Lelievre via Discuss <

I realize the topic of what makes a shape manifold or not has been

discussed here many times, but I'm still a bit confused.

As I understand it (or misunderstand it), for a shape to be manifold

every edge should be connected to two faces and those faces should be
non-zero in area. This code:

$fn = 10;
difference() {
cylinder(r = 3, h = 3);
translate([0, 0, 1]) cylinder(r1 = 0, r2 = 2, h = 2);
}

seems to comply but OpenSCAD tells me "WARNING: PolySet -> Manifold

conversion failed: NotManifold. Trying to repair and reconstruct mesh."  If
I turn off the 'stop after first warning' option, it figures it out and
happily completes the render - but why does it need to resort to the
fallback method?

Windows 10 with Dev Snapshot 2024.03.22

Cheers,

Steve


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

Thanks for the reply. For sure, I can tinker with the design but actually my question was intended to be about what makes it appear non-manifold to the software. So for example in terms of the reply, why (computationally)would oversizing the cutout make the problem go away? Steve On Fri, 22 Mar 2024 at 15:08, Lenore Horner via Discuss < discuss@lists.openscad.org> wrote: > I would expect a problem with this because the top of your cut-out is > flush with the top of the cylinder it cuts from. Try making the cut-out > ever so slightly taller or higher. > Cheers, > Lenore > > > On Mar 22, 2024, at 15:50, Steve Lelievre via Discuss < > discuss@lists.openscad.org> wrote: > > > > I realize the topic of what makes a shape manifold or not has been > discussed here many times, but I'm still a bit confused. > > > > As I understand it (or misunderstand it), for a shape to be manifold > every edge should be connected to two faces and those faces should be > non-zero in area. This code: > > > > > > $fn = 10; > > difference() { > > cylinder(r = 3, h = 3); > > translate([0, 0, 1]) cylinder(r1 = 0, r2 = 2, h = 2); > > } > > > > > > seems to comply but OpenSCAD tells me "WARNING: PolySet -> Manifold > conversion failed: NotManifold. Trying to repair and reconstruct mesh." If > I turn off the 'stop after first warning' option, it figures it out and > happily completes the render - but why does it need to resort to the > fallback method? > > > > Windows 10 with Dev Snapshot 2024.03.22 > > > > Cheers, > > > > Steve > > > > > > _______________________________________________ > > 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 >
LH
Lenore Horner
Fri, Mar 22, 2024 11:50 PM

As I understand it, it's the coincident faces that are a problem.  From the point of view of the cylinder, that surface has an outward normal pointing +z.  From the point of view of the removed cone, that same surface should have a normal of -z (- because subtracting is putting stuff outside the shape and nothingness inside). I think that's were the software loses it.    (Though someone else says for integers it shouldn't actually get confused.  In which case, I don't know.)
Lenore

On Mar 22, 2024, at 19:10, Steve Lelievre via Discuss discuss@lists.openscad.org wrote:

Thanks for the reply.

For sure, I can tinker with the design but actually my question was intended to be about what makes it appear non-manifold to the software. So for example in terms of the reply, why (computationally)would oversizing the cutout make the problem go away?

Steve

On Fri, 22 Mar 2024 at 15:08, Lenore Horner via Discuss <discuss@lists.openscad.org mailto:discuss@lists.openscad.org> wrote:

I would expect a problem with this because the top of your cut-out is flush with the top of the cylinder it cuts from.  Try making the cut-out ever so slightly taller or higher.
Cheers,
Lenore

On Mar 22, 2024, at 15:50, Steve Lelievre via Discuss <discuss@lists.openscad.org mailto:discuss@lists.openscad.org> wrote:

I realize the topic of what makes a shape manifold or not has been discussed here many times, but I'm still a bit confused.

As I understand it (or misunderstand it), for a shape to be manifold every edge should be connected to two faces and those faces should be non-zero in area. This code:

$fn = 10;
difference() {
cylinder(r = 3, h = 3);
translate([0, 0, 1]) cylinder(r1 = 0, r2 = 2, h = 2);
}

seems to comply but OpenSCAD tells me "WARNING: PolySet -> Manifold conversion failed: NotManifold. Trying to repair and reconstruct mesh."  If I turn off the 'stop after first warning' option, it figures it out and happily completes the render - but why does it need to resort to the fallback method?

Windows 10 with Dev Snapshot 2024.03.22

Cheers,

Steve


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


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


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

As I understand it, it's the coincident faces that are a problem. From the point of view of the cylinder, that surface has an outward normal pointing +z. From the point of view of the removed cone, that same surface should have a normal of -z (- because subtracting is putting stuff outside the shape and nothingness inside). I think that's were the software loses it. (Though someone else says for integers it shouldn't actually get confused. In which case, I don't know.) Lenore > On Mar 22, 2024, at 19:10, Steve Lelievre via Discuss <discuss@lists.openscad.org> wrote: > > Thanks for the reply. > > For sure, I can tinker with the design but actually my question was intended to be about what makes it appear non-manifold to the software. So for example in terms of the reply, why (computationally)would oversizing the cutout make the problem go away? > > Steve > > > > On Fri, 22 Mar 2024 at 15:08, Lenore Horner via Discuss <discuss@lists.openscad.org <mailto:discuss@lists.openscad.org>> wrote: >> I would expect a problem with this because the top of your cut-out is flush with the top of the cylinder it cuts from. Try making the cut-out ever so slightly taller or higher. >> Cheers, >> Lenore >> >> > On Mar 22, 2024, at 15:50, Steve Lelievre via Discuss <discuss@lists.openscad.org <mailto:discuss@lists.openscad.org>> wrote: >> > >> > I realize the topic of what makes a shape manifold or not has been discussed here many times, but I'm still a bit confused. >> > >> > As I understand it (or misunderstand it), for a shape to be manifold every edge should be connected to two faces and those faces should be non-zero in area. This code: >> > >> > >> > $fn = 10; >> > difference() { >> > cylinder(r = 3, h = 3); >> > translate([0, 0, 1]) cylinder(r1 = 0, r2 = 2, h = 2); >> > } >> > >> > >> > seems to comply but OpenSCAD tells me "WARNING: PolySet -> Manifold conversion failed: NotManifold. Trying to repair and reconstruct mesh." If I turn off the 'stop after first warning' option, it figures it out and happily completes the render - but why does it need to resort to the fallback method? >> > >> > Windows 10 with Dev Snapshot 2024.03.22 >> > >> > Cheers, >> > >> > Steve >> > >> > >> > _______________________________________________ >> > OpenSCAD mailing list >> > To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
MK
Marius Kintel
Sat, Mar 23, 2024 1:19 AM

seems to comply but OpenSCAD tells me "WARNING: PolySet -> Manifold conversion failed: NotManifold. Trying to repair and reconstruct mesh."  If I turn off the 'stop after first warning' option, it figures it out and happily completes the render - but why does it need to resort to the fallback method?

This doesn’t sounds right. The only PolySet -> Manifold conversions going on here should be the primitives.
I suspect you found an actual bug.
This code is in active development, so it’s prone to breaking from time to time, and we don’t yet have good tests for situations where we use fallback mechanisms like this.

I’ll look into it and open an issue or PR if I find or fix something.

-Marius

> seems to comply but OpenSCAD tells me "WARNING: PolySet -> Manifold conversion failed: NotManifold. Trying to repair and reconstruct mesh." If I turn off the 'stop after first warning' option, it figures it out and happily completes the render - but why does it need to resort to the fallback method? > This doesn’t sounds right. The only PolySet -> Manifold conversions going on here should be the primitives. I suspect you found an actual bug. This code is in active development, so it’s prone to breaking from time to time, and we don’t yet have good tests for situations where we use fallback mechanisms like this. I’ll look into it and open an issue or PR if I find or fix something. -Marius
SL
Steve Lelievre
Sat, Mar 23, 2024 2:51 AM

On 2024-03-22 6:19 p.m., Marius Kintel wrote:

I’ll look into it and open an issue or PR if I find or fix something.

Thank you, and in case it helps: I have found that setting the r1
parameter of the cutaway cone to a tiny non-zero value leads to the
render happening on the first attempt.

Steve

On 2024-03-22 6:19 p.m., Marius Kintel wrote: > I’ll look into it and open an issue or PR if I find or fix something. Thank you, and in case it helps: I have found that setting the r1 parameter of the cutaway cone to a tiny non-zero value leads to the render happening on the first attempt. Steve
MK
Marius Kintel
Sat, Mar 23, 2024 3:48 AM

Fixed in https://github.com/openscad/openscad/pull/5062

Our old cone generator was a bit sloppy, something that the new Manifold check picked up on.

On Mar 22, 2024, at 22:51, Steve Lelievre steve.lelievre.canada@gmail.com wrote:

On 2024-03-22 6:19 p.m., Marius Kintel wrote:

I’ll look into it and open an issue or PR if I find or fix something.

Thank you, and in case it helps: I have found that setting the r1 parameter of the cutaway cone to a tiny non-zero value leads to the render happening on the first attempt.

Steve

Fixed in https://github.com/openscad/openscad/pull/5062 Our old cone generator was a bit sloppy, something that the new Manifold check picked up on. > On Mar 22, 2024, at 22:51, Steve Lelievre <steve.lelievre.canada@gmail.com> wrote: > > > On 2024-03-22 6:19 p.m., Marius Kintel wrote: >> >> I’ll look into it and open an issue or PR if I find or fix something. > > Thank you, and in case it helps: I have found that setting the r1 parameter of the cutaway cone to a tiny non-zero value leads to the render happening on the first attempt. > > Steve > > >