private bool ChooseCorrectPoint(
double x1, double y1,
double x2, double y2,
double x3, double y3, bool isObtuse)
{
double d1, d2;
bool p;
// squared distance between circumcenter and intersection point
d1 = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3);
// squared distance between bisector point and intersection point
d2 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
if (isObtuse)
{
// obtuse case
if (d2 >= d1)
{
p = true; // means we have found the right point
}
else
{
p = false; // means take the other point
}
}
else
{
// non-obtuse case
if (d2 < d1)
{
p = true; // means we have found the right point
}
else
{
p = false; // means take the other point
}
}
/// HANDLE RIGHT TRIANGLE CASE!!!!!!!!!!!!!!!!!!!!!!!!!!!!
return p;
}