mirror-chatterino2/src/util/DistanceBetweenPoints.hpp

21 lines
333 B
C++
Raw Normal View History

#pragma once
2017-04-24 23:00:26 +02:00
#include <QPointF>
#include <cmath>
2017-04-24 23:00:26 +02:00
namespace chatterino {
2018-06-26 17:51:31 +02:00
inline float distanceBetweenPoints(const QPointF &p1, const QPointF &p2)
2017-04-24 23:00:26 +02:00
{
QPointF tmp = p1 - p2;
float distance = 0.f;
distance += tmp.x() * tmp.x();
distance += tmp.y() * tmp.y();
return sqrt(distance);
}
} // namespace chatterino