Metaballs
From Math Images
Metaballs |
---|
Metaballs
- Metaballs are a visualization of a level set of an n-dimensional function
Contents |
Basic Description
To visualize a 2D field of metaballs, one can loop through every pixel on the screen and sum the value of each metaball at the current pixel. If this value is greater than or equal to some thresholding value, then the pixel is colored.A More Mathematical Explanation
Let . A typical function chosen for a metaball at location U [...]
Let . A typical function chosen for a metaball at location is .
The following is pseudocode to render a 2D field of metaballs:
for y from 0 to height for x from 0 to width sum := 0; foreach metaball in metaballs sum := sum + 1.0 / ( ( x - metaball.x0 )^2 + ( y - metaball.y0 )^2 ); if sum >= threshold then colorPixel( x, y );
Alternatively, any function of the form can be used, with higher values of k causing the metaballs to take on the shape of a square.
Demonstration
At the top half of the applet the metaballs are visible. The graph at the bottom corresponds to the a cross section of the metaball field at the red line in the top half.
Teaching Materials
- There are currently no teaching materials for this page. Add teaching materials.
Leave a message on the discussion page by clicking the 'discussion' tab at the top of this image page.