Fixed issue #738. Bug in transformation over arc and elliptical arc.

(grafted from 2274a082bae53cd5e10866c630e9446a1bcdaac1)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-07-27 16:01:18 +03:00
parent cbfe69756f
commit 139efc6b16
3 changed files with 28 additions and 8 deletions

View File

@ -40,6 +40,7 @@
- Fixed behaviour on Windows. Valentina asks about synchronization measurements twice.
- Fixed bug. Tape app saved default size value in wrong place.
- [#737] Valentina produces corrupted file if unite two pieces with pins.
- [#738] Bug in transformation over arc and elliptical arc.
# Version 0.5.0 May 9, 2017
- [#581] User can now filter input lists by keyword in function wizard.

View File

@ -124,11 +124,14 @@ VArc VArc::Rotate(const QPointF &originPoint, qreal degrees, const QString &pref
const QPointF p1 = VPointF::RotatePF(originPoint, GetP1(), degrees);
const QPointF p2 = VPointF::RotatePF(originPoint, GetP2(), degrees);
VArc arc(center, GetRadius(), QLineF(static_cast<QPointF>(center), p1).angle(),
QLineF(static_cast<QPointF>(center), p2).angle());
const qreal f1 = QLineF(static_cast<QPointF>(center), p1).angle();
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle();
VArc arc(center, GetRadius(), f1, f2);
arc.setName(name() + prefix);
arc.SetColor(GetColor());
arc.SetPenStyle(GetPenStyle());
arc.SetFlipped(IsFlipped());
return arc;
}
@ -140,12 +143,14 @@ VArc VArc::Flip(const QLineF &axis, const QString &prefix) const
const QPointF p1 = VPointF::FlipPF(axis, GetP1());
const QPointF p2 = VPointF::FlipPF(axis, GetP2());
VArc arc(center, GetRadius(), QLineF(static_cast<QPointF>(center), p1).angle(),
QLineF(static_cast<QPointF>(center), p2).angle());
const qreal f1 = QLineF(static_cast<QPointF>(center), p1).angle();
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle();
VArc arc(center, GetRadius(), f1, f2);
arc.setName(name() + prefix);
arc.SetFlipped(true);
arc.SetColor(GetColor());
arc.SetPenStyle(GetPenStyle());
arc.SetFlipped(not IsFlipped());
return arc;
}
@ -157,11 +162,14 @@ VArc VArc::Move(qreal length, qreal angle, const QString &prefix) const
const QPointF p1 = VPointF::MovePF(GetP1(), length, angle);
const QPointF p2 = VPointF::MovePF(GetP2(), length, angle);
VArc arc(center, GetRadius(), QLineF(static_cast<QPointF>(center), p1).angle(),
QLineF(static_cast<QPointF>(center), p2).angle());
const qreal f1 = QLineF(static_cast<QPointF>(center), p1).angle();
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle();
VArc arc(center, GetRadius(), f1, f2);
arc.setName(name() + prefix);
arc.SetColor(GetColor());
arc.SetPenStyle(GetPenStyle());
arc.SetFlipped(IsFlipped());
return arc;
}

View File

@ -127,14 +127,18 @@ VEllipticalArc &VEllipticalArc::operator =(const VEllipticalArc &arc)
VEllipticalArc VEllipticalArc::Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix) const
{
const VPointF center = GetCenter().Rotate(originPoint, degrees);
const QPointF p1 = VPointF::RotatePF(originPoint, GetP1(), degrees);
const QPointF p2 = VPointF::RotatePF(originPoint, GetP2(), degrees);
const qreal f1 = QLineF(static_cast<QPointF>(center), p1).angle() - GetRotationAngle();
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle() - GetRotationAngle();
VEllipticalArc elArc(center, GetRadius1(), GetRadius2(), f1, f2, GetRotationAngle());
elArc.setName(name() + prefix);
elArc.SetColor(GetColor());
elArc.SetPenStyle(GetPenStyle());
elArc.SetFlipped(IsFlipped());
return elArc;
}
@ -142,15 +146,18 @@ VEllipticalArc VEllipticalArc::Rotate(const QPointF &originPoint, qreal degrees,
VEllipticalArc VEllipticalArc::Flip(const QLineF &axis, const QString &prefix) const
{
const VPointF center = GetCenter().Flip(axis);
const QPointF p1 = VPointF::FlipPF(axis, GetP1());
const QPointF p2 = VPointF::FlipPF(axis, GetP2());
const qreal f1 = QLineF(static_cast<QPointF>(center), p1).angle() - GetRotationAngle();
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle() - GetRotationAngle();
VEllipticalArc elArc(center, GetRadius1(), GetRadius2(), f1, f2, GetRotationAngle());
elArc.setName(name() + prefix);
elArc.SetFlipped(true);
elArc.SetColor(GetColor());
elArc.SetPenStyle(GetPenStyle());
elArc.SetFlipped(not IsFlipped());
return elArc;
}
@ -158,14 +165,18 @@ VEllipticalArc VEllipticalArc::Flip(const QLineF &axis, const QString &prefix) c
VEllipticalArc VEllipticalArc::Move(qreal length, qreal angle, const QString &prefix) const
{
const VPointF center = GetCenter().Move(length, angle);
const QPointF p1 = VPointF::MovePF(GetP1(), length, angle);
const QPointF p2 = VPointF::MovePF(GetP2(), length, angle);
const qreal f1 = QLineF(static_cast<QPointF>(center), p1).angle() - GetRotationAngle();
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle() - GetRotationAngle();
VEllipticalArc elArc(center, GetRadius1(), GetRadius2(), f1, f2, GetRotationAngle());
elArc.setName(name() + prefix);
elArc.SetColor(GetColor());
elArc.SetPenStyle(GetPenStyle());
elArc.SetFlipped(IsFlipped());
return elArc;
}