Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Even triangles

The question. What is wrong with the triangles of an atlas surface, and how is a surface rebuilt with triangles of one size without changing its shape?

Every body of the simulator starts as a closed surface of triangles from the anatomy atlas (A muscle from its surface). Those triangles were made for the eye. The chapters of this part are about what happens where two surfaces meet, and there the triangles matter: contact is tested at the corners and middles of the triangles (Tissues that touch), the direction a surface pushes is the direction its triangles face, and anything read between the corners is read across a triangle. This chapter measures how uneven the atlas’s triangles are and rebuilds them.

By the end you will be able to say how deep a neighbour can sink between two tested points, count the triangles a surface needs at a given edge length, name the four operations that make triangles even, and say what rebuilding keeps and what it loses.

Slivers and long edges

Look closely at the surface of the long head of the biceps as the atlas gives it. It has 1,416 triangles. Half of them are thin: their smallest corner is under 10°, and four in five have a smallest corner under 20°. The median edge, longer than one half of the edges and shorter than the other, is 6 mm long, but the longest is 48 mm. (The surface is the one the tissue arm uses: the atlas’s triangles, with the belly narrowed across its length to the muscle’s measured volume, 70.9 cm³, as The whole arm in three dimensions describes. The narrowing moves corners but adds and removes none.) A triangle with one very small angle is called a sliver: two of its corners lie close together and the third far away. The other atlas muscles of the arm are the same: in the four studied, 45 to 54 % of the triangles have a smallest angle under 10°, and the longest edges run from 34 to 106 mm (measurements made on the atlas surfaces, Data and model files).

This matters in three ways.

  1. Contact sees only points. A surface point that is not tested cannot be pushed. Two corners 49 mm apart, with no other point between them, leave a span of surface that a neighbour can enter freely.
  2. A sliver’s direction is unreliable. The direction a triangle faces, its normal, is the cross product of two of its sides, divided by its length (Vectors). When two corners nearly coincide, one of those sides is tiny, and a small move of one corner turns the normal through a large angle.
  3. What is read across a triangle is read from its corners. A value such as a pressure is known at the corners and taken in between as a weighted mean of the three. Across a sliver the mean is dominated by the two close corners, and the far one is barely felt.

How deep a neighbour can sink

Take two tested points a distance apart on a flat surface, and press a round neighbour of radius against the span between them. It touches neither point until it has sunk to a depth at the middle. Its edge passes through both points, so by Pythagoras, with the centre straight above the middle,

In words: a round body of radius can sink between two points apart by about the square of the gap divided by eight times the radius, unseen. This is the sag of a chord of length on a circle of radius , the same number that the chapter on contact found standing a brick’s straight edge off a ball. The last form holds when is small beside .

Even triangles

The cure is to rebuild the surface so that every triangle is nearly equilateral, with sides of nearly one length , the target edge length. This is isotropic remeshing: “isotropic” because the triangles are the same in every direction. A mesh of equilateral triangles has six triangles round every corner, so the number of edges at a corner, its valence, is six.

Before rebuilding, count what is needed. An equilateral triangle of side has area . A surface of area therefore needs about

triangles. In words: the area of the surface divided by the area of one equilateral triangle of the target side. Halve and four times as many are needed.

The rebuilding repeats one iteration of five passes (Botsch and Kobbelt 2004 is the paper that names the method; it was not read for this book, and the steps are stated as they are commonly given and as a permissively licensed implementation gives them, the PMP library):

  1. Split every edge longer than at its middle, making two triangles of each of the two triangles that share it. This is an edge split.
  2. Collapse every edge shorter than : its two ends are merged into one corner at its middle (or at the end that lies on a feature loop or a tip, of which below), and the two triangles that shared it disappear. This is an edge collapse. It is refused when it would leave an edge longer than , turn a triangle over (its normal turned by more than 60°), or join two parts of the surface that touch only at the edge’s ends.
  3. Flip: two triangles that share an edge form a four-sided patch, and the shared edge is one of its two diagonals. An edge flip replaces it by the other diagonal when that brings the valences of the four corners nearer to six.
  4. Smooth: each corner moves towards the mean position of its neighbours, but only along the surface. The part of the move along the corner’s normal is taken away. This is tangential smoothing.
  5. Project: each corner is put back on the nearest point of the original surface.

Between the two thresholds lies a band, from 3.2 to 5.3 mm for a target of 4 mm, in which an edge is left alone. A collapse that would make an edge longer than the band is refused, so collapsing does not undo the splitting.

Why projecting keeps the shape. Whatever the first four passes do to the triangles, at the end of every iteration each corner lies on the surface it started from. The new surface is then made of flat triangles with their corners on the old one, and it cannot stand off the old one by more than the sag of its own triangles: about where the surface curves with radius . A surface that curves more tightly than its triangles can follow is not kept: a cord 5 mm across, drawn with triangles of 8 mm, cannot be drawn at all.

Tips. Smoothing moves a corner towards its neighbours, which rounds off a point such as the end of a tendon. Round a corner of a flat surface its triangles’ angles add up to 360°. Where they add up to less than 300° the surface comes to a point there, and the corner is kept where it is.

Keeping the attachments

Some patches of a muscle’s surface are special: its attachment areas, where the muscle is fixed to a bone. They were chosen by rule, from the parts of the surface that lie within 2 mm of the bone (Tissue pulling on bone); here an attachment’s patch is made of the triangles whose three corners all belong to it. A remeshing that moves the edge of such a patch changes the area the muscle pulls through.

