[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> Re: 3-d mesh of electric field



With a 0.5 step and a slightly closer View ([800 800 800])
You get the attached.

This one would be look REAL nice printed with a .08 step (scaled up
in size) and at 300-600 "turtle pixels per inch".

MHELHEFNY@FRCU.EUN.EG wrote:
> 
> ;Helo George Mills
> ;Here is the code to show electric field due to two opposite charges
> ;drawn on a 3-D space grid.
> ;this same grid used to be done by famous packages like "Matlab".
> ;The electic field intensity is first treated by stepping in the x
> ;direction, then it is stepped in the z direction, while the y-axis
> ;is the one to be calculated;teatchers may use this model in physics
> ;lessons.
> ;Hoping that some body will develop the code to draw the contour map
> ;(equipotential lines) of the field.
> ;hint:- the contour map could be drawn without using 3-d extensions
> ;setting different turtles with their own colours for each line hight.
> ;Enjoy it
> ;Best Regards
> ;Mhelhefni
> ;------------------------------------------------------------------
> to go
> turnon3d cs ht
> make "step first questionbox [input step bet.(.08 for details - 1 for speed)][]
> ifelse :step <.16 [gridx .3 -.4 :step rt 90 label[contour_lines_apear]]~
> [grid .3 -.4 :step rt 90 label[two_opposite_elect_charges]]
> end
> 
> to grid :q :q1 :step
> gridx :q :q1 :step gridz :q :q1 :step
> end
> 
> to gridx :q :q1 :step
> for [x 0 14 :step][for [z 0 14 :step][make "xsq (:x- 11)*(:x- 11) make "zsq
> (:z- 9)*(:z- 9)
> make "xsq1 (:x- 4)*(:x- 4) make "zsq1 (:z- 7)*(:z- 7)
> make "f :q/(:xsq+ :zsq+ .05)
> make "f1 :q1/(:xsq1+ :zsq1+ .05)
> pd setxyz :x*30 (:f+ :f1)*60 :z*30]pu home]
> end
> 
> to gridz :q :q1 :step
> for [z 0 14 :step][for [x 0 14 :step][make "xsq (:x- 11)*(:x- 11) make "zsq
> (:z- 9)*(:z- 9)
> make "xsq1 (:x- 4)*(:x- 4) make "zsq1 (:z- 7)*(:z- 7)
> make "f :q/(:xsq+ :zsq+ .05)
> make "f1 :q1/(:xsq1+ :zsq1+ .05)
> pd setxyz :x*30 (:f+ :f1)*30 :z*30]pu home]
> end
> 
> to turnon3d
> ; This is a library procedure for 3-d
> perspective
> setturtle -1
> setxyz 1000 1000 1000
> setturtle 0
> end
> ;----------------------------------------------------------------------

-- 
===============================================================
George Mills
email: mills@softronix.com
http://www.softronix.com
The www page contains some very powerful educational software.
Our single most important investment is our kids.

GIF image



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home