What is the maxscript equivalent?


#1

I’m in the process of writing a maxscript based on Joe Stam’s “Real-Time Fluid Dynamics for Games” research paper. I’m not that familiar with c coding and came across this entry…

for ( i=1 ; i<=N ; i++ ) { x[IX(0 ,i)] = b==1 ? –x[IX(1,i)] : x[IX(1,i)];
x[IX(N+1,i)] = b==1 ? –x[IX(N,i)] : x[IX(N,i)];
x[IX(i,0 )] = b==2 ? –x[IX(i,1)] : x[IX(i,1)];
x[IX(i,N+1)] = b==2 ? –x[IX(i,N)] : x[IX(i,N)];
}

I’m not sure how this would translate into maxscript, especially the " = b==1 ?". My guess is that b is a flag that if equal to the number will do what’s next else do what follows. In other words, its shorthand for an if then else statement in c.

If anyone could reinterprit this I’d really apreciate it.

Stephen Lebed


#2

if IX is a var:
(x[IX*(N+1,i)] = b) ==1 ? –x[IX*(N,i)] : x[IX*(N,i)];
==>
(x[IX*(N+1,i)] = b
if b == 1 then
–x[IX*(N,i)]
else
x[IX*(N,i)]

and if XI is a function replace with: IX N i => no ( , )


#3

Thanks for the reply and I apologize for posting this in the wrong place.


#4

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.