POV-Ray : Newsgroups : povray.binaries.images : Magnetism : Magnetism Server Time
5 Nov 2024 10:21:13 EST (-0500)
  Magnetism  
From: Tek
Date: 16 Sep 2005 02:54:20
Message: <432a6c1c@news.povray.org>
I had hoped to enter the current animation round... but I really haven't 
got the energy to put together a decent animation.

So instead, here's something for the current stills round. Magnetism - a 
rather obvious interpretation of the topic "Opposites".

The picture is a rather abstract representation of a magnetic field, 
based on no research whatsoever so any science buffs feel free to tell 
me what's wrong with it. The cylinders are randomly placed in space and 
oriented based on the average of vectors to the north and south poles, 
weighted by the inverse square law (which I'm assuming magnetism obeys, 
I really haven't researched it at all).

Anyways, here's the code:

#declare north = <-1,1,1>;
#declare south = <1,-1,-1>;

#local rs = seed(23);
#local c = 0;
#while ( c < 50000 )

	#local pos = <rand(rs),rand(rs),rand(rs)>*6-3;
	#local toNorth = north - pos;
	#local toSouth = south - pos;
	#local fieldDir = toNorth/pow(vdot(toNorth,toNorth),1.5);
	#local fieldDir =
		fieldDir - toSouth/pow(vdot(toSouth,toSouth),1.5);
	#local fieldDir = vnormalize(fieldDir);
	
	cylinder { pos-fieldDir*.06, pos+fieldDir*.06, .003 }
			
	#local c = c+1;
#end

Enjoy!

--
Tek
http://www.evilsuperbrain.com


Post a reply to this message


Attachments:
Download 'magnetism.jpg' (382 KB)

Preview of image 'magnetism.jpg'
magnetism.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.