mirror-chatterino2/src/util/_DistanceBetweenPoints.hpp
2018-06-26 13:23:57 +02:00

23 lines
371 B
C++

#pragma once
#include <QPointF>
#include <cmath>
namespace chatterino {
namespace util {
static float distanceBetweenPoints(const QPointF &p1, const QPointF &p2)
{
QPointF tmp = p1 - p2;
float distance = 0.f;
distance += tmp.x() * tmp.x();
distance += tmp.y() * tmp.y();
return sqrt(distance);
}
} // namespace util
} // namespace chatterino