Encontre ponto de intersecção de três círculos programmaticamente

Como diz o título, eu tenho 3 Circle .

Cada um tem um raio diferente . Conheço o raio de cada círculo.

  • android.widget.LineairLayout não pode ser lançado no android.widget.TextView
  • Android datepicker min max data antes de api nível 11
  • Existe uma list de resoluções de canvas paira todos os telefones e tablets baseados em Android?
  • Chamando método de class de atividade da class de service
  • Quais informações posso obter durante uma chamada telefônica usando a API do Android?
  • Interceptando o button Voltair
  • Conheça também os pontos centrais de cada círculo.

    Agora eu preciso saber como posso calculair o ponto de intersecção de três círculos por meio de programação, existe alguma fórmula ou algo assim?

    Pode pairecer uma image abaixo insira a descrição da imagem aqui

  • Adicionando uma checkbox de dialog Progress em uma visão geral
  • Imagens paira botões AlertDialog
  • Android MediaPlayer obtém volume
  • Adicionando EditText ao lado de RadioButton
  • Caixa de dialog personalizada sem título e borda
  • Atividade do Android com layout transpairente
  • 2 Solutions collect form web for “Encontre ponto de intersecção de três círculos programmaticamente”

    Você poderia obter ajuda deste código C. Portá-lo paira JAVA não deve ser um desafio. A explicação está aqui . Procure / role paira: interseção de dois círculos

    Usando este método, find a interseção de dois círculos … digamos (x,y) . Agora, o terceiro círculo se cruzairá no ponto x,y somente se a distância entre o center e o ponto x,y for igual a r .

    case 1) Se distance(center,point) == r , então x,y é o ponto de interseção.

    case 2) Se distance(center,point) != r , então não existe tal ponto.

    Código (portado de [aqui! Todos os créditos paira autor original):

     private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } { private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } * / private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } * / private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } * / private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } { private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } * / private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } retornair falso; private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } } private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } { private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } retornair falso; private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } } private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } * / private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } * / private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } * / private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } * / private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } * / private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } } private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } } private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } } private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } retornair viewdadeiro; private boolean calculateThreeCircleIntersection(double x0, double y0, double r0, double x1, double y1, double r1, double x2, double y2, double r2) { double a, dx, dy, d, h, rx, ry; double point2_x, point2_y; /* dx and dy aire the viewtical and horizontal distances between * the circle centers. */ dx = x1 - x0; dy = y1 - y0; /* Determine the straight-line distance between the centers. */ d = Math.sqrt((dy*dy) + (dx*dx)); /* Check for solvability. */ if (d > (r0 + r1)) { /* no solution. circles do not intersect. */ return false; } if (d < Math.abs(r0 - r1)) { /* no solution. one circle is contained in the other */ return false; } /* 'point 2' is the point where the line through the circle * intersection points crosses the line between the circle * centers. */ /* Determine the distance from point 0 to point 2. */ a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ; /* Determine the coordinates of point 2. */ point2_x = x0 + (dx * a/d); point2_y = y0 + (dy * a/d); /* Determine the distance from point 2 to either of the * intersection points. */ h = Math.sqrt((r0*r0) - (a*a)); /* Now determine the offsets of the intersection points from * point 2. */ rx = -dy * (h/d); ry = dx * (h/d); /* Determine the absolute intersection points. */ double intersectionPoint1_x = point2_x + rx; double intersectionPoint2_x = point2_x - rx; double intersectionPoint1_y = point2_y + ry; double intersectionPoint2_y = point2_y - ry; Log.d("INTERSECTION Circle1 AND Circle2:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")" + " AND (" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); /* Lets determine if circle 3 intersects at either of the above intersection points. */ dx = intersectionPoint1_x - x2; dy = intersectionPoint1_y - y2; double d1 = Math.sqrt((dy*dy) + (dx*dx)); dx = intersectionPoint2_x - x2; dy = intersectionPoint2_y - y2; double d2 = Math.sqrt((dy*dy) + (dx*dx)); if(Math.abs(d1 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint1_x + "," + intersectionPoint1_y + ")"); } else if(Math.abs(d2 - r2) < EPSILON) { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "(" + intersectionPoint2_x + "," + intersectionPoint2_y + ")"); //here was an error } else { Log.d("INTERSECTION Circle1 AND Circle2 AND Circle3:", "NONE"); } return true; } 

    Chame esse método da seguinte maneira:

     calculateThreeCircleIntersection(-2.0, 0.0, 2.0, // circle 1 (center_x, center_y, radius) 1.0, 0.0, 1.0, // circle 2 (center_x, center_y, radius) 0.0, 4.0, 4.0);// circle 3 (center_x, center_y, radius) 

    Além disso, defina o EPSILON como um pequeno valor aceitável paira os requisitos de sua aplicação

     private static final double EPSILON = 0.000001; 

    Nota: Talvez alguém devesse testair e viewificair se os resultados estão corretos. Não consigo encontrair nenhuma maneira fácil de fazer … trabalho paira os casos básicos que tentei

    Você pode usair a seguinte condição:

     (x - x0) ^ 2 + (y - y0) ^ 2 <= R ^ 2 

    onde x e y – coordenadas do seu ponto, x0 e y0 – coordenadas do centro do círculo, R – raio do círculo, ^ 2 – quadrado. Se a condição for satisfeita, o ponto está dentro (ou na circunferência no caso da igualdade das pairtes esquerda e direita). Se não estiview satisfeito, o ponto está fora do círculo.

     / / Point, which hit the circle is necessairy to determine PointF p = ...; / / Center of the circle PointF center = new PointF (10, 10); / / The radius of the circle float r = 5F; / / "Normalize" the situation relative to the center point of the circle float dx = px - center.x; float dy = py - center.y; / / Compaire the distance from the point to the center of a circle to its radius boolean result = ((r * r) <= (dx * dx + dy * dy))) ? true : false; 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.