1
$\begingroup$

This is a basic example of how 2 circles would come together:

enter image description here

A more complex example would be an arbitrarily shaped polygon like a country on earth, merging with another one or a circle. All of the edges would have to somehow attach to the circle as you move the circle around, so it feels like it's adhering together like liquid.

Wondering if there are standard equations for doing this, or how it is done.

$\endgroup$
0

2 Answers 2

0
$\begingroup$

The idea of metaball is to treat two circles as objects with mass centered in the middle, calculate at every discrete point (canvas) forces from every circle below threshokd radius (otherwise every point is taken to equation, which drastically increases complexity), and then use another threshold for blending, used per pixel. Optionally with blur afterwards. It works fine for non-isovolumetric computation. If you prefer splines over polygons, one way to do it is: https://pdfs.semanticscholar.org/54d2/61fd778f25cec19060c3fdbaea7a15d14834.pdf

If you require isovolumetric one, use navier-stokes, iterative finite element method.

As for specified polygons, there are two ways:
Use circle or ellipse to contain polygon, use standard metaball algorithm (with elliptic detransform to circle if needed) and then perform mapping from circle (ellipse) to new shape. It will look nice and involve standard tools, but may not be accurate.

Another way is to treat every vertex as separate circle that interacts only with second shape.

If you do not want to create mapping, you may use Bézier patch with "texture" like here: http://hpcg.purdue.edu/papers/Malkova10VisComp.pdf

For reference: Metaballs and marching squares, Metabals as SVG vectors and CSS

$\endgroup$
0
$\begingroup$

The Povray raytracer has an object like this, the blob. You find its code with some explanations at https://github.com/POV-Ray/povray/blob/master/source/core/shape/blob.cpp .

$\endgroup$
2
  • 3
    $\begingroup$ Welcome to Computer Science. The implementation you linked to is interesting, but rather involved. Could you summarize the approach used there and edit it in your answer? Thanks! Also note that we generally expect good answers to stand on their own, such that they remain useful even when all resources they link at are no longer available. $\endgroup$
    – Discrete lizard
    Jan 18, 2019 at 16:28
  • $\begingroup$ I have to admit, that I don't understand the code documentation very well. Here is a better description: povray.org/documentation/view/3.6.0/275 It reads similar to Evil's answer. I hope this helps. Otherwise I'd like to delete my answer; how can I do this? $\endgroup$ Jan 25, 2019 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.