The remedy is to mark the boundary of each patch. Its edges are feature edges, and the closed chain they make round the patch is a feature loop. A feature edge is never flipped and never collapsed; a long one is split at its middle, which lies on the loop already. A corner on a loop is never moved or removed. So the loop stays exactly where it was, only with more corners along it. The price is that the loop’s own short edges stay short, and the triangles beside them may stay thin.

A worked example

Rebuild the long head of the biceps with a target edge of 4 mm. Its surface has an area of 170.5 cm², or 17,050 mm².

QuantityCalculationResult
Area of one equilateral triangle of side 4 mm6.93 mm²
Triangles neededabout 2,460
An edge is split above5.33 mm
An edge is collapsed below3.2 mm
Depth a ball of radius 40 mm can sink between points 47.6 mm apart7.9 mm
The same between points 9.0 mm apart0.26 mm
Sag of a 4 mm chord across the widest part of the belly, radius 13.6 mm0.15 mm

The 13.6 mm is the radius of a circle of the same area as the belly’s largest cross-section, 578 mm² (measured on the surface, square to the line from origin to insertion). After five iterations the laboratory’s surface has 2,328 triangles, within 6 % of the count, its longest edge is 9.0 mm, so a ball of the size of the last chapter’s can sink no more than about a quarter of a millimetre between two of its points, and the whole surface would have to move out by 0.152 mm to give back the volume it lost: close to the sag of a 4 mm chord across the belly.

Try it: even triangles on the long head of the biceps

The surface is drawn along its length, the shoulder end at the left. Triangles whose smallest angle is under 20° are highlighted, and the three attachments are drawn in the colour of tendon: the origin on the scapula at the left, the insertion on the radius at the right, and the long patch held to the humerus. The surface is rebuilt whenever a control is changed; press Play to watch the iterations one after another, from the atlas surface on.

  1. Check the worked example. With a target of 4 mm, five iterations and the attachments kept, the surface has 2,328 triangles and 1,164 corners. The median edge is 4.06 mm and the longest 9.04 mm. The median smallest angle is 52.2°, and only 1.7 % of the triangles have a smallest angle under 20°, where the atlas had 80.1 %. No part of either surface is more than 3.10 mm from the other. The volume has fallen by 3.4 %, and an offset of the whole surface by 0.152 mm would restore it.
  2. One iteration at a time. Set the iterations to 1. The first iteration splits far more than it collapses: 5,238 triangles, with a median edge of 3.08 mm and 24.4 % still under 20°. By the fifth the count has fallen to 2,328, and ten iterations change little more: 2,240 triangles and 1.96 % under 20°. The plot on the right shows the share of thin triangles falling iteration by iteration.
  3. Predict, then check: let the attachments go. Set the iterations back to 5 and choose “free to move”. With the loops kept, the origin’s patch lost 2.8 % of its area, the insertion’s 11.3 % and the long patch on the humerus 4.9 %, all because their insides were rebuilt. What happens when the loops are free? The triangles get better, only 0.36 % under 20°, because the loops’ short edges are no longer protected. But the insertion, a patch of 16.6 mm², no longer has a single triangle over it, the origin’s patch loses 86 % and the patch on the humerus 12 %.
  4. Coarser triangles. Keep the attachments, and set the target to 8 mm. The surface has only 646 triangles, but it has lost 11.8 % of its volume and lies up to 5.3 mm from the atlas: the tendons at the two ends, a few millimetres across, cannot be drawn with triangles of 8 mm and are flattened.
  5. Finer triangles. Set the target to 3 mm. There are 4,160 triangles, the volume falls by only 2.0 % and the greatest distance is 2.45 mm, a little less than the 3.10 mm at 4 mm. The thin tendons at the two ends still ask for finer triangles than that, more than a laboratory can rebuild while you wait.

Check against measurement

There is nothing measured to compare a remeshed surface with but the atlas surface it came from, and that comparison is the laboratory’s: the greatest distance between the two, the change of volume and the areas of the attachments. The count of triangles was checked above against the arithmetic of equilateral triangles, and the rebuilding was checked on a ball drawn with slivers at its poles: every corner of the rebuilt ball lies on the old surface, so no nearer the centre than the old facets’ sag allows; its volume is no more than the ball’s and short of it by no more than its own triangles’ sag allows; and its thin triangles are gone.

What this model leaves out

  • The simulator’s own bodies. The bodies of the arm are built from the atlas’s own triangles, not from rebuilt ones. Everything in this chapter is about one surface, rebuilt on its own.
  • Features smaller than a triangle. A tendon narrower than the target is flattened. The cure is a target that changes over the surface, finer where it curves tightly, which this method does not do.
  • Features smaller than a brick. Even triangles do not change the lattice the surface is embedded in: a groove or a tendon narrower than a brick still moves with the brick (A muscle from its surface).
  • The volume. Rebuilding loses some volume, here 3.3 %. The offset that would restore it is reported, not applied.
  • Testing whole surfaces. Even triangles make the tested points evenly spaced, but they are still points. Testing the whole surface between them is the next chapter’s subject.

Summary

  • The atlas’s triangles are uneven: on the long head of the biceps half have a smallest angle under 10° and the longest edge is 48 mm. A round neighbour of radius can sink about between two tested points apart.
  • A surface of area needs about equilateral triangles of side .
  • Isotropic remeshing repeats five passes: split edges longer than , collapse edges shorter than , flip edges towards valence six, smooth along the surface, and project back onto the original surface. Projecting keeps the shape to within the sag of the new triangles.
  • Attachments are kept by marking their boundaries as feature loops whose corners never move.
  • At 4 mm the long head of the biceps becomes 2,328 triangles, 1.7 % of them thin, within 3.10 mm of the atlas, with 3.4 % less volume.

Next: even triangles still meet a neighbour only at their points. Surfaces that touch everywhere tests the surface between them.