We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › WATER SIMULATION PROBLEM
Page Index Toggle Pages: 1
WATER SIMULATION PROBLEM (Read 511 times)
WATER SIMULATION PROBLEM
Nov 29th, 2006, 2:49am
 
Hi,
I'm new to processing and I have been looking at other peoples code and going through the tutorials to figure out how to do stuff.

can someone tell me why the source code to this simultaion returns an error:  
http://bodytag.org/nav.php?u=tp02/
I figured BImage had to be changed to PImage but the next problem was:
float constrain(float val, float minv, float maxv) {  
which returns the error:
Semantic Error: The method "float constrain(float val, float minv, float maxv);" cannot replace the accessible final method "float constrain(float $1, float $2, float $3);" declared in type "processing.core.PApplet".

What does this mean?
Re: WATER SIMULATION PROBLEM
Reply #1 - Nov 29th, 2006, 7:16am
 
If you are using the Beta 121, you should comment this out :

Quote:
/* float constrain(float val, float minv, float maxv) {  
 return (val > maxv) ? maxv : ((val < minv) ? minv : val);  
}  */

This code is also ratio aspect locked (1:1)

If you want to change it you must replace in the source, this line :

Quote:
y = (int)i/HEIGHT;

by this one :

Quote:
y = (int)i/WIDTH;

Wink
Page Index Toggle Pages: 1