|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Good Evening everyone,
I am new to the Group and to POV RAY generally and my interest is related of
using POV RAY to model electrostatic fields.
Could someone provide me a sample POV RAY code where it will demonstrate a
sphere with its 3D Electrostatic Field (using the formula E=K*q/r^2) with field
lines and another with contours? Then how can I modify the sample for two
spheres with their fields interacting.
I searched all over the Internet where one may find amazing POV RAY examples but
none that could demonstrate 3D Electrostatic Fields (free code example) of a
sphere or two of them in close proximity.
I will really appreciate any help of yours.
Have a great weekend!
Kind Regards
Johann
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 26/09/14 20:42, Johann wrote:
> Good Evening everyone,
>
> I am new to the Group and to POV RAY generally and my interest is related of
> using POV RAY to model electrostatic fields.
Welcome, Johann
> Could someone provide me a sample POV RAY code where it will demonstrate a
> sphere with its 3D Electrostatic Field (using the formula E=K*q/r^2) with field
> lines and another with contours? Then how can I modify the sample for two
> spheres with their fields interacting.
>
Off the top of my head, I drew a blank but I am sure there will be
someone here who has a solution. I will mull your needs over in my mind
for the next couple of days but unfortunately I can't give much time to
them ATM; I look after Linux systems and I'm sure you've heard about the
ShellShocked bug.
>
> Have a great weekend!
>
Not possible, I'm afraid. But I intend to have a great Tuesday
John
--
Protect the Earth
It was not given to you by your parents
You hold it in trust for your children
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I'd recommend contacting Paul Nylander. He's a wizard.
http://bugman123.com/Physics/
He's a busy guy, but could probably point you in the right direction.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Off the top of my head, I drew a blank but I am sure there will be
> someone here who has a solution. I will mull your needs over in my mind
> for the next couple of days but unfortunately I can't give much time to
> them ATM; I look after Linux systems and I'm sure you've heard about the
> ShellShocked bug.
Thanks John!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> http://bugman123.com/Physics/
>
> He's a busy guy, but could probably point you in the right direction.
Thank you! I already know about this web site and there is POV RAY code example
of a solenoid creating magnetic field. Pretty cool! Unfortunately I could not
figure out how may I modify his code for the electric field of a sphere. I sent
him an e-mail but I am really not expecting to receive an answer.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 26/09/2014 20:42, Johann wrote:
> Could someone provide me a sample POV RAY code where it will demonstrate a
> sphere with its 3D Electrostatic Field (using the formula E=K*q/r^2) with field
> lines and another with contours? Then how can I modify the sample for two
> spheres with their fields interacting.
Hi Johann and welcome.
Unfortunately I cannot give you any code but I would like to suggest
looking at the Blob object.
From the inbuilt help:
Blobs are an interesting and flexible object type. Mathematically they
are iso-surfaces of scalar fields, i.e. their surface is defined by the
strength of the field in each point. If this strength is equal to a
threshold value you are on the surface otherwise you are not.
Picture each blob component as an object floating in space. This object
is filled with a field that has its maximum at the center of the object
and drops off to zero at the object's surface. The field strength of all
those components are added together to form the field of the blob. Now
POV-Ray looks for points where this field has a given value, the
threshold value. All these points form the surface of the blob object.
Points with a greater field value than the threshold value are
considered to be inside while points with a smaller field value are outside.
Help 2.3.3.1 Blob Object
Help 2.3.3.1.1 Component Types and Other New Features
Help 3.4.5.1.1 Blob
--
Regards
Stephen
Post a reply to this message
|
|
| |
| |
|
|
From: William F Pokorny
Subject: Re: How to: Sphere with 3D Electric Field Lines
Date: 27 Sep 2014 07:14:56
Message: <54269c30$1@news.povray.org>
|
|
|
| |
| |
|
|
On 09/26/2014 03:42 PM, Johann wrote:
> Good Evening everyone,
>
> I am new to the Group and to POV RAY generally and my interest is related of
> using POV RAY to model electrostatic fields.
> Could someone provide me a sample POV RAY code where it will demonstrate a
> sphere with its 3D Electrostatic Field (using the formula E=K*q/r^2) with field
> lines and another with contours? Then how can I modify the sample for two
> spheres with their fields interacting.
>
> I searched all over the Internet where one may find amazing POV RAY examples but
> none that could demonstrate 3D Electrostatic Fields (free code example) of a
> sphere or two of them in close proximity.
>
> I will really appreciate any help of yours.
>
> Have a great weekend!
>
> Kind Regards
>
> Johann
>
Hi Johann,
I don't have a simple method for the field lines, but perhaps the
following code makes for a start on the contours. Field lines would
intersect in a fashion perpendicular to the contours so I can sort of
see complicated methods to come up with them, but nothing which fits in
the time I can spend at the moment.
Bill P.
//
// Using isosurfaces to get equal potential contours
//
// This technique is slow even playing tricks below.
//
// Suggest to start :
// povray +Ie_static.pov +A +D +THfs +H300 +W300
//
#version 3.7;
global_settings {
assumed_gamma 1
ambient_light srgb <1,1,1>
}
#declare Grey50 = srgbft <0.5,0.5,0.5,0,0>;
background {
color Grey50
}
#declare Camera00 = camera {
perspective
location <5,5,-5.001>
sky <0,1,0>
angle 35
right x*(image_width/image_height)
look_at <0,0,0>
}
#declare White = srgbft <1,1,1,0,0>;
#declare Light00 = light_source {
<50,150,-250>, White
}
#declare Red = srgbft <1,0,0,0,0>;
#declare CylinderX = cylinder {
<-1,0,0>, <1,0,0>, 0.01
pigment { color Red }
}
#declare Green = srgbft <0,1,0,0,0>;
#declare CylinderY = cylinder {
<0,-1,0>, <0,1,0>, 0.01
pigment { color Green }
}
#declare Blue = srgbft <0,0,1,0,0>;
#declare CylinderZ = cylinder {
<0,0,-1>, <0,0,1>, 0.01
pigment { color Blue }
}
#include "functions.inc"
#declare Fn00 = function (x,y,z,k,q) {
(k*q)/(x*x+y*y+z*z+1e-7)
}
#declare Fn01 = function (x,y,z,_X,_Y,_Z,k,q) {
Fn00(x-_X,y-_Y,z-_Z,k,q) // Positions spheres
}
#declare Fn02 = function (x,y,z) {
Fn01(x,y,z,2.5,0.0,0.0,1.0,-1.0) // First sphere
}
#declare Fn03 = function (x,y,z) {
Fn01(x,y,z,-2.5,0.0,0.0,1.0,1.0) // Second sphere
}
#declare Fn04 = function (x,y,z) {
Fn02(x,y,z)+Fn03(x,y,z)
}
#declare Magenta = srgbft <1,0,1,0,0>;
#macro EquPotential(_E)
difference {
isosurface {
function { Fn04(x,y,z*10) } // Scaling in z to get faster iso
contained_by { box { <-9.5,-4.5,-0.45>,<4.5,4.5,0.45> } }
threshold _E+0.005
accuracy 0.0005
max_gradient 5.5
all_intersections
}
isosurface {
function { Fn04(x,y,z*10) }
contained_by { box { <-9.5,-4.5,-0.45>,<4.5,4.5,0.45> } }
threshold _E
accuracy 0.0005
max_gradient 5.5
all_intersections
}
}
#end
// Could be a macro passed max and min
// potentials of all spheres in render.
#declare EquPotentialShells = union {
EquPotential(-1.0/1)
EquPotential(-1.0/2) // list contours to plot
EquPotential(-1.0/4) // more = slower render
EquPotential(-1.0/8)
EquPotential(-1.0/16)
EquPotential(0.0)
EquPotential(1.0/16)
EquPotential(1.0/8)
EquPotential(1.0/4)
EquPotential(1.0/2)
EquPotential(1.0/1)
}
#declare Box00 = box {
<-20,-9,-0.02>,<5,5,0.02>
}
#declare EquPotentialLines = intersection {
object { Box00 }
object { EquPotentialShells }
pigment { color Magenta }
}
//---
camera { Camera00 }
light_source { Light00 }
object { CylinderX }
object { CylinderY }
object { CylinderZ }
object { EquPotentialLines }
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Help 2.3.3.1 Blob Object
> Help 2.3.3.1.1 Component Types and Other New Features
> Help 3.4.5.1.1 Blob
>
>
> --
>
> Regards
> Stephen
Thanks Stephen! I will have a look at it. Well as I mentioned above, I am brand
new to POV RAY and that means it will take some time to become familiar with POV
RAY philisophy, although I have some experience in programming.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Hi Johann,
>
> I don't have a simple method for the field lines, but perhaps the
> following code makes for a start on the contours. Field lines would
> intersect in a fashion perpendicular to the contours so I can sort of
> see complicated methods to come up with them, but nothing which fits in
> the time I can spend at the moment.
>
> Bill P.
Thanks Bill for your proposal! Just a few minutes ago POV RAY started to render
the image and it took about 14 minutes for 320x240 AA 0.3. I believe that what I
am looking for is relative easy and not so complicated.
I completely understand how bothersome is when someone asks for a solution to
his problem without even to know how to use the tool. Therefore, I would like to
help on this direction. Below I have two sample codes, I found on the Internet
which need to be tweaked by someone with knowledge to give the expected result:
Example Nr.1:
// it creates a sphere with 200 random electric field lines
// it seems on the below code the electric field formula E=KQ/r^2 is not used
and instead it creates random lines around the sphere surface
#include "colors.inc"
light_source { <10,0,-1> color White shadowless }
light_source { <0,0,-10> color White shadowless }
camera {location <2,2,-5> look_at <0,0,0> }
sphere { <0,0,0>,0.4 pigment {Red} }
#declare R1=seed(0);
#declare R=2.5;
#declare c=0;
#while(c <= 300)
#declare theta=pi*rand(R1);
#declare phi=2.0*pi*rand(R1);
#declare xp=R*sin(theta)*cos(phi);
#declare yp=R*sin(theta)*sin(phi);
#declare zp=R*cos(theta);
cylinder {<0,0,0>,<xp,yp,zp>,0.01 pigment {Orange}}
#declare c=c+1;
#end
If we could modify the above that will include clearly the electric field
formula (if possible to show field line direction), it will be of great help.
Then the second sample I need, it will be two spheres interacting with their
fields.
Example Nr.2 (Brilliant work by Paul Nylander):
//******************************************************************************************
//* Magnetic Field of a Solenoid, copyright by Paul Nylander, bugman123.com,
5/17/06
//* runtime: 1 minute
//******************************************************************************************
#declare mu0=1.25663706144e-6; #declare n=6; #declare R=0.01; #declare
dL=(4/3)*R; #declare r=R/4;
camera{location <13.65,0,16.25>*R look_at 0.4*R*x up -y right
x*image_width/image_height sky -y angle 25}
light_source{<0,0,8*R>,1}
//Solenoid
#include "golds.inc"
#declare begin=1; #declare x1=(0.25-n/2)*dL;
#while(x1<=(n/2-0.25)*dL)
#declare theta=2*pi*(x1/dL+n/2); #declare p2=<x1,R*sin(theta),-R*cos(theta)>;
sphere{p2,r texture{T_Gold_5A}} #if(!begin) cylinder{p1,p2,r
texture{T_Gold_1A}} #end
#declare begin=0; #declare p1=p2; #declare x1=x1+0.005*dL;
#end
//Electromagnetic Field
#declare Sqr=function(X) {X*X};
#declare sign=function(i1) {1-2*floor(2*mod((i1-1)/2,n)/n)}; // i1<n1?1:-1
#declare I=function(i1) {sign(i1)}; // current
#declare xcoil=function(i1)
{(4/3)*R*(mod(i1-1,n)+0.5*floor(2*mod((i1-1)/2,n)/n)-0.5*(n-0.5))};
#declare B=function{(mu0/(2*pi))*sqrt( // magnetic field magnitude
Sqr(sum(i1,1,2*n,I(i1)*(y-sign(i1)*R)/(Sqr(x-xcoil(i1))+Sqr(y-sign(i1)*R))))+
Sqr(sum(i1,1,2*n,I(i1)*(x-xcoil(i1))/(Sqr(x-xcoil(i1))+Sqr(y-sign(i1)*R))))
)}
#declare
contours=function{(2+cos(0.06*pi*(sum(i1,1,2*n,I(i1)/sqrt(Sqr(x-xcoil(i1))+Sqr(y-sign(i1)*R))))))/3}
// magnetic field line contours
plane{<0,0,1>,0
pigment{function{min(1,max(0,12000*B(x,y,0)*contours(x,y,0)))} color_map{
[0 rgbt <0,0,1,1>] [0.25 rgbt <0,0,1,0.75>] [0.5 rgbt <1/3,0,1,0.5>] [0.75
rgbt <2/3,0.5,1,0.25>] [1 rgbt <1,1,1,0>]
}}
finish{ambient 2.25 reflection 0 diffuse 0 specular 0}
}
First of all the above requires to replace the solenoid function with a sphere,
the magnetic field induction with the Electric Field and to display the contours
in 3D space. Easy said than done (at least for me).
Anyone who is interested to see what I am looking for, just run the
above two examples which are really impressive and they will give you more to
think or inspire you.
I believe that when someone with some experience on POV RAY and having knowledge
of basic Physics, when he run the above two examples, it will become clearer of
what we are up to.
Bill and everybody thank you very much for your time so far!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 27/09/2014 15:57, Johann wrote:
> Thanks Stephen! I will have a look at it. Well as I mentioned above, I am brand
> new to POV RAY and that means it will take some time to become familiar with POV
> RAY philisophy, although I have some experience in programming.
Please do and if it works, let me know.
I know what you mean. Learning Blender showed me that working with
meshes requires different approaches.
If you can programme then the world is your oyster. :-)
--
Regards
Stephen
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|