private Pair<Float,Float> calculateStartEndAngles(Point pointTo,float radius,int left,int top,int right,int bottom){
  Rect circleRect=new Rect((pointTo.x - (int)radius),(pointTo.y - (int)radius),(pointTo.x + (int)radius),(pointTo.y + (int)radius));
  Rect screenRect=new Rect(left,top,right,bottom);
  List<Quadrant> quadrants=findContainingQuadrants(circleRect,screenRect);
  float minAngle=Float.MAX_VALUE, maxAngle=Float.MIN_VALUE;
  if (quadrants.contains(Quadrant.IV) && quadrants.contains(Quadrant.I) && quadrants.size() == 2) {
    minAngle=(float)(-Math.PI / 2);
    maxAngle=(float)(Math.PI / 2);
  }
 else {
    if (quadrants.size() < 4) {
      for (      Quadrant quadrant : quadrants) {
        double angle2=(quadrant.getStartAngle());
        minAngle=(float)Math.min(minAngle,angle2);
        double angle4=(quadrant.getEndAngle());
        maxAngle=(float)Math.max(maxAngle,angle4);
      }
    }
 else {
      minAngle=(float)Math.PI;
      maxAngle=(float)(Math.PI * 2);
    }
  }
  return new Pair<>(minAngle,maxAngle);
}

private Pair < Float , Float > calculateStartEndAngles ( Point pointTo , float radius , int left , int top , int right , int bottom ) { Rect circleRect = new Rect ( ( pointTo . x - ( int ) radius ) , ( pointTo . y - ( int ) radius ) , ( pointTo . x + ( int ) radius ) , ( pointTo . y + ( int ) radius ) ) ; Rect screenRect = new Rect ( left , top , right , bottom ) ; List < Quadrant > quadrants = findContainingQuadrants ( circleRect , screenRect ) ; float minAngle = Float . MAX_VALUE , maxAngle = Float . MIN_VALUE ; if ( quadrants . contains ( Quadrant . IV ) && quadrants . contains ( Quadrant . I ) && quadrants . size ( ) == 2 ) { minAngle = ( float ) ( - Math . PI / 2 ) ; maxAngle = ( float ) ( Math . PI / 2 ) ; } else { if ( quadrants . size ( ) < 4 ) { for ( Quadrant quadrant : quadrants ) { double angle2 = ( quadrant . getStartAngle ( ) ) ; minAngle = ( float ) Math . min ( minAngle , angle2 ) ; double angle4 = ( quadrant . getEndAngle ( ) ) ; maxAngle = ( float ) Math . max ( maxAngle , angle4 ) ; } } else { minAngle = ( float ) Math . PI ; maxAngle = ( float ) ( Math . PI * 2 ) ; } } return new Pair < > ( minAngle , maxAngle ) ; }
brute force method to find the start angles . not very well thought out . this method will give the start and end angles where the arc cut out by the rectangle lies within the rectangle .
