private void triangulo(Cairo.Context cr, Boid b, double rot) { reset(cr); cr.Save(); r.Rotate(rot); t.Translate(b.Location.X, Logica.mapeo(b.Location.Y)); r.TransformPoint(ref Ax, ref Ay); t.TransformPoint(ref Ax, ref Ay); r.TransformPoint(ref Bx, ref By); t.TransformPoint(ref Bx, ref By); r.TransformPoint(ref Cx, ref Cy); t.TransformPoint(ref Cx, ref Cy); // System.Diagnostics.Debug.WriteLine (Ax+", "+Ay); cr.MoveTo(Ax, Ay); cr.LineTo(Bx, By); cr.LineTo(Cx, Cy); cr.LineWidth = 2; if (b.criterio == 0) { cr.SetSourceRGBA(0.5, 0, 0, 0.5); //cercano } else if (b.criterio == 1) { cr.SetSourceRGBA(0, 0.5, 0, 0.5); //menos concurrido } else { cr.SetSourceRGBA(0, 0, 0.5, 0.5); //random } cr.ClosePath(); cr.FillPreserve(); cr.Stroke(); cr.Restore(); }
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(); } } } }
public bool Contains(Boid s) { return(List.Contains(s)); }
public void Add(Boid s) { List.Add(s); }
public void Remove(Boid s) { List.Remove(s); }