FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Simulation, Artificial Life
(Moderator: REAS)
   flight404 magnetic field experiment...
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: flight404 magnetic field experiment...  (Read 3370 times)
lunetta

7200475272004752 WWW Email
flight404 magnetic field experiment...
« on: May 6th, 2004, 7:53pm »

Hello to all
 
flight404 wrote this on another topic...
"I am working on a project that simulates a physics experiment from a  
while back where someone suspended a dish of oil in a magnetic field with the field being stronger at the edges and into it, the wacky  
scientist dropped some magnetic particles of like charge into the dish  
and found that they would organize themselves into a fibonacci spiral,  
blah blah"
 
Just thought interesting to post this link with lots of inspiring information and quicktime footage of the experiment...
http://www.math.smith.edu/~phyllo/Gallery/
 
by the way, the 404 liquid magnetic field applet is fantastic...  
 
flight404

WWW Email
Re: flight404 magnetic field experiment...
« Reply #1 on: May 7th, 2004, 6:41pm »

Thanks for the link.  I hadn't actually seen the experiment video before and it seems I had it all backwards.  I thought the ferro-magnetic oil drops were drawn to the center of the dish, not the edges.  Oh well, mine is more fun anyhow.  
 
 
TomC

WWW
Re: flight404 magnetic field experiment...
« Reply #2 on: May 7th, 2004, 6:52pm »

Warning: geekiness to follow...
 
Scroll down this page for nice ferro-fluid images.
http://www.dansdata.com/magnets.htm
 
Tom.
 
narain


Re: flight404 magnetic field experiment...
« Reply #3 on: May 8th, 2004, 11:47am »

Whoa.
 
That stuff is freaky. Jeez now I really want to play with it.
Though if I get my hands on it, I'll probably never get it off my plates/tabletop/floor/walls.
 
flight404

WWW Email
Re: flight404 magnetic field experiment...
« Reply #4 on: May 10th, 2004, 9:20pm »

Refined 3D version of magnetic particles.
 
http://www.flight404.com/p5/magnets2_3D
 
Click adds a particle. Suggest clicking slowly to see how the particles arrange themselves into recognizable geometric solids.
 
'O' toggles the Orbs on and off
'G' toggles the Gravity lines on and off
'L' toggles the connecting Lines on and off
'A' toggles the problem Axis line on and off
 
Puzzle for those interested in digging through some partially organized and commented code...
 
Make about 10 or so particles. Turn off the Orbs and turn on the Gravity lines and the problem Axis line (press 'O' then 'G' then 'A').  These show the gravity vector effecting each orb.  Notice that the vector lines along the Z axis have wildly fluctuating angles.  I believe I am getting some hopping from -PI to PI and back and this is making the objects flutter like that.
 
If you then make about 50 to 100, you will notice the objects do not like the spherical shape.  They form a sphere pinched at the z axis.  I assume this is due to the Z axis gravity fluctuation.
 
Suggestions on how to rememdy this?
« Last Edit: May 10th, 2004, 10:30pm by flight404 »  
TomC

WWW
Re: flight404 magnetic field experiment...
« Reply #5 on: May 11th, 2004, 11:36am »

I've not unpicked your polar coordinates, rather I've just had a guess at what you were doing and tried the same thing in cartesian coordinates.
 
So where you had:
 
Code:

    gAngle     = findAngle(xGrav,yGrav,x,y);
    gDist      = findDistance(xGrav,yGrav,x,y);
    gZAngle    = turnAngle(gZAngle, findAngle(0,zGrav,gDist,z));
    gZAngle    = findAngle(0,zGrav,gDist,z);
    
    gxv        = cos(gAngle) * gravity;
    gyv        = sin(gAngle) * gravity;
    gzv        = sin(gZAngle) * gravity;
 
    xv        += gxv;
    yv        += gyv;
    zv        += gzv;
 

 
I put:
 
Code:

 
    // the 3D distance to the gravity source
    gDist = findDistance(xGrav,yGrav,zGrav,x,y,z);
 
    // not sure this is necessary, but it should avoid a stray div by zero
    if (gDist > 0.01) {
      gxv   = gravity * (xGrav - x) / gDist;
      gyv   = gravity * (yGrav - y) / gDist;
      gzv   = gravity * (zGrav - z) / gDist;
 
      xv        += gxv;
      yv        += gyv;
      zv        += gzv;
    }
 

 
