# [OpenSCAD] Discuss manifoldness, co-incident faces edges etc

Sun Nov 17 16:28:53 EST 2019

```Speaking mathematically (not having to do with computer representations):

A manifold is a surface that looks like a plane everywhere, so if you zoom
in close enough to any point of the manifold, it looks like a flat plane.
Classic examples include the sphere, and the torus.  Note that the manifold
just includes the points on the surface.  So when I say the 2-sphere, the
points on the inside of the sphere are NOT included.  An orientable manifold
(the only kind we care about) will divide 3-dimensional space into two
regions, which we can call the interior and exterior

If a surface intersects itself then at the points of intersection, it will
not look like a plane.  It will be impossible to find a continuous mapping
(homeomorphism) between a neighborhood of the self-intersection and a part
of the Euclidean 2-dimensional plane.   No matter how much you zoom in,
you'll still have a more complicated structure.  Such a surface is therefore
not a manifold.   A non-manifold surface may not define an interior and
exterior in a simple fashion.  Consider what happens if you draw a
self-intersecting curve on the page and try to decide what is interior and
exterior defined by this 1-manifold you have drawn.

Note that being or not being a manifold is a global property, characteristic
of the whole object.  If EVERY point of the surface meets the condition of
"looking like" a plane locally then it is a manifold.  Otherwise (if there
exists somewhere, even just a single point failing the test) then it is not
a manifold.  It makes no sense to talk of a surface "not being a manifold at
this edge".

The case of two cubes sharing an edge is not a manifold because at points on
the edge where they meet, you cannot map the object to a plane.  Now
considering a question of representation, I could imagine a representation
in which the four faces that meet at the intersecting edge are not all
connected to each other by the topological information.  If the topological
connection data only says that the two pairs of outside faces are connected
and doesn't indicate any other connections, then this representation will
describe something which is a manifold, even though it wouldn't be a
manifold if you embedded it as an unstructured set in 3-space.   (Imagine
drawing an 8 where you don't cross in the middle, but bounce off the center
point.)  I don't know if this case is relevant to the discussion (which I
have not been following) but it's an example of how representation could
play a role in deciding whether you consider something a manifold or not.
Note that mathematically, manifolds need not have anything to do with
3-dimensional space, they don't have to be embedded in it.  The Klein Bottle
is a famous example of an object that is a 2-manifold but cannot exist in
3-space.

If you cut out a square from a sphere and then reverse its edge order (a
common polyhedron() error) and glue the reversed square back in the
resulting object *IS* mathematically a manifold, even though it is invalid
in OpenSCAD (and probably all CAD programs).  It is a manifold that cannot
be embedded in 3-space---it is a nonorientable manifold. So actually the
requirements for CAD are more strict than simply the objects must be
2-manifolds.

> So are two cubes meeting at an edge a 2-manifold?
>
> Before this discussion I thought definitely not. People seem to imply it
> is
> but only in file representations that keep two separate edges that are
> actually coincident.
>
> I have always thought that self intersections made an object not
> 2-manifold. People seem to imply that is only if the representation is a
> polygon soup. Is a mesh with self intersections 2-manifold if it comes
> with
> edge connection info but the same geometric shape without edge connection
> info not? I am confused because I thought a manifold referred to a
> geometric object not how it is represented on a computer.
>
> If OpenSCAD used a PolySet representation with edges would it not matter
> if
> the vertices where truncated and physically in the wrong place?
>
>
>
> On Sun, 17 Nov 2019 at 19:58, adrianv <

> avm4@

> > wrote:
>
>> cacb wrote
>> > Ok, but in practice we determine manifoldness for an edge by counting
>> > how many faces refer to it. That's what we are talking about, and in
>> > this case having 4 faces referring to an edge is not a problem.
>>
>> "Manifoldness of an edge"?  All edges are 1-manifolds...unless they have
>> end
>> points.   A given object either is a 2-manifold or is not.  If somewhere
>> on
>> the object, N faces meet at an edge where N is not 2 then the object is
>> not
>> a 2 manifold.  Note that if you construct 3-manifolds by sticking
>> together
>> tetrahedra then the condition is the same: if two tetrahedra meet at a
>> face
>> then everything is good and you have a valid 3-manifold.  But if the
>> number
>> of tetrahedra that meet at a face is not two then the resulting object is
>> not a 3-manifold.  The magic of the number 2 (as the number of faces that
>> meet at an edge) is not that we are trying to make 2-manifolds, but that
>> dividing an object in half creates two halves.   Similarly if you go to
>> the
>> 1-d case then the non-manifold figure 8 has four segments meeting at a
>> point
>> whereas a valid 1-manifold will always have two segments meet at a point.
>>
>> I suggest that using terminology correctly, or devising and clearly
>> laying
>> out new terminology as needed, is better than abusing existing
>> terminology
>> to mean something completely different than what it actually customarily
>> means.  If people are confused about what a 2-manifold is already, using
>> the
>> terminology incorrectly isn't going to help.  It could really confuse
>> somebody who doesn't know what a 2-manifold is and thinks your use has
>> something to do with the customary meaning of the term.  It sounds like
>> you
>> want to talk about the face count of an edge, perhaps, the number of
>> faces
>> meeting at an edge.
>>
>>
>>
>>
>> --
>>
>> _______________________________________________
>>

>>
>
> _______________________________________________