Metaballs

From Math Images

Jump to: navigation, search


Metaballs
Field: Calculus
Image Created By: [[Author:| ]]

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 x, x_{0} \in R^{n}. A typical function chosen for a metaball at location U [...]

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.

If you can see this message, you do not have the Java software required to view the applet.




Teaching Materials

There are currently no teaching materials for this page. Add teaching materials.









If you are able, please consider adding to or editing this page!

Have questions about the image or the explanations on this page?
Leave a message on the discussion page by clicking the 'discussion' tab at the top of this image page.
[[Category:]]






Personal tools