From: Bruce S. <Bru...@nc...> - 2011-04-20 16:10:10
|
The curve object will connect a list of points with line segments, which sounds like what you want. There is a trick to drawing field lines which you might wish to implement, to avoid a systematic error. From a starting point where you know the field direction, project a line in that direction and evaluate the field at a new location on that line. Draw perpendiculars to the two vectors and find where those perpendiculars meet (this is assuming a 2D field). Imagine that point as the center of a circle, and swing a circular arc around that center, starting from the first point and ending on the line that is perpendicular to the second field vector. Approximate the arc with a straight line. Evaluate the field at the end of the arc, which will be nearly parallel to the second field vector that you evaluated. Repeat. At http://www.matterandinteractions.org/Content/Materials/programs2.html you'll find a program fields.py which you might find interesting, as it displays many properties of E and B fields, but not field lines (nor equipotential lines/surfaces). Bruce Sherwood On Wed, Apr 20, 2011 at 6:47 AM, <dal...@ea...> wrote: > I'm looking for a way to draw E and B fields using vPython. I have the equations to find the vector at a point, but want to draw contour lines between two particles just as a start. Any suggestions or code segment that shows how to do that? > > Thanks, > -d |