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

Doug Moen doug at moens.org
Fri Nov 15 07:42:21 EST 2019


We are now discussing how shape operators (like union) should deal with properties (like colour) that vary over space.

In Curv, which is my own 3D solid modelling language, I have a general answer to these questions.

Curv supports full colour models. Curv supports *volumetric* colour. A colour function assigns a colour to every point on the surface and within the interior of a 2D or 3D shape. I chose this model because it works for advanced 3D printers, like the Stratasys J750, that are capable of assigning different colour and material properties to each voxel of a 3D solid.

For the `union` operator, I chose the "painters algorithm" to determine the colour of the output. The order of the arguments to union matters. First we "paint" the first shape onto the "canvas", then we "paint" the second shape, which overrides the colours of the first shape wherever they overlap, and so on. It is a very intuitive model when you work in 2D, and 3D works the same way.

The `intersection` operator is different. I regard the first argument to be the "base" shape, and all of the colours of the output come from this base shape. Subsequent arguments are interpreted as specifying what parts of the base shape to carve away. Since Curv has volumetric colour, not surface colour, carving away parts of the base shape reveal colours under the surface that might not be visible on the surface. For example, I have a "wood grain" colour function, and a "marble" colour function, that simulate the 3D colour distribution of these natural materials. Using difference or intersection to carve away parts of an object has the same visual result as carving wood or marble.

For the case of sweeping a 2D object along a path in 3-space, with possible self-intersection, my model is based on the idea of a paint brush moving over a canvas, where the shape of the brush and the colour of the paint may change as the brush moves, and using opaque paint. You could also call this "painters algorithm", it's conceptually related to how union works. The path that we sweep along is specified by a function that maps a parameter 't' onto a point in 3-space. Let's say that 't' varies from 0 to 1. We begin the sweep at t=0, and we end the sweep at t=1. If there is a self intersection at t=i and t=j, where i < j, then the colours at j override the colours at i.

For the case of sweeping a 3D object along a path in 3-space, I have no idea how to apply the painters algorithm to this situation. My only idea is to apply a single colour function to the final result. I don't find these kinds of sweeps interesting or useful for my own work, so I haven't tried to develop this further.

The final problem is positive offsets, where you are growing the object by adding a constant offset from the surface. For a non-convex shape, different branches of the shape can self-intersect as the shape grows. There is no obvious concept of ordering here, where one branch of the shape is later than or comes after any other branch, so it's not clear how painters algorithm would apply. So I don't do that. Instead, I rely on the colour function that is attached to the shape, which assigns a different colour to each point in 3 dimensional space. As the shape grows, it occupies new points in space that it didn't previously occupy, and the colour function is consulted to determine the colour of those new points. This analogous to what happens when you carve away parts of a shape using difference or intersection, except happening in reverse.



More information about the Discuss mailing list