public Rectangle ubicacion_boid(Boid b) { int radio = (int)Constantes.max(Logica.radioAli, Logica.radioCoh, Logica.radioSep); int xo = (int)b.Location.X - radio, yo = (int)b.Location.Y - radio, x1 = (int)b.Location.X + radio, y1 = (int)b.Location.Y + radio; Point inicio = ubicar_punto_casillero(xo, yo); Point fin = ubicar_punto_casillero(x1, y1); return(new Rectangle(inicio.X, inicio.Y, fin.X, fin.Y)); }
private double[] calcular_mapa_calor(double value, double min, double max) { double[] color = new double[3]; double radio = 0; if (max != min) { radio = 2 * (value - min) / (max - min); } color[2] = Constantes.max(0, (1 - radio)); color[0] = Constantes.max(0, (radio - 1)); color[1] = 1 - color[2] - color[0]; return(color); }
public void ubicar_boid_casillero(Boid b) { int radio = (int)Constantes.max(Logica.radioAli, Logica.radioCoh, Logica.radioSep); int xo = (int)b.Location.X - radio, yo = (int)b.Location.Y - radio, x1 = (int)b.Location.X + radio, y1 = (int)b.Location.Y + radio; Point inicio = ubicar_punto_casillero(xo, yo); Point fin = ubicar_punto_casillero(x1, y1); for (int x = inicio.X; x <= fin.X; x++) { for (int y = inicio.Y; y <= fin.Y; y++) { matrix [x] [y].boids.Add(b); matrix [x] [y].visitas++; if (matrix [x] [y].visitas > 2000000000) { resetVisitas(); } } } }