From b09cad8c423b309daaeb7dccd37645402fed33c9 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 12 Feb 2017 15:02:07 +0200 Subject: [PATCH] GCC warnings. --HG-- branch : develop --- src/libs/vgeometry/vgobject.cpp | 19 +++++-------------- src/libs/vgeometry/vgobject.h | 4 ++-- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/libs/vgeometry/vgobject.cpp b/src/libs/vgeometry/vgobject.cpp index e964337d0..a8146e252 100644 --- a/src/libs/vgeometry/vgobject.cpp +++ b/src/libs/vgeometry/vgobject.cpp @@ -486,8 +486,8 @@ bool VGObject::IsPointOnLineSegment(const QPointF &t, const QPointF &p1, const Q */ bool VGObject::IsPointOnLineviaPDP(const QPointF &t, const QPointF &p1, const QPointF &p2) { - const auto p = qAbs(PerpDotProduct(p1, p2, t)); - const auto e = GetEpsilon(p1, p2); + const double p = qAbs(PerpDotProduct(p1, p2, t)); + const double e = GetEpsilon(p1, p2); // We can't use common "<=" here because of the floating-point accuraccy problem return p < e || VFuzzyComparePossibleNulls(p, e); } @@ -498,18 +498,9 @@ bool VGObject::IsPointOnLineviaPDP(const QPointF &t, const QPointF &p1, const QP * This is actually the same as the area of the triangle defined by the three points, multiplied by 2. * @return 2 * triangleArea(a,b,c) */ -long double VGObject::PerpDotProduct(const QPointF &p1, const QPointF &p2, const QPointF &t) +double VGObject::PerpDotProduct(const QPointF &p1, const QPointF &p2, const QPointF &t) { - const auto p1x = static_cast(p1.x()); - const auto p1y = static_cast(p1.y()); - - const auto p2x = static_cast(p2.x()); - const auto p2y = static_cast(p2.y()); - - const auto tx = static_cast(t.x()); - const auto ty = static_cast(t.y()); - - return (p1x - tx) * (p2y - ty) - (p1y - ty) * (p2x - tx); + return (p1.x() - t.x()) * (p2.y() - t.y()) - (p1.y() - t.y()) * (p2.x() - t.x()); } //--------------------------------------------------------------------------------------------------------------------- @@ -522,7 +513,7 @@ long double VGObject::PerpDotProduct(const QPointF &p1, const QPointF &p2, const * line e1=(p1, p2), e.g. the minimal area calucalted with PerpDotProduc() if point still not on the line. This distance * is controled by variable accuracyPointOnLine */ -long double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2) +double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2) { QLineF line(p1, p2); line.setAngle(line.angle() + 90); diff --git a/src/libs/vgeometry/vgobject.h b/src/libs/vgeometry/vgobject.h index 18894c77f..eec5b7906 100644 --- a/src/libs/vgeometry/vgobject.h +++ b/src/libs/vgeometry/vgobject.h @@ -100,8 +100,8 @@ protected: private: QSharedDataPointer d; - static long double PerpDotProduct(const QPointF &p1, const QPointF &p2, const QPointF &t); - static long double GetEpsilon(const QPointF &p1, const QPointF &p2); + static double PerpDotProduct(const QPointF &p1, const QPointF &p2, const QPointF &t); + static double GetEpsilon(const QPointF &p1, const QPointF &p2); static int PointInCircle (const QPointF &p, const QPointF ¢er, qreal radius); };