mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
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:
parent
169beff21e
commit
b2d698472b
Notes:
sideshowbarker
2024-07-19 01:09:10 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/b2d698472b4 Pull-request: https://github.com/SerenityOS/serenity/pull/4177 Issue: https://github.com/SerenityOS/serenity/issues/4167 Issue: https://github.com/SerenityOS/serenity/issues/4168 Issue: https://github.com/SerenityOS/serenity/issues/4170 Issue: https://github.com/SerenityOS/serenity/issues/4171 Reviewed-by: https://github.com/awesomekling
1 changed files with 5 additions and 0 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue