LibGfx: Add a 'Point::absolute_relative_distance_to(Point)'

This is significantly more elegant than subtracting the points and
constructing another point from the abs() of their individual
components.
This commit is contained in:
AnotherTest 2020-11-30 10:00:15 +03:30 committed by Andreas Kling
parent 169beff21e
commit b2d698472b
Notes: sideshowbarker 2024-07-19 01:09:10 +09:00

View file

@ -208,6 +208,11 @@ public:
return sqrtf(powf(m_x - other.m_x, 2.0f) + powf(m_y - other.m_y, 2.0f));
}
Point absolute_relative_distance_to(const Point& other) const
{
return { abs(dx_relative_to(other)), abs(dy_relative_to(other)) };
}
template<typename U>
Point<U> to_type() const
{