GCC warnings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-02-12 15:02:07 +02:00
parent 77aa8e6f0e
commit b09cad8c42
2 changed files with 7 additions and 16 deletions

View file

@ -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<long double>(p1.x());
const auto p1y = static_cast<long double>(p1.y());
const auto p2x = static_cast<long double>(p2.x());
const auto p2y = static_cast<long double>(p2.y());
const auto tx = static_cast<long double>(t.x());
const auto ty = static_cast<long double>(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);

View file

@ -100,8 +100,8 @@ protected:
private:
QSharedDataPointer<VGObjectData> 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 &center, qreal radius);
};