// // Created by jovian on 09/10/17. // #include "MetaField.h" MetaField::MetaField() { clean(); } void MetaField::clean() { for (int i(0); i < WIN_H; i++) for (int j(0); j < WIN_W; j++) { m_field[i][j] = 0.0; } } void MetaField::binary(bool mat[WIN_H][WIN_W], float ceil) { for (int i(0); i < WIN_H; i++) for (int j(0); j < WIN_W; j++) { mat[i][j] = (m_field[i][j] > ceil); } } void MetaField::disturb(int y, int x, float weight) { // Escape if (x < 0 || x >= WIN_W || y < 0 || y >= WIN_H) return; // todo Disturb for (int i(0); i < WIN_H; i++) for (int j(0); j < WIN_W; j++) { m_field[i][j] += weight / ((y - i)*(y - i) + (x - j)*(x - j)); } }