(Using Blender 3.6.8)
Reseach Progress Report
The reported approach, yet incomplete, shows promising results.
This figure illustrates identified "backbone" curves for characters of varying complexity, using a Curve to Mesh node with a Curve Circle profile.
Approach
The detection of the backbone of a character relies on the distance to the curves defining its outline. It is observed that this distance grows linearly along the local line perpendicular to the outlining curve for each point along this curve. Rotating such a line built in the (X,Y) plane along the local tangent to the curve by 45 degrees defines the steepest path toward the ridge where lies the searched backbone.
Edges sampled along the outlining curve are extruded "at 45 degrees" to build faces to intersect. The same way, points are sampled along the outlining curve and a Raycast node is used to compute the intersection along the ray rotated "at 45 degrees". Because these sampled points are connected in a Mesh Line, the resulting intersection defines a list of connected edges, that are afterwards converted to a curve.
This figure illustrates the process for the "O" character. The original curves are divided in four "rims" which are extruded inwards "at 45 degrees". Adjacent faces of same colour belong to the same rim. Each rim is also sampled with points that are shifted along rays "rotated at 45 degrees" until intersecting opposite faces. Intersections are identified with cubes. To avoid self-intersection, the configuration is duplicated along the Z axis, with the faces associated to one single rim deleted per copy.
GeometryNodes modifier overview
(NB :The following pictures are illustrating intermediate results, without intent to be fully descriptive.)
Main graph
1. The Rim group node is splitting the original curves in "rims" connecting two adjacent control points.
2. The Extrude Rim group node is building the faces to intersect from the previously identified rims.
3. The Corner group node is storing data about each control point, including its two adjacent rims and it is computing the bisector between.
4. The Extrude Corner group node is building the faces to intersect for concave corners.
5. The Intersect group node is computing the intersection from rays emitted by sampling the rims, with the faces built previously.
6. One list of connected edges per rim is produced. No filtering is applied at this time.
Identifying the rims
1. Rim data are stored in a "table" (as a Grid) with two columns (along X axis), one per end, and with as many rows (along Y axis) as pairs of adjacent control points. It is assumed that curves are cyclic.
2. In this table, only edges connecting ends (i.e. aligned with X axis) are kept. So data stored per rim (i.e. per edge) are safely transferred to ends (i.e. points).
3. The Rim Left and Rim Right group nodes are retrieving data from the original curve control points to define both ends. In particular, position, tangent vector and factor are stored.
4. Strait rims are detected by checking aligned tangents and connecting segment. These are tagged with type Vector (i.e. 2), following the handle types nomenclature.
Building from the rims the faces to intersect
1. The Rake group node is uniformly sampling each rim. Samples are stored as a Mesh Line to preserve connectivity between adjacent points. Linear interpolation in (X,Y) is used for strait rims. For curved rims, the factor is interpolated, then a Sample Curve node is used to recover the local position and tangent.
2. The achieved edges are extruded along the Z axis. Then the Top vertices are moved by rotation, around the local tangent, of the vector connecting them to the curve. This is how the "extrusion at 45 degrees" is achieved.
3. It is to notice on the picture above that "gaps" are remaining between extruded patches when the angle between adjacent rim tangents is larger than 180 degrees (e.g. between red and green faces at mid-height junction).
Computing the bisectors
1. Corner data are stored in a Point Cloud, one point per original curve control point.
2. From the left and right handles, the bisector at each corner is computed.
3. It is to notice that tangents are usually aligned at the junction with curved rims, leading to a singular case for the bisector algebra. For this special case, the bisector is recovered by rotation of the unitary vector along Z axis around the local tangent, by 45 degrees.
4. Corners with angle between left and right handles larger than 180 degrees are tagged as "concave".
Building from the concave corners the faces to intersect
1. It is observed that the "distance from a point" function level set is a cone of 45 degrees half-angle, i.e. with Depth equal to Radius Top.
2. As a corner is shared by two adjacent rims, only a half-cone is kept, requiring an even number of Vertices.
3. The achieved faces are slightly shifted along the Z axis to avoid self-intersection with cone apex.
4. Half-cones are instanced at each concave corner.
5. The half-cone X axis is aligned with the bisector direction vector projected in the (X,Y) plane.
6. It is to notice on the picture above some failure at the junction between the two outer curves. Two cones are almost superimposed, with a full pink one. This is because two control points are very close there ; these should have been merged beforehand.
Computing the intersections
1. Let $N$ be the number of rims. There are $N \times (N-1)$ combinations of two different rims to intersect.
2. To compute the intersection of rim of index $i$ with all rims of index $j$ such that $j \neq i$, the extruded faces are duplicated $N$ times along the Z axis. This yields $N \times N$ combinations. Then for the $i^\textrm{th}$ copy, faces belonging to rim $i$ are deleted to avoid self-intersection. This yields the sought $N \times (N-1)$ combinations.
3. Afterwards edges belonging to each rim $i$ are shifted along the Z axis to the "height" of the $i^\textrm{th}$ copy.
1. A Raycast node is used to compute the intersection. The Source Position is set to the position of points sampled along a rim. The Ray Direction is recovered by rotation of the unitary vector along Z axis around the local tangent, by 45 degrees.
2. The figure above illustrates the process for the first two rims of character "B". Cubes are instanced at the Hit Position to visualise intersections. Black strait lines are drawn only to visualise rays ; these are not involved in computing the intersection (Mesh Boolean node is not used).
1. This figure illustrates one of the most complex configuration that will require further research.
2. A single rim is intersecting two different curved rims (in yellow and blue, from left to right). Between, it is intersecting the cone from a concave corner (in pink).
3. So this rim yields at most three pieces of curve along the backbone. Ends should be computed to refine the junction between these adjacent pieces of curve.
4. An other improvement could be in removing the part along the cone, to keep only two pieces of curve.
Perspectives
- Merge by distance control points from the original curves that are too close together ; these yield near singular cases easier to remove than to solve.
- Remove duplicated backbones from the same both intersecting rims.
- From a very dense sampling of backbones, identify underlying curves (in particular strait ones) to reduce as much as possible the number of final control points.
- Remove curves connecting the backbone to the outlining curves.
- Identify crossings of strait curves to remove the portion along extruded cones (from concave corners) and to bridge gaps.
- Investigate the singularity of the dot character (.).
Resources