Files
Atomorph.NET/Atomorph.NET/FluidModel/Particle.cs
T

90 lines
2.5 KiB
C#

namespace Atomorph.FluidModel;
internal class Particle
{
public Particle()
{
}
public Particle(Material mat, double x, double y, double u, double v)
{
Material = mat;
X = x;
Y = y;
U = u;
V = v;
DuDx = 0.0;
DuDy = 0.0;
DvDx = 0.0;
DvDy = 0.0;
Cx = 0;
Cy = 0;
}
public void Clear()
{
U = V = DuDx = DuDy = DvDx = DvDy = 0.0;
Cx = Cy = 0;
Strength = 1.0;
for (int i = 0; i < 3; i++)
{
Px[i] = Py[i] = Gx[i] = Gy[i] = 0.0;
}
SourceOwner = false;
}
public void CopyFrom(Particle other)
{
X = other.X;
Y = other.Y;
GravityX = other.GravityX;
GravityY = other.GravityY;
FreedomR = other.FreedomR;
}
public Material Material { get; }
public double X { get; set; }
public double Y { get; set; }
public double U { get; set; }
public double V { get; set; }
public double DuDx { get; private set; }
public double DuDy { get; private set; }
public double DvDx { get; private set; }
public double DvDy { get; private set; }
public uint Cx { get; set; }
public uint Cy { get; set; }
public double[] Px { get; } = new double[3];
public double[] Py { get; } = new double[3];
public double[] Gx { get; } = new double[3];
public double[] Gy { get; } = new double[3];
// CUSTOM VARIABLES:
public double GravityX { get; set; }
public double GravityY { get; set; }
public double FreedomR { get; set; } // freedom radius multiplier
public bool Active { get; set; }
public bool Mature { get; set; }
// ideal color (does not blend)
public double R { get; set; } // red component
public double G { get; set; } // green component
public double B { get; set; } // blue component
public double A { get; set; } // alpha component
// current color (blends over time)
public double r { get; set; } // red component
public double g { get; set; } // green component
public double b { get; set; } // blue component
public double a { get; set; } // alpha component
public ulong DestinationPos { get; set; }
public ulong SourcePos { get; set; }
public ulong FrameKey { get; set; }
public double Strength { get; set; } // how easily it regains its color
public bool Hack { get; set; }
public bool SourceOwner { get; set; } // true when it was first one to occupy the source location.
// END OF CUSTOM VARIABLES
}