public override bool Intersects(Tree.Rectangle rectangle) { var distanceX = Mathf.Abs(PosX - rectangle.PosX); var distanceY = Mathf.Abs(PosY - rectangle.PosY); var cornerDistance = Mathf.Pow(distanceX - rectangle.Width, 2) + Mathf.Pow(distanceY - rectangle.Height, 2); if (PosX < rectangle.PosX + rectangle.Width && PosX > rectangle.PosX - rectangle.Width && PosY < rectangle.PosY + rectangle.Height && PosY > rectangle.PosY - rectangle.Height) //inside the rectangle { return(true); } if (distanceX > Radius + rectangle.Width || distanceY > Radius + rectangle.Height) { return(false); } if (distanceX <= Radius + rectangle.Width) { return(true); } if (distanceY <= Radius + rectangle.Height) { return(true); } return(cornerDistance <= Mathf.Pow(Radius, 2)); }
public void ShapeSetType() { //ACT Shape rectangle = new Tree.Rectangle(); //ASSERT Assert.AreEqual(rectangle.GetShapeType(), ShapeType.RECTANGLE); }
public override bool Intersects(Tree.Rectangle rectangle) { return(!( PosX + Width < rectangle.PosX - rectangle.Width || PosX - Width > rectangle.PosX + rectangle.Width || PosY - Height > rectangle.PosY + rectangle.Height || PosY + Height < rectangle.PosY - rectangle.Height )); }
private void mutate(OperationType operationType, Rectangle[] rects) { var operation = new Operation(OperationType.Add); operation.Rects = rects; lock (operation.Sync) { this.queue.Enqueue(operation); Monitor.Wait(operation.Sync); } }
public void ShapeSetGetColor() { //ACT Shape rectangleRed = new Tree.Rectangle(); rectangleRed.Color = Color.Red; //ASSERT Assert.AreEqual(rectangleRed.Color, Color.Red); }
public ICollection<Rectangle> Query(Rectangle rect) { return null; }
public abstract bool Intersects(Tree.Rectangle rectangle);