# Edit Edit an Image Page: Metaballs

To create an image page, simply complete the form below and then hit the 'Save Page' button at the bottom of the form. As you complete the form, remember that one of the main goals of the Math Images Project is to provide explanations of the images on our site at various levels, so that everyone can understand some of the math behind the images. Try to complete the form as fully as possible, but remember that other users will have the opportunity to add more information to your image pages in the future. Also, please note that by contributing to the Math Images Project, you agree to comply to the guidelines as stated in our general disclaimer.

As always, thank you for your contributions! --The Math Images Project

If you need help filling out this page, please consult our Help sections: Want to Contribute and Math Resources.

Note: * Indicates a required field.

Please note: When you are filling in the below explanations, you should feel free to use standard wikitext.

 Image Title*: Upload a Math Image Metaballs are a visualization of a [[level set]] of an n-dimensional function 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. Let $x, x_{0} \in R^{n}$. A typical function chosen for a metaball at location $x_{0}$ is $f(x)=\frac{1}{\parallel x - x_{0} \parallel ^{2}}$. 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 $f(x)=\frac{1}{\parallel x - x_{0} \parallel ^{2k}}$ 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. Algebra Analysis Calculus Dynamic Systems Fractals Geometry Graph Theory Number Theory Polyhedra Topology Other None Algebra Analysis Calculus Dynamic Systems Fractals Geometry Graph Theory Number Theory Polyhedra Topology Other None Algebra Analysis Calculus Dynamic Systems Fractals Geometry Graph Theory Number Theory Polyhedra Topology Other Yes, it is.