POV-Ray : Newsgroups : povray.unofficial.patches : MechSim: Problem with Fields Server Time
25 Jun 2024 18:43:21 EDT (-0400)
  MechSim: Problem with Fields (Message 1 to 2 of 2)  
From: Florian Brucker
Subject: MechSim: Problem with Fields
Date: 30 Oct 2003 19:14:16
Message: <3fa1a958$1@news.povray.org>
When playing around with MechSim (BTW great job, Christoph!), I came 
across field functions. But somehow I can't get them to work properly. 
They behave totally strange. The code below shows my problem.

The field function which is used is taken from the documentation. If 
you set DIRECTION (right at the top) to 1, it will result in an upward 
force, DIRECTION = -1 means a downward force.
In the first case (DIRECTION = 1), everything is perfectly normal. The 
masses move up a little bit. But when setting DIRECTION = -1, the 
masses dissappear. Not totally, of course. Checking the positions 
reveals that they are far far away. Much farer than with DIRECTION = 
1. How can that be?

Here's the code (render as still, change DIRECTION to -1, render again 
and compare the debug stream output):

<code>
#version unofficial MegaPOV 1.0;
#include "mechsim.inc"

#declare DIRECTION = 1;

background { rgb 1 }
camera { location <1,0.5,-0.25>*10 look_at 0 }
light_source { <1,1,-1>*10 rgb 1 }
global_settings { assumed_gamma 1 }

global_settings {
	mechsim {		               	
		topology { mass { 0,0,0.1 mass 1 }	} 		
		field {
			Vector_Function(
				function { 0 },
				function { 0.1*DIRECTION },
				function { 0 }
			)					
		}		
	}
}

sphere { mechsim:mass(0):position,0.1 pigment { rgb<1,0,0> } }

#debug concat("\n*** Position with DIRECTION = ",str(DIRECTION,0,0),": 
<",vstr(3,mechsim:mass(0):position,",",0,3),">\n")
</code>

It could be a time_step problem, but then why does it work with 
DIRECTION = 1?

BTW, I had to change the declaration of Vector_Function in mechsim.inc 
from

<code>
#macro Vector_Function(Fn_X, Fn_Y, Fn_Z)

   Vector_Function_Range(
     function { Fn_X(x, y, z) ,
     function { Fn_Y(x, y, z) ,
     function { Fn_Z(x, y, z) ,
     MSim_Fn_Range
   )

#end
</code>

to

<code>
#macro Vector_Function(Fn_X, Fn_Y, Fn_Z)

   Vector_Function_Range(
     function { Fn_X(x, y, z) },    //Added } to all 3 lines
     function { Fn_Y(x, y, z) },
     function { Fn_Z(x, y, z) },
     MSim_Fn_Range
   )

#end
</code>

Otherwise it wouldn't render at all. Is this a bug,a feature or my fault?

BTW I'm using MegaPOV 1.0 on WindowsME.

Thanks for your help,
Florian
-- 
//=================[web: http://www.torfbold.com]==================\\
#local a=-5;#while(a<5)sphere{<sin(a*pi)*5a*10pow(a,5)*.01>sin(a*a*a*
.1)+1pigment{rgb 9*z}}#local a=a+.01;#end camera{look_at-y*10location
<8,-3,-8>*10}// [www.povray.org]     [www.imp.org]     [www.irtc.org]


Post a reply to this message

From: Christoph Hormann
Subject: Re: MechSim: Problem with Fields
Date: 31 Oct 2003 02:02:02
Message: <bgd971-of3.ln1@triton.imagico.de>
Florian Brucker wrote:
> When playing around with MechSim (BTW great job, Christoph!), I came 
> across field functions. But somehow I can't get them to work properly. 
> They behave totally strange. The code below shows my problem.
> 
> The field function which is used is taken from the documentation. If you 
> set DIRECTION (right at the top) to 1, it will result in an upward 
> force, DIRECTION = -1 means a downward force.
> In the first case (DIRECTION = 1), everything is perfectly normal. The 
> masses move up a little bit. But when setting DIRECTION = -1, the masses 
> dissappear. Not totally, of course. Checking the positions reveals that 
> they are far far away. Much farer than with DIRECTION = 1. How can that be?
> [...]

I don't know if this particular problem is related but i did some basic 
changes in the way field forces work soon after the 1.0 release - i did 
some detailed tests after that and it worked pretty well.  I will try 
your scene later.

> 
> BTW, I had to change the declaration of Vector_Function in mechsim.inc from
> 
> [...]

This has been noted before, the fix is fairly obvious so i did not feel 
the need for a patch.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 25 Oct. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

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