mirror of
https://github.com/eliasstepanik/FluidSimulation.git
synced 2026-01-11 05:28:28 +00:00
uj
This commit is contained in:
parent
c34a7c4e40
commit
2d8a1e9769
@ -93,20 +93,11 @@ public class Fluid
|
||||
|
||||
public int IX(int x, int y)
|
||||
{
|
||||
var X = Clamp(x, 0, size - 1);
|
||||
var Y = Clamp(y, 0, size - 1);
|
||||
return X + Y * size;
|
||||
|
||||
var X = Normalize(x, 0, size - 1);;
|
||||
var Y = Normalize(y, 0, size - 1);
|
||||
return (int) (X + Y * size);
|
||||
}
|
||||
|
||||
float Clamp( float value, float min, float max )
|
||||
{
|
||||
return (value < min) ? min : (value > max) ? max : value;
|
||||
}
|
||||
int Clamp( int value, int min, int max )
|
||||
{
|
||||
return (value < min) ? min : (value > max) ? max : value;
|
||||
}
|
||||
|
||||
|
||||
public void addDensity(int x, int y, float amount) {
|
||||
int index = IX(x, y);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user