by ilteris kaplan
original image: http://www.ac.wwu.edu/~vawter/PhysicsNet/Topics/MagneticField/gifs/B-FieldMagnet.jpg

"In physics, a magnetic field is an entity produced by moving electric charges (electric currents) that exerts a force on other moving charges. A magnetic field is a vector field: it associates with every point in space a (pseudo-)vector that may vary in time. The direction of the field is the equilibrium direction of a compass needle placed in the field. " -Wikipedia

So, I came across to this subject of Magnetic Field Force while I was searching if there are different forces other than gravitional force that shiffman taught us. It turns out there was. I said, why not, I can do that! I researched days and night, spoke with very important scientists about this and they all got agreed about this one thing, "ilteris you can do it!" Well.er..Of course I was not that smart...Oh and on my way I have found this gorgeous website and this guy already did that and what not! Here is the link. Ok that put me a little bit low in motivation at first. Then... I still remember that moment, I was feeding the penguins in NY zoo and that thought just popped in."I can implement this in processing and maybe I can become famous too." I ran to the house and started working on it again with hopes. Only If I was that smart...

So here is my implementation of magnetic field forces in processing for this week. Actually if I try to tell you what's going on aside from what I couldn't figure out, there is a vector field consisting of rectangles,there is a magnet on the center which is looking at us in the Z-axis(as there is no +/- polarities) and there are particles on the stage flying. I tried to define the whole canvas consisting of rectangles so that they can simulate vector fields in this scenario. Since all of them are Vector3D types I could easily calculate the distance between each of those vector fields and the magnet thus naming it the magnitude/or force/ of that area. So my ideas was if some particle were on that area on an exact moment just apply the force that is related to that area. Simple as that.

There is so much problem going on in this applet. First of all, those for loops are insane, there should be a better way of doing this, plus they are causing particles to flicker which I suspect they are creating more than they are supposed to do.

theta_vel += theta_acc + 0.000005; this line in particle class is a total hack that shouldn't be there never and ever. I have found out that I am not getting any value other than 0 for my theta and hacked it in this way. I guess what I am missing is some kind of velocity(angular?) for the particles. I tried to applying some but it turned out I did in wrong.

x = dist * sin(theta);
y = dist * cos(theta);
loc.x = magnet.getLoc().x + x;
loc.y = magnet.getLoc().y + y;
render();
Again there is a big problem with this line of code; I am passing the dist as an amplitude and it creates this circular motion. Since it could look nice this is now what I intended to do. I tried passing the force of the each field as the amplitude here and it gave me another shape of motion. I believe I screwed up pretty bad here.
So this is my implementation for the Magnetic Field force for this week and I am kind of sick of it because there is a whole other stuff there waiting to be explored and I am stuck. So I am waving bye to you, you magnetic field force. it was good knowing you...

References:
1 - Motion of a Charged Particle in a Uniform Magnetic Field
2 - Magnetic fields and how to make them
3 - Cyclotron Motion
4 - 3D Coronal Magnetic Fields
5 - Magnetic Field