Better to use qDegreesToRadians than M_PI/180
--HG-- branch : feature
This commit is contained in:
parent
c95b162c0d
commit
66fbcab64c
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user