# Metaball and Bounding Box

## Recommended Posts

Is it possible and how, if possible, to calculate a bounding box of the metaball? bbox(...) function returns incorrect result.

According to my logic if metaball has a radius equal to 1, bbox(...) must return 2. Everything appears otherwise in practice.

Maybe bbox of the metaball is not f(radius) but f(radius, weight, kernel_.function, ..., ...)?

##### Share on other sites
Is it possible and how, if possible, to calculate a bounding box of the metaball? bbox(...) function returns incorrect result.

According to my logic if metaball has a radius equal to 1, bbox(...) must return 2. Everything appears otherwise in practice.

Maybe bbox of the metaball is not f(radius) but f(radius, weight, kernel_.function, ..., ...)?

14413[/snapback]

I assume your second guess is right, though I cannot tell for sure either.

Somewhat it depends on what you're looking for: Usually you'll most likely want the bounding box of a whole set of metaballs. If this is the case, just get the max extensions of the points you copied the metaballs onto and add the radius twice.

If you want to take into account the actual volume that gets shaded / the metaball surface encloses depending on the metaball type, weight etc. you'll have to evaluate the actual function. As far as I understand metaballs the kernel function is responsible for the "density falloff". I assume that the function always has got a value of 1 in the center and fades as it moves closer it's radius. Changing the radius won't do anything to that function so in the end it's only like a multiplicator (the density in the middle will stay 1). The weight is the multiplier of center of the density).

When creating the surface that encloses the metaball you set some kinda trash value usually in the range of 0 to 1, and the algorithm reponsible for the creation of the surface finds the isovalue curves/surfaces of that trashold value. With the kernel function given this should be fairly easy actually for a single metaball, however for multiple overlapping metaballs this gets more tricky obviously (rather more tedious). You'd have to write all the positions of your metalballs into an array, sort them by increasing x/y/z values and find the lowest / highest x/y/z value where you actually hit your trashhold value. Those min/max values would make up the bounding box.

Unfortunally I don't know the kernel function, but maybe someone else does. Btw, out of intrest, what for do you need it ?!

Jens

##### Share on other sites

I want to get the size_of_the_converted_to_polygons_metaball or group of metaballs, or group of the objects_of_any_type + group_of_metaballs.

For the purposes of my BBX Align SOP.

http://www.sidefx.com/exchange/info.php?fi...5&versionid=125

I can use one trick - convert all data from second input to polygons and calculate the bounding box. But...

## Create an account

Register a new account