Fixed bug with circle intersection. Case with one real and one theoretical
intersection. --HG-- branch : release
This commit is contained in:
parent
37dbe31050
commit
0f33cb6352
|
@ -106,6 +106,13 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF ¢e
|
||||||
return p1;
|
return p1;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
{
|
||||||
|
const bool flagP1 = VGObject::PointInSegment (p1, firstPoint, secondPoint);
|
||||||
|
const bool flagP2 = VGObject::PointInSegment (p2, firstPoint, secondPoint);
|
||||||
|
if ((flagP1 == true && flagP2 == true) ||
|
||||||
|
(flagP1 == false && flagP2 == false)/*In case we have something wrong*/)
|
||||||
|
{
|
||||||
|
// We don't have options for choosing correct point. Use closest to segment first point.
|
||||||
if (QLineF(firstPoint, p1).length() <= QLineF(firstPoint, p2).length())
|
if (QLineF(firstPoint, p1).length() <= QLineF(firstPoint, p2).length())
|
||||||
{
|
{
|
||||||
return p1;
|
return p1;
|
||||||
|
@ -114,7 +121,20 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF ¢e
|
||||||
{
|
{
|
||||||
return p2;
|
return p2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // In this case we have one real and one theoretical intersection.
|
||||||
|
if (flagP1)
|
||||||
|
{
|
||||||
|
return p1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return p2;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
qDebug() << "Unxpected value" << res;
|
qDebug() << "Unxpected value" << res;
|
||||||
return QPointF();
|
return QPointF();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user