private void AdicionarNoContainer(Circle circle) { this.Container.Children.Add(circle); _circles.Add(circle); circle.Destruir += new Action<object, EventArgs>(circle_Destruir); }
public bool Intersects(Circle other) { double Radius = (this.DiametroAtual / 2); double otherRadius = (other.DiametroAtual / 2); // calculate the minimum distance of the centers // the circles are not intersecting at var minCenterDistance = Radius + otherRadius; double CenterX = this.X + (this.DiametroAtual / 2); double CenterY = this.Y + (this.DiametroAtual / 2); double otherCenterX = other.X + (other.DiametroAtual / 2); double otherCenterY = other.Y + (other.DiametroAtual / 2); // calculate the actual distance and compare //var distanceVector = Center - other.Center; var center1 = new Microsoft.Xna.Framework.Vector2((float)CenterX, (float)CenterY); var center2 = new Microsoft.Xna.Framework.Vector2((float)otherCenterX, (float)otherCenterY); var distanceVector = center1 - center2; if (distanceVector.Length() < minCenterDistance) { return true; } else { return false; } }
public static Circle CreateSpecialCircle(Point position) { var circle = new Circle(Colors.White); circle.X = position.X - (Circle._diametroInicial / 2); circle.Y = position.Y - (Circle._diametroInicial / 2); circle.Status = StatusCircle.Incrementando; return circle; }
public bool ValidarColisao(Circle circle) { if (Intersects(circle)) { circle.Status = StatusCircle.Incrementando; return true; } return false; }
public static Circle Create() { //Cor cor = (Cor)random.Next(6); Cor cor = (Cor)(Id % 11); Id++; var angulo = (double)random.Next(360); var circle = new Circle(cor, angulo); circle.X = random.Next(728 - _diametroInicial); circle.Y = random.Next(480 - _diametroInicial); return circle; }