addPlaneX method
void
addPlaneX(
- dynamic strength,
- dynamic subtract
Implementation
void addPlaneX( strength, subtract ) {
// cache attribute lookups
final size = this.size;
final yd = this.yd;
final zd = this.zd;
final field = this.field;
double dist = size * math.sqrt( strength / subtract );
if ( dist > size ) dist = size;
for(int x = 0; x < dist; x ++ ) {
double xdiv = x / size;
double xx = xdiv * xdiv;
double val = strength / ( 0.0001 + xx ) - subtract;
if ( val > 0.0 ) {
for (int y = 0; y < size; y ++ ) {
int cxy = x + y * yd;
for (int z = 0; z < size; z ++ ) {
field[ zd * z + cxy ] += val;
}
}
}
}
}