Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
806 B
3
Indexable
Never
public class ViewModel
{
    private double outerCircleRadius = 100; // Adjust the radius value

    public double CalculateMaxDistanceToOuterCircle(double angleInDegrees)
    {
        double angleInRadians = angleInDegrees * Math.PI / 180.0;
        double distance = outerCircleRadius / Math.Cos(angleInRadians);
        return distance;
    }

    public bool HasReachedOuterBoundary(double canvasLeft, double canvasTop, double angleInDegrees)
    {
        Point currentRectPosition = new Point(canvasLeft, canvasTop);
        double distanceFromCenter = Math.Sqrt(currentRectPosition.X * currentRectPosition.X + currentRectPosition.Y * currentRectPosition.Y);

        double maxDistance = CalculateMaxDistanceToOuterCircle(angleInDegrees);

        return distanceFromCenter >= maxDistance;
    }
}