Search code examples
androidandroid-canvasandroid-custom-view

How to calculate rectangle topx, topy, bottomx, bottomy from circle area android


I have Circle X,Y and radius for drawing a circle, now I want to calculate the rectangle co-ordinates from this circle x,y, radius of the circle. I need help from this.

Thanks In Advance...


Solution

  • topx = X - radius
    topy = Y - radius
    bottomx = X + radius
    bottomy = Y + radius