|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I have been fooling around with MegaPov a bit lately and I've come up
against a brick wall. I am trying to simulate the buoyant force of water,
but I can't find out how to make a field with Vector_Function() that is
dependent on the position of masses. So far all I've seen is the example
Vector_Function(function{0}function{-1}function{0}), which is a constant
downward force. My code so far is this:
Before the mechsim{...} block
#declare Fn_Vector = function(x,y,z) {
Vector_Function(
function{0}
function{
#if (y>RADIUS)
0
#else
#if (y<-RADIUS)
9.81*4/3
#else
9.81*pi*(((y-r)*r*r-1/3*pow(y-r,3))-(-r*r*r-1/3*pow(-r,3)))
#end
#end
}
function{0}
)
}
In the mechsim{...} block
field {
function {
Fn_Vector(x,y,z)
}
}
When I try to render it throws an error because it is treating the "y" in
the first #if as <0,1,0> and not the argument of the function. I have tried
replacing x, y, and z with a, b, and c, but then it claims that b is an
uninitialized identifier. What am I doing wrong? Thanks in advance!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
ssssmemyself wrote:
> [...]
> #declare Fn_Vector = function(x,y,z) {
> Vector_Function(
> function{0}
> function{
> #if (y>RADIUS)
> 0
> #else
> #if (y<-RADIUS)
> 9.81*4/3
> #else
> 9.81*pi*(((y-r)*r*r-1/3*pow(y-r,3))-(-r*r*r-1/3*pow(-r,3)))
> #end
> #end
> }
> function{0}
> )
> }
You have some basic misunderstanding of how use of #if in functions work
- you can not do render time conditionals this way - use select() for this.
--
Christoph Hormann
http://www.tu-bs.de/~y0013390/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Christoph Hormann <chr### [at] gmxde> wrote:
> ssssmemyself wrote:
> > [...]
> > #declare Fn_Vector = function(x,y,z) {
> > Vector_Function(
> > function{0}
> > function{
> > #if (y>RADIUS)
> > 0
> > #else
> > #if (y<-RADIUS)
> > 9.81*4/3
> > #else
> > 9.81*pi*(((y-r)*r*r-1/3*pow(y-r,3))-(-r*r*r-1/3*pow(-r,3)))
> > #end
> > #end
> > }
> > function{0}
> > )
> > }
>
> You have some basic misunderstanding of how use of #if in functions work
> - you can not do render time conditionals this way - use select() for this.
>
> --
> Christoph Hormann
> http://www.tu-bs.de/~y0013390/
Whoops! I guess the #if command works more like C precompilers then. Makes
sense, seeing how it starts with a #.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"ssssmemyself" <sss### [at] hotmailcom> wrote:
> Christoph Hormann <chr### [at] gmxde> wrote:
> >
> > You have some basic misunderstanding of how use of #if in functions work
> > - you can not do render time conditionals this way - use select() for this.
> >
> > --
> > Christoph Hormann
> > http://www.tu-bs.de/~y0013390/
>
> Whoops! I guess the #if command works more like C precompilers then. Makes
> sense, seeing how it starts with a #.
Well, I'm having more trouble with select() now. Here's the listing for
test.pov
#version unofficial megapov 1.0;
#include "mechsim.inc"
global_settings{
mechsim{
method 1
field{
Vector_Function(
function{select(y,-100,100)}//should move top mass +x, bottom one -x
function{0}
function{0}
)
}
#if(frame_number>1)
step_count 500
time_step (1/30)/500
topology{
load_file "test.dat"
save_file "test.dat"
}
#else
step_count 0
topology{
mass{<0,5,0>,<0,0,0>,.5 mass 1}
mass{<0,-5,0>,<0,0,0>,.5 mass 1}
save_file "test.dat"
}
#end
}
}
#debug "==========n"
#debug vstr(3,mechsim:mass(0):position,", ",0,3)
#debug "n"
#debug vstr(3,mechsim:mass(1):position,", ",0,3)
#debug "n==========n"
camera{location<0,0,-20>look_at<0,0,0>}
light_source{<0,0,-20>color rgb 1}
object{MechSim_Show_All_Objects(-1, false, -1, "")}
sky_sphere{pigment{color rgb<0.4,0.4,0.4>}}
As you can see, the field has a select statement that applies a force of
-100 or 100 in the x direction, depending on the sign of y. To quote the
POV-Ray documentation on select(A, B, C[, D])
"if A < 0 it will return B, else C (A >= 0)."
So, one would assume that the mass at <0,5,0> would move to to the right
because of the field and the mass at <0,-5,0> would move left. According to
the #debug statements and the images produced, both of the masses move
what do I have a basic misunderstanding of this time?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
*bump*
So, what's up with select() within field{}s? Any ideas?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"ssssmemyself" <sss### [at] hotmailcom> wrote:
> *bump*
> So, what's up with select() within field{}s? Any ideas?
Is anyone willing ot investigate this bug?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Tue, 7 Sep 2004 22:04:47 EDT, "ssssmemyself" <sss### [at] hotmailcom>
wrote:
> "ssssmemyself" <sss### [at] hotmailcom> wrote:
> > *bump*
> > So, what's up with select() within field{}s? Any ideas?
> Is anyone willing ot investigate this bug?
I imagine "anyone" is not willing to be called "smartypants" which seemed to
be your answer to giving help. As far as I understand English it is not
courtesy in expressing.
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
ABX <abx### [at] abxartpl> wrote:
> On Tue, 7 Sep 2004 22:04:47 EDT, "ssssmemyself" <sss### [at] hotmailcom>
> wrote:
> > "ssssmemyself" <sss### [at] hotmailcom> wrote:
> > > *bump*
> > > So, what's up with select() within field{}s? Any ideas?
> > Is anyone willing ot investigate this bug?
>
> I imagine "anyone" is not willing to be called "smartypants" which seemed to
> be your answer to giving help. As far as I understand English it is not
> courtesy in expressing.
>
> ABX
does not mean that.
Keep up the good work.
Stephen McAvoy
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Stephen" <mca### [at] hotmailcom> wrote:
> ABX <abx### [at] abxartpl> wrote:
> > On Tue, 7 Sep 2004 22:04:47 EDT, "ssssmemyself" <sss### [at] hotmailcom>
> > wrote:
> > > "ssssmemyself" <sss### [at] hotmailcom> wrote:
> > > > *bump*
> > > > So, what's up with select() within field{}s? Any ideas?
> > > Is anyone willing ot investigate this bug?
> >
> > I imagine "anyone" is not willing to be called "smartypants" which seemed to
> > be your answer to giving help. As far as I understand English it is not
> > courtesy in expressing.
> >
> > ABX
>
> does not mean that.
> Keep up the good work.
> Stephen McAvoy
His remark that I had a "basic misunderstanding" seemed like another "RTFM,
n00b!"-like comment as seen in the Linux community far too often. But, in
all seriousness, is this a bug I'm observing?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|