Little fixes
--HG-- branch : feature
This commit is contained in:
parent
37eb0e9e21
commit
6fc86543ec
|
@ -125,13 +125,13 @@ VEllipticalArc::~VEllipticalArc()
|
||||||
*/
|
*/
|
||||||
qreal VEllipticalArc::GetLength() const
|
qreal VEllipticalArc::GetLength() const
|
||||||
{
|
{
|
||||||
qreal length;
|
qreal length = 0;
|
||||||
QPainterPath elArc;
|
QPainterPath elArc;
|
||||||
QVector<QPointF> points = GetPoints();
|
QVector<QPointF> points = GetPoints();
|
||||||
elArc.moveTo(points.at(0));
|
elArc.moveTo(points.at(0));
|
||||||
for (qint32 i = 1; i < points.count(); ++i)
|
for (qint32 i = 1; i < points.count(); ++i)
|
||||||
{
|
{
|
||||||
elArc.lineTo(points.at(i));
|
elArc.lineTo(points.at(i));
|
||||||
}
|
}
|
||||||
length = elArc.length();
|
length = elArc.length();
|
||||||
|
|
||||||
|
@ -344,7 +344,9 @@ void VEllipticalArc::FindF2(qreal length)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VEllipticalArc::MaxLength() const
|
qreal VEllipticalArc::MaxLength() const
|
||||||
{
|
{
|
||||||
return M_PI*(d->radius1+d->radius2);
|
const qreal h = ((d->radius1-d->radius2)*(d->radius1-d->radius2))/((d->radius1+d->radius2)*(d->radius1+d->radius2));
|
||||||
|
const qreal ellipseLength = M_PI*(d->radius1+d->radius2)*(1+3*h/(10+qSqrt(4-3*h)));
|
||||||
|
return ellipseLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -190,19 +190,19 @@ void TST_VArc::TestGetPoints()
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
qreal gSquere = 0.0;// geometry squere
|
qreal gSquere = 0.0;// geometry square
|
||||||
|
|
||||||
if (qFuzzyCompare(arc.AngleArc(), 360.0))
|
if (qFuzzyCompare(arc.AngleArc(), 360.0))
|
||||||
{// circle squere
|
{// circle square
|
||||||
gSquere = M_PI * radius * radius;
|
gSquere = M_PI * radius * radius;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{// sector squere
|
{// sector square
|
||||||
gSquere = (M_PI * radius * radius) / 360.0 * arc.AngleArc();
|
gSquere = (M_PI * radius * radius) / 360.0 * arc.AngleArc();
|
||||||
points.append(center.toQPointF());
|
points.append(center.toQPointF());
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculated squere
|
// calculated square
|
||||||
const qreal cSquare = qAbs(VAbstractDetail::SumTrapezoids(points)/2.0);
|
const qreal cSquare = qAbs(VAbstractDetail::SumTrapezoids(points)/2.0);
|
||||||
const qreal value = qAbs(gSquere - cSquare);
|
const qreal value = qAbs(gSquere - cSquare);
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
|
|
Loading…
Reference in New Issue
Block a user