Stream: brlcad

Topic: metaballs


view this post on Zulip Sean (Jan 14 2022 at 07:21):

@Erik can I scratch your brain? I'm looking at the metaballs implementation and am wondering why you "fluffed" up the ISO method, why you're squaring the field strength instead of using a simple falloff curve (i.e., it's using f^2/r^2 instead of f/r^2)

view this post on Zulip Sean (Jan 14 2022 at 07:26):

looks like you changed it mid-development:

    fluff up the isopotential method a bit... back to the old way, kinda

    svn:revision:30487
    svn:branch:trunk
    svn:account:erikgreenwald

diff --git a/src/librt/g_metaball.c b/src/librt/g_metaball.c
index 9649859e7f..4918318cf0 100644
--- a/src/librt/g_metaball.c
+++ b/src/librt/g_metaball.c
@@ -67,6 +67,8 @@
 #define METABALL_ISOPOTENTIAL  1
 #define METABALL_BLOB          2

+#define PLOT_THE_BIG_BOUNDING_SPHERE 0
+
 const char *metaballnames[] =
 {
     "Metaball",
@@ -128,7 +130,7 @@ fastf_t rt_metaball_get_bounding_sphere(point_t *center, fastf_t threshold, stru
                fastf_t additive;
                VSUB2(d, mbpt2->coord, mbpt->coord);
                mag = MAGNITUDE(d) + dist;
-               additive = (mbpt2->fldstr*mbpt2->fldstr) / mag;
+               additive = fabs(mbpt2->fldstr) * mbpt2->fldstr / mag;
                dist += additive;
            }
        /* then see if this is a 'defining' point */
@@ -238,7 +240,7 @@ rt_metaball_point_value_iso(point_t *p, struct bu_list *points)

     for (BU_LIST_FOR(mbpt, wdb_metaballpt, points)) {
        VSUB2(v, mbpt->coord, *p);
-       ret += mbpt->fldstr / MAGSQ(v); /* f/r^2 */
+       ret += fabs(mbpt->fldstr) * mbpt->fldstr / MAGSQ(v);    /* f/r^2 */
     }
     return ret;
 }
@@ -352,7 +354,7 @@ rt_metaball_norm(register struct hit *hitp, struct soltab *stp, register struct
            for (BU_LIST_FOR(mbpt, wdb_metaballpt, &mb->metaball_ctrl_head)) {
                VSUB2(v, hitp->hit_point, mbpt->coord);
                a = MAGSQ(v);
-               VJOIN1(hitp->hit_normal, hitp->hit_normal, mbpt->fldstr / (a*a), v);    /* f/r^4 */
+               VJOIN1(hitp->hit_normal, hitp->hit_normal, fabs(mbpt->fldstr)*mbpt->fldstr / (a*a), v); /* f/r^4 */
            }
            break;
        case METABALL_BLOB:

view this post on Zulip Sean (Jan 14 2022 at 07:30):

I was working on an animation with it, and ran into some issues. trying to get a smooth transition. method 2 (blob) appears to have a clipping bug: anim.gif method 1 works better (iso) but then it's not quite what I'm going for. method 0 (metaball) appears to be unimplemented.

view this post on Zulip Erik (Jan 14 2022 at 11:19):

iirc, there were a couple different field strength algortithms, I think I stubbed in 3 and impl'd 2? I'd expect your animation to have a bulge that travels along the toroid segment, it's an odd anim... there was a 'tokyo' one that was the paper one, but the one modelled on electric field charge seemed to fit the requirement better iirc... been a hot minute and I've done a think or two since :)

view this post on Zulip Erik (Jan 14 2022 at 11:24):

yeah, there they are, 'metaball', 'isopotential', and 'blob', I think blob was more of a visual experimentation thing and I didn't do the tokyo one, heh

view this post on Zulip Erik (Jan 14 2022 at 11:29):

um, f^2/r^2 ... um... I don't recall. I think there was a weird mathy reason (since we're looking at them in isolation, we 'pair' them to create the delta to eigenvalue off of or something to get the ^2), ir it could be a straight up bug that just happened to look better with my inputs :) "fix" it and see what happens? iso should work for visualizing an electrical or gravitational isosurface for a test reference?

view this post on Zulip Erik (Jan 14 2022 at 11:33):

I don't think the tokyo paper fit the problem domain of the requesting party particularly well, Lee proposed it and we pounded a square peg into a round hole, I think

view this post on Zulip scorp08 (Aug 09 2024 at 07:13):

hello, are there any paper of blast engineering calculations with brlcad metaballs? I checked some journals , generally sdof physics involved, did not see any project used a raytracer for calculations

view this post on Zulip Sean (Aug 10 2024 at 16:02):

@scorp08 BRL-CAD metaballs were implemented specifically for blast methodology, but I'm not aware of any papers that are available to the public on the blast calculations. I believe there are some papers in DTIC.


Last updated: Oct 09 2024 at 00:44 UTC