Re: Contour lines using vPython
Bruce Sherwood <[email protected]>
| Newsgroups | gmane.comp.python.visualpython.user |
|---|---|
| Message-ID | <[email protected]> |
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, <[email protected]> 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 ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev