Lines Derivative: show the center lines of a flat contour

Show the critical points of the distance map of a flat contour

5 min read
In the app
  • LinesLines Derivative

Lines Derivative shows the critical points of the distance map of the selected line. It builds a distance map around the contour and marks the places where the nearest point of the contour jumps from one part of the line to another. These places are equally far from two parts of the contour, so together the points trace the center lines between the walls of the contour, inside and outside it.

The tool is on the Lines tab, next to Lines Info.

What it is for

Lines Derivative is a way to look at the shape of a flat contour, not a modeling step: it shows its center lines (the medial axis, or skeleton) and, by the height of the points, how wide the shape is at each place. The height of every point is its distance to the nearest point of the contour, which is the radius of the largest circle around that point that does not cross the contour. Use it to:

  • Find the center line of a stroke, wall or groove. In a letter outline or in a section of a wall, the points run along the middle of each stroke or wall, so you see where a path along the middle would go.
  • Find narrow and wide places. On a center line, the height of the points is about half the local width. Low parts of a ridge show where a wall is thin or a gap is tight; the highest point inside a closed contour is the center of the largest circle that fits in it.

The Lines tab of MeshInspector with Lines Derivative and the conversion tools Lines to Distance Map, Lines to Mesh, Lines to Points and Lines to Voxels.

Show the critical points

  1. Select exactly one polyline object in the Scene tree. The tool works with flat contours: it uses the X and Y coordinates of the line and ignores Z.
  2. Click Lines › Lines Derivative.
  3. Set Pixel Size and Distance Threshold.
  4. Click Get Lines Critical points (or press Enter).

MeshInspector covers the rectangle around the line with a grid of pixels and finds the nearest point of the line for each pixel. A pixel becomes a critical point when the nearest point of the line differs from that of a neighbor pixel by more than Distance Threshold. Each point is placed above the XY plane at a height equal to its distance from the line, so in a side view the points form ridges, like a roof over the contour.

Critical points found by Lines Derivative with Pixel Size 1 and Distance Threshold 5 mm on a section contour of a CAD housing, top view: white points trace the center lines of the walls and of the open area between them.

The same critical points in a tilted view: each point is raised by its distance from the contour, so the points form ridges above the contour.

The points are temporary. They are not added to the Scene tree, a new click on Get Lines Critical points replaces them, and they disappear when you close the panel.

Settings

Setting What it does Default
Pixel Size The step of the grid. Smaller pixels give more points and a longer calculation. The panel does not allow a value that would give more than about 16.8 million pixels. 0.05, or the smallest allowed value for a large line
Distance Threshold How far apart the nearest points of the line in two neighbor pixels must be for a critical point. 0.1

Default settings

The defaults suit a contour a few units in size. For a part of a few hundred millimeters, a pixel of 0.05 means millions of pixels: start with a larger Pixel Size, for example 1, and make it smaller only if you need more detail.

Smaller values

A smaller Pixel Size places the points closer to each other along the center lines. A smaller Distance Threshold also marks small jumps of the nearest point, so more points appear, for example short branches near the corners of the contour.

Larger values

A larger Pixel Size gives fewer, sparser points and a faster calculation. A larger Distance Threshold keeps only the places where the nearest point jumps far, that is, the main center lines between distant parts of the contour.

Worked example

We checked what the heights mean on simple contours with Pixel Size 0.5 and Distance Threshold 2 mm:

Contour What Lines Derivative showed
Closed rectangle 40 × 10 mm 105 points. Along the middle part, the points form one straight line 0.25 mm from the true center line, at a height of 4.75 mm: half the 10 mm width, minus half a pixel. At the ends, branches go toward the four corners, like the ridge and hips of a roof.
A 40 × 40 mm square with a 10 × 10 mm square hole in the middle 324 points. The highest point is at 8.75 mm, in a corner of the ring: the largest circle that fits between the two outer walls and the inner corner has a radius of 8.79 mm.
Open L-shaped line, legs 30 and 20 mm 38 points along the bisector of the corner, on the inner side, rising from the corner.
One straight segment No points.

The half-pixel difference comes from the grid: the points are pixel centers next to the center line, so a smaller Pixel Size gives heights closer to the exact half width.

Good input and limits

  • Use one flat lines object, for example a section of a part made with Section. The tool uses only the X and Y coordinates, so a line that is not parallel to the XY plane is flattened onto it.
  • Open lines work: points appear wherever two parts of the line face each other. A straight line has no center line, so it gives no points.
  • The grid covers only the rectangle around the line. Center lines outside the contour are shown only inside this rectangle.
  • The points are only for viewing: you cannot click them to read their coordinates, they are not saved, and other tools cannot use them. To compare heights, look at the contour from the side.

Customize Consent Preferences

We use cookies and similar technologies, such as local storage. You will find detailed information about all of them under each consent category below.

To learn more about how Google processes personal information, visit: Google privacy policy

Always Active