Meshes that follow the muscle
The question. How are bricks cut that follow the muscle’s own shape, and how is each brick checked before the solver is given it?
The lattice of A muscle from its surface is the same for every body: cubes in rows, the muscle laid over them and each cut cube weighted by how much of it is inside. Nothing has to be fitted, which is its strength. Its weakness is that a part of the muscle thinner than a cube, such as a tendon or a groove, rides inside cubes that it does not fill and moves as they move. Bricks whose faces follow the muscle’s outline and its coordinates have no cut bricks and no hidden parts; their price is that each must be built, and a badly built brick ruins a solve.
By the end you will be able to build a mesh of bricks from a swept muscle and count its bricks by hand, say why the simplest way of doing so fails along the axis, and test a brick for validity in a way that corner checks cannot match.
Bricks from muscle coordinates
The bricks of the chapter on elements are eight-cornered: any eight corners, with the trilinear weights carrying every point of the unit cube to a point of the brick. A mesh whose bricks fill a body exactly, edge to edge with its outline, is a conforming mesh.
A swept muscle gives one directly. At a number of stations along its axis, divide each section into four-sided cells, the same way at every station; join each cell to the matching cell at the next station, and each pair of cells is a brick. The muscle coordinates of the last chapter are then the bricks’ own coordinates: runs from station to station, and the cells of each section are a grid in the other two.
Dividing a section: two ways
The polar grid. Draw lines from the centre of the section straight out to points spaced round its outline, and cut each line into equal steps. The cells between neighbouring lines are four-sided everywhere except next to the centre, where two of their corners are the centre itself. This is what happens when a solid is made by shrinking a muscle’s surface onto its centre line, as one early study of muscle did (Zhou & Lu 2005). Every brick of the innermost layer has a whole face shrunk to the axis. At those corners two edges of the brick have no length, the columns of its Jacobian along them vanish, and its Jacobian determinant is zero.
The O-grid. Put a square in the middle of the section, divided into cells. Divide each of its four sides into steps, and run a straight line from each point of the square’s edge out to the outline in the same direction from the centre; cut each line into equal steps. The section is then the square and four blocks round it, each of cells, and no cell touches a point where lines meet from every side. It is named for the ring of blocks round the middle.
Worked by hand: counting the bricks
Take an O-grid with cells round the outline, so , and layers out to it, with 35 layers along the muscle.
| Quantity | Calculation | Result |
|---|---|---|
| Cells in the square | 4 | |
| Cells in the four blocks | 16 | |
| Bricks in each layer | 20 | |
| Bricks in the muscle | 700 | |
| Corners in each section | 25 | |
| Corners in the muscle | 900 |
On the long head of the biceps, fitted with four harmonics and ten control values (A muscle from a few numbers), those 700 bricks are 6 to 8 mm across in the belly. A lattice of 5 mm cubes laid over the same fitted surface has 1,329 cubes, nearly twice as many, of which most are cut.
Judging a brick by its Jacobian
A brick is valid where its Jacobian determinant is positive (Coordinates that live in the muscle). Two numbers are commonly checked at its eight corners. The corner determinant is there. The scaled Jacobian is the corner determinant divided by the lengths of the three edges that meet at the corner: 1 at the corner of a cube, 0 where the corner is squashed flat, below 0 where it is turned inside out. For the O-grid on a round section the worst corners are where the square’s corners meet the outer blocks: there the edges meet at 135°, and the scaled Jacobian is .
Is a brick valid if all eight corners pass? Not always. Each column of a trilinear brick’s Jacobian changes linearly along two of the cube’s directions and not at all along the third, so , a sum of products of one entry from each column, can be a quadratic in each direction. A quadratic can dip below zero between two positive ends. The brick whose corners are those of the unit cube with corner 0 moved to , corner 4 to , corner 5 to and corner 6 to (corner of the unit cube sits at the point whose three coordinates are the binary digits of , the lowest digit first) has a determinant of at least at all eight corners and of halfway along the edge from corner 0 to corner 4.
A test that cannot be fooled writes the determinant in the Bernstein basis. In one direction, the three quadratics , and are never negative between 0 and 1 and add up to 1 there. Any quadratic is a mix of them, and the numbers it is mixed with are its Bernstein coefficients. From the values , , :
In words: the end coefficients are the end values, and the middle one is how far the middle value stands above the average of the ends, doubled, plus that average. In three directions there are 27 coefficients, found from at the 27 points with coordinates 0, ½ and 1. Since the weights are never negative and add up to 1, the determinant at every point is a weighted mean of the 27 coefficients, and can never be below the smallest of them. If all 27 are positive, the brick is valid everywhere inside it. That rule is one of the proved properties; a brick that passes it is certified. A brick that fails it may still be valid, since the bound is not always reached, but cannot be trusted without a closer look.
The brick of the counterexample fails it: its smallest coefficient is negative.
Try it: meshing a muscle
The skin of the mesh is coloured by the scaled Jacobian of each brick, and the cells of the section are drawn at the first station and in the middle.
- Check the worked example. The default O-grid on the long head has 20 bricks in each layer, 700 bricks and 900 corners. The lattice of 5 mm cubes on the same surface has 1,329.
- Find the bad bricks. Ten of the 700 bricks have a corner where the Jacobian is zero or below, and the smallest scaled Jacobian is −0.98. All ten are in the last layer, at the elbow end, where the fitted section has shrunk to a mean radius of 0.6 mm and its radius dips below zero in some directions. The other 690 are certified. The worst ratio of largest to smallest determinant inside one of the good bricks is 120: the thin tendon and the thick belly are cut into the same number of cells.
- Predict, then check. Choose the polar grid. How many bricks should touch the axis? Every brick of the innermost layer: 8 round times 35 along, 280. The laboratory counts 285 with a bad corner: the 280 on the axis and five more.
- A shape with nothing to hide. Choose the test body, the oval of A muscle from a few numbers. Every one of its 700 O-grid bricks is certified, and the smallest scaled Jacobian is 0.707, the corners of the square. The polar grid again has 280 bricks with a corner on the axis.
- Straight lines cut corners. With the default grid, the bricks of the test body hold 48.88 cm³, where the swept shape holds 55.98 cm³: the outline is followed by eight straight segments. Set 32 cells round and 4 layers out: the bricks now hold 1 % less than the swept shape, in bricks. Refining round the outline is where the mesh earns its volume.
Where meshes come from
The O-grid here is built by the simulator’s own code from the swept shape’s numbers, so it can be built again exactly from those numbers. Many other mesh generators exist, and some are free to use under licences that do not allow their code to be joined to this simulator’s. The project’s rule is this:
- Tools under licences that would extend themselves to the simulator if linked to it, such as the AGPL of TetGen (TetGen), are only ever run as separate programs, offline. Their output may be kept with the project.
- Tools with licences compatible with the simulator’s own are preferred: for example fTetWild, under the MPL (fTetWild), or the remeshing code of the PMP and Geogram libraries, under the MIT and BSD licences (PMP, Geogram).
- Every mesh kept is made by a recorded pipeline: the script, the tool and its version, the settings and the input files, so that anyone can make it again.
What this model leaves out
- Solving on these bricks. The simulator’s brick element accepts any eight corners, but the arm’s muscles are still solved on the lattice; no muscle has yet been solved on an O-grid, and the comparison at equal numbers of unknowns has not been run.
- Bending in thin bricks. A brick of eight corners stiffens when it bends and is thin, which the volume treatment of Tissue keeps its volume does not cure.
- Grading along the muscle. The stations are equally spaced, so a thin tendon gets as many cells as the belly; spacing them by the section’s size would spread the work better and remove the worst bricks at the ends.
- Attachments and neighbours. Bricks that follow one muscle do not follow the next one, nor the bone. How such meshes are tied to each other and to the bone is not built here.
- Muscles that are not tubes. Brachialis needs a block of bricks lying on the bone, built from the block parametrisation of Coordinates that live in the muscle.
Summary
- A swept muscle gives a conforming mesh: each section divided into cells the same way at every station, each cell joined to the next station’s.
- The polar grid shrinks a face of every innermost brick to the axis, where the Jacobian is zero; the O-grid puts a square in the middle and avoids it.
- An O-grid with a square of cells and layers round it has bricks a layer: 700 for the long head with and 35 layers, against 1,329 lattice cubes of 5 mm.
- Positive Jacobians at the eight corners do not prove a brick valid; positive Bernstein coefficients, all 27 of them, do.
- On the fitted long head, 690 of 700 bricks are certified; the other ten are at the elbow end, where the fitted section has nearly vanished.
Next: the part is complete. The arm, piece by piece gathers the muscles, tendons and bones into one arm.