Field Lines


This was a program I made while taking a Physics II course. Textbooks often include drawings of electric field lines for one or two charges, but rarely anything more complicated.


Features:
Instructions:
How it Works:

The field lines are drawn by starting the user specified number of lines at various points along the charge's circumference. From there an electric field vector is calculated and we move one unit in the direction of the vector, draw a pixel at the new location, and repeat the process. The intuitive approach to this problem would be to repeat the afore mentioned process until the line has left the screen. However, in the case of two charges of opposite polarities some of the field lines inbetween the two leave the screen before arcing back toward the other charge. The approach I took was to continue drawing the line for a set number of pixels. It's not perfect, and occasionally a field line will loop offscreen only to stop middle-screen on the return trip.

The equipotential lines are calculated by traversing each pixel and determining if the potential energy at that point is a multiple of the user specified voltage. Since there is a slim chance that any of the pixels will have exact multiple, there is a tolerance of +/- 0.01 volts. This unfortunately leads to some equipotential lines being rather thick in parts and slim in other areas instead of the more conventional lines shown in textbooks.

 
© 2010 by Jacob Constantinides