private void drawArc(PaintEventArgs e, int width, int height) { CircleArc arc = circle.GetArc(); float startRadian = (float)arc.GetRadianInterval().Item1; float radianWidth = (float)arc.GetArcWidth(); e.Graphics.DrawArc(arcPen, new Rectangle( width / 2 - circle.GetRadius(), height / 2 - circle.GetRadius(), circle.GetDiameter(), circle.GetDiameter() ), 360 - (float)(startRadian) * 180f / (float)Math.PI, (float)(radianWidth) * 180f / (float)Math.PI ); }
public static bool AreColliding(PlayerDot playerDot, CircleArc circleArc) { double playerDotRadian = playerDot.GetRadian(); double circleArcBeginRadian = circleArc.GetRadianInterval().Item1; double circleArcEndRadian = circleArc.GetRadianInterval().Item2; if (circleArcBeginRadian < circleArcEndRadian) { circleArcBeginRadian += 2 * Math.PI; if (playerDotRadian < circleArcEndRadian) { playerDotRadian += 2 * Math.PI; } } return(circleArcBeginRadian >= playerDotRadian && circleArcEndRadian <= playerDotRadian); }
public Circle(int radius) { this.radius = radius; playerDot = new PlayerDot(radius); circleArc = new CircleArc(0.5, Math.PI / 2); }