parent
9a898a7c99
commit
6530b57a8a
|
@ -129,7 +129,37 @@ QPointF VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *ar
|
||||||
const int res = VGObject::IntersectionCircles(arc1->GetCenter().toQPointF(), arc1->GetRadius(),
|
const int res = VGObject::IntersectionCircles(arc1->GetCenter().toQPointF(), arc1->GetRadius(),
|
||||||
arc2->GetCenter().toQPointF(), arc2->GetRadius(), p1, p2);
|
arc2->GetCenter().toQPointF(), arc2->GetRadius(), p1, p2);
|
||||||
|
|
||||||
|
QLineF r1Arc1(arc1->GetCenter().toQPointF(), p1);
|
||||||
|
r1Arc1.setLength(r1Arc1.length()+10);
|
||||||
|
|
||||||
|
QLineF r1Arc2(arc2->GetCenter().toQPointF(), p1);
|
||||||
|
r1Arc2.setLength(r1Arc2.length()+10);
|
||||||
|
|
||||||
|
QLineF r2Arc1(arc1->GetCenter().toQPointF(), p2);
|
||||||
|
r2Arc1.setLength(r2Arc1.length()+10);
|
||||||
|
|
||||||
|
QLineF r2Arc2(arc2->GetCenter().toQPointF(), p2);
|
||||||
|
r2Arc2.setLength(r2Arc2.length()+10);
|
||||||
|
|
||||||
switch(res)
|
switch(res)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
int localRes = 0;
|
||||||
|
bool flagP1 = false;
|
||||||
|
|
||||||
|
if (arc1->IsIntersectLine(r1Arc1) && arc2->IsIntersectLine(r1Arc2))
|
||||||
|
{
|
||||||
|
++localRes;
|
||||||
|
flagP1 = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arc1->IsIntersectLine(r2Arc1) && arc2->IsIntersectLine(r2Arc2))
|
||||||
|
{
|
||||||
|
++localRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(localRes)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
if (pType == CrossArcsPoint::FirstPoint)
|
if (pType == CrossArcsPoint::FirstPoint)
|
||||||
|
@ -142,7 +172,32 @@ QPointF VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *ar
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
if (flagP1)
|
||||||
|
{
|
||||||
return p1;
|
return p1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return p2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
return QPointF(0, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
if (arc1->IsIntersectLine(r1Arc1) && arc2->IsIntersectLine(r1Arc2))
|
||||||
|
{
|
||||||
|
return p1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QPointF(0, 0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
@ -169,6 +169,13 @@ QVector<QPointF> VAbstractCurve::IntersectLine(const QLineF &line) const
|
||||||
return intersections;
|
return intersections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VAbstractCurve::IsIntersectLine(const QLineF &line) const
|
||||||
|
{
|
||||||
|
const QVector<QPointF> points = IntersectLine(line);
|
||||||
|
return not points.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPainterPath VAbstractCurve::ShowDirection(const QVector<QPointF> &points) const
|
QPainterPath VAbstractCurve::ShowDirection(const QVector<QPointF> &points) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
virtual QPainterPath GetPath(PathDirection direction = PathDirection::Hide) const;
|
virtual QPainterPath GetPath(PathDirection direction = PathDirection::Hide) const;
|
||||||
virtual qreal GetLength() const =0;
|
virtual qreal GetLength() const =0;
|
||||||
virtual QVector<QPointF> IntersectLine(const QLineF &line) const;
|
virtual QVector<QPointF> IntersectLine(const QLineF &line) const;
|
||||||
|
virtual bool IsIntersectLine(const QLineF &line) const;
|
||||||
protected:
|
protected:
|
||||||
QPainterPath ShowDirection(const QVector<QPointF> &points) const;
|
QPainterPath ShowDirection(const QVector<QPointF> &points) const;
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user