Any questions do not hesitate to contact.
/**
* Author: Ulf Lundstrom
* Date: 2009-04-06
* License: CC0
* Source:
* Description:Given 2 points on the circle (p1 and p2) and radius r of the corresponding circle, we
can determine the location of the centers (c1 and c2) of the two possible circles
*/
bool circle2PtsRad(point p1, point p2, double r, point &c) {
double d2 = (p1.x - p2.x) * (p1.x - p2.x) +
(p1.y - p2.y) * (p1.y - p2.y);
double det = r * r / d2 - 0.25;
if (det < 0.0) return false;
double h = sqrt(det);
c.x = (p1.x + p2.x) * 0.5 + (p1.y - p2.y) * h;
c.y = (p1.y + p2.y) * 0.5 + (p2.x - p1.x) * h;
return true; }
Keep in touch with Isaac Lozano Osorio!