TubeBuilder

interface TubeBuilder

Helps Worm determine how points in pairs of paths are joined to form a tube between the two shapes.

The result is an ordered list of connections from a to b.

If we draw the points of path a and path b in a line like so : Note a0 and b0 are shown twice, because the structure loops back round to the beginning.

a0   a1   a2   a3   a4   a5   a0

b0   b1   b2   b3   b4   b0

Then the goal is to draw lines, so that all points a joined to form triangles e.g.

a0   a1   a2   a3   a4   a5   a0
|  /  | / |  \ |  / |  \ |  /
b0   b1   b2   b3   b4   b0

In this example the result is : 0->0, 1->0, 1->1, 2->1, 2->2, 2->3, 3-3, 4->3, 4->4, 4->0, 5->0

The last line on the diagram is a repeat of the first line (and is therefore omitted from the results).

The first part of the pair in an index into a's points list, and the second is an index into b's points list.

Note that the list must be ordered by Pair.first, then Pair.second.

Also note that it is okay for the indices to be >= points.size, as Worm will use the modulus operator, so the last entries can be 4->5, 5->5 (instead of 4->0, 5->0)

Inheritors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract fun join(a: Path2d, b: Path2d): List<Pair<Int, Int>>