This is a 2d demo of the medial surface algorithm. The full 3d algorithm displays an implicit surface. The 2d demo displays an implicit line.
The algorithm is a variant of standard metaball techniques. The medial surface is the surface where the metaball field from one group of objects equals the metaball field from a second group of objects. We explain first the standard metaballs, then the medial surface.
The demo is based on a metasurface from four 'spheres' (circles really). The surfaces of the full 3d implementation are lines in this 2d demo, but we mostly still use the 'surface' terminology below. We first see the four spheres as separate coloured circles [!justsphere!].
Each sphere has an influence field, 1 at the surface of the sphere and reducing to 0 at a given distance from the sphere. With the spheres apart we can see the fields (as contours) but they have no influence on each other [!noinfluence!]. The surface of each sphere is shown by a white contour.
Many metaball implementation use fields that extend to infinity, for example inverse square of exponential decay. We use a field with a defined cutoff so that a recursive subdivision implementation can easily cull spheres. This demo does not use such techniques, but we still use our standard field function.
As the spheres get closer the fields start to influence each other [!lowinfluence!]. However, they are not close enough that the sphere surfaces are affected. The colour is blended according to the amount of influence of each sphere at the given point. Most of the area is still coloured using the pure sphere colours.
Closer still [!influence!] and the white sphere surfaces are starting to distort (above) and merge (below). They all merge in the final view [!highinfluence!], the pale yellow giving a 2d slice of a characteristic metaball surface.
The medial surface is based around two opposing fields that cancel out. The top pair of spheres now have negative fields (blue colouring), while the lower pair still have positive fields (red/yellow colouring). As they are initially well separated, they have no influence on each other [!negativeapart!].
As the spheres get closer [!negativetouch!] the fields of influence just begin to touch. The area with contrasting colour shows where both groups have equal influence; but does not cover the vast background area where they have equal but zero influence.
Again, as we bring them closer [!negativeclose!] the field interactions get more interesting, and the medial intersection line (medial surface in 3d) gets longer. This trend continues, closer [!negativecloser!] and closest [!negativeclosest!].The field and medial surface/line may be shown in one of two ways, which you can toggle here.
You can click here choose between a flat contour representation and a height field representation. Dragging outside the sphere influence in the height field representation allows change of camera view.
You can also interact with the positions of the spheres by dragging. This works better in the flat view. Picking not right in heightmap version; for now you must pick at the base of the centre of the object.
Choose any of the configurations above as a starting point and experiment.
Currently confusion on scroll wheel between zooming, info scrolling and extending influence.
We will later add interactions for the radius of the spheres, the relative strengths of their fields and their range of influence.