And where you had
 
Code:

        Angle         = findAngle(x, y, particle[i].x, particle[i].y);
 
        xv           += cos(Angle) * A;
        yv           += sin(Angle) * A;
        
        ZAngle        = findAngle(0, z, tempR, particle[i].z);
        zv           += sin(ZAngle) * A;

 
I put:
 
Code:

        // R is 3D distance from this particle to particle[i], already calculated
        if (R > 0.01) {
          xv           += A * (x - particle[i].x) / R;
          yv           += A * (y - particle[i].y) / R;
          zv           += A * (z - particle[i].z) / R;
        }

 
That stops your z-axis flickering problem, but now it looks like particles are settling on top of each other.
 
Hope that helps, anyway.  If you're not sure what the changes I've made are doing, just ask
 
« Last Edit: May 11th, 2004, 11:37am by TomC »  
flight404

WWW Email
Re: flight404 magnetic field experiment...
« Reply #6 on: May 11th, 2004, 6:16pm »

I could kiss you!
 
Switching back to cartesian even fixed the broken Pauli Exclusion force.   Now the particles never overlap.
 
Will post a more robust version later in the afternoon.
 
r
 
 
UPDATE---------------
here is the working final
 
http://www.flight404.com/p5/magnets3_3D
« Last Edit: May 11th, 2004, 7:09pm by flight404 »  
miked


Re: flight404 magnetic field experiment...
« Reply #7 on: May 11th, 2004, 7:54pm »

Well done!  
 
I did something like this for TEAL a couple of years ago, but yours looks much cooler.
 
http://web.mit.edu/8.02T/www/802TEAL3D/visualizations/electrostatics/Tra p/trap.htm (note this is a Shockwave simulation)
 
What I find interesting about these studies (as you've noted), the whole idea of "order from chaos".  An initially "chaotic" system (ie. when you shoot particles in randomly) seeks to minimize it's energy, settling in to energetically stable states (even more interesting, if you play with these carefully you might notice that there are often more than one stable state for any given energy configuration (ie. number of particles)).  And we're not just whistling Dixie here... this is exactly how molecules form in real life!  This is how we get to enjoy life as solid objects, rather than living as an ever-undulating cloud of electrons and protons.
 
Ah, I love simulations!  Good work!
 
-mike
 
flight404

WWW Email
Re: flight404 magnetic field experiment...
« Reply #8 on: May 12th, 2004, 12:37am »

How wonderfully complex that shockwave experiment is.  But yes, in complete agreement.  There is something quite satisfying about throwing 13 particles into a simulation and finding that they 'want' to form an icosahedron.  Made a stroby mitosis-style version.
 
http://www.flight404.com/p5/molecules_1/
 
fun fun fun.  Now to simply find a way to get it to work with Sonia.  
 
r
 
TomC

WWW
Re: flight404 magnetic field experiment...
« Reply #9 on: May 12th, 2004, 12:48am »

Congrats Rob, both versions look stunning.
 
The one with the field image runs respectably at 1280x1024 here too (the brightnessToAlpha technique is lovely, BTW)... I wonder if anyone got any closer to a Java screensaver wrapper?  
 
So how about modulating the charges/gravity in response to audio?  Or adding new forces?  Eager anticipation at this end... with the current calibre of your work, you don't need my suggestions anyway
 
flight404

WWW Email
Re: flight404 magnetic field experiment...
« Reply #10 on: May 12th, 2004, 3:38am »

The Bright to Alpha is the fine work of Ryan Alexander (from his REM video exhibition).  I thought it quite lovely as well.  I had wondered of a good way to make fuzzy spheres.  I hope the reverse rotation is a reasonable way to keep the images perpendicular to the line of sight... seems to work okay for now but once gimbal lock kicks in, I am certain it will break and Malka will be on my case to learn Quaternions.
 
Off tomorrow to NYC for a couple days so probably wont integrate a Sonia execution until this weekend.  But keep suggesting, Tom, your input saved me many gray hairs.  
« Last Edit: May 12th, 2004, 3:38am by flight404 »  
Pages: 1 

« Previous topic | Next topic »