Merged in ValentinaZhuravska/valentina/feature (pull request #108)
Better to use qDegreesToRadians than M_PI/180 --HG-- branch : develop
This commit is contained in:
commit
569b666756
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QtCore/qmath.h>
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VAbstractCubicBezier::VAbstractCubicBezier(const GOType &type, const quint32 &idObject, const Draw &mode)
|
VAbstractCubicBezier::VAbstractCubicBezier(const GOType &type, const quint32 &idObject, const Draw &mode)
|
||||||
|
|
|
@ -123,7 +123,7 @@ VArc::~VArc()
|
||||||
*/
|
*/
|
||||||
qreal VArc::GetLength() const
|
qreal VArc::GetLength() const
|
||||||
{
|
{
|
||||||
qreal length = (M_PI * d->radius)/180 * AngleArc();
|
qreal length = d->radius * qDegreesToRadians(AngleArc());
|
||||||
if (d->isFlipped)
|
if (d->isFlipped)
|
||||||
{
|
{
|
||||||
length *= -1;
|
length *= -1;
|
||||||
|
@ -232,7 +232,7 @@ QVector<QPointF> VArc::GetPoints() const
|
||||||
|
|
||||||
for (int i = 0; i < sectionAngle.size(); ++i)
|
for (int i = 0; i < sectionAngle.size(); ++i)
|
||||||
{
|
{
|
||||||
const qreal lDistance = GetRadius() * 4.0/3.0 * qTan(M_PI/180.0 * sectionAngle.at(i) * 0.25);
|
const qreal lDistance = GetRadius() * 4.0/3.0 * qTan(qDegreesToRadians(sectionAngle.at(i)) * 0.25);
|
||||||
|
|
||||||
const QPointF center = GetCenter().toQPointF();
|
const QPointF center = GetCenter().toQPointF();
|
||||||
|
|
||||||
|
@ -297,7 +297,8 @@ QPointF VArc::CutArc(const qreal &length, VArc &arc1, VArc &arc2) const
|
||||||
len = length;
|
len = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal n = (len*180)/(M_PI*d->radius); // n - is angle in degrees
|
qreal n = qRadiansToDegrees(len/d->radius); // n - is angle in degrees
|
||||||
|
|
||||||
QLineF line(GetCenter().toQPointF(), GetP1());
|
QLineF line(GetCenter().toQPointF(), GetP1());
|
||||||
line.setAngle(line.angle()+n);
|
line.setAngle(line.angle()+n);
|
||||||
|
|
||||||
|
@ -374,7 +375,7 @@ void VArc::FindF2(qreal length)
|
||||||
length = MaxLength();
|
length = MaxLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal arcAngle = (qAbs(length)*180)/(M_PI*d->radius);
|
qreal arcAngle = qAbs(qRadiansToDegrees(length/d->radius));
|
||||||
|
|
||||||
if (d->isFlipped)
|
if (d->isFlipped)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#define VDRAWTOOL_H
|
#define VDRAWTOOL_H
|
||||||
|
|
||||||
#include "../vabstracttool.h"
|
#include "../vabstracttool.h"
|
||||||
#include "../../dialogs/tools/dialogtool.h"
|
#include "dialogs/tools/dialogtool.h"
|
||||||
#include "../vwidgets/vmaingraphicsview.h"
|
#include "../vwidgets/vmaingraphicsview.h"
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include "../ifc/xml/vabstractpattern.h"
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "../vwidgets/vmaingraphicsscene.h"
|
#include "../vwidgets/vmaingraphicsscene.h"
|
||||||
#include "../visualization/visualization.h"
|
#include "visualization/visualization.h"
|
||||||
|
|
||||||
class QDomElement;
|
class QDomElement;
|
||||||
class QLineF;
|
class QLineF;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#ifndef VDATATOOL_H
|
#ifndef VDATATOOL_H
|
||||||
#define VDATATOOL_H
|
#define VDATATOOL_H
|
||||||
|
|
||||||
#include "../../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
#include "../vmisc/logging.h"
|
#include "../vmisc/logging.h"
|
||||||
|
|
||||||
Q_DECLARE_LOGGING_CATEGORY(vTool)
|
Q_DECLARE_LOGGING_CATEGORY(vTool)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user