1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:28:11 +00:00

LibGfx+PixelPaint: Fix distortions in convolutions with size != 4 or 5

This commit is contained in:
AnotherTest 2020-10-04 22:56:20 +03:30 committed by Andreas Kling
parent 95434d70ed
commit 93f4388e45
3 changed files with 32 additions and 12 deletions

View file

@ -87,6 +87,23 @@ public:
return *this * inv_length;
}
Vector3 clamped(T m, T x) const
{
Vector3 copy { *this };
copy.clamp(m, x);
return copy;
}
void clamp(T min_value, T max_value)
{
m_x = max(min_value, m_x);
m_y = max(min_value, m_y);
m_z = max(min_value, m_z);
m_x = min(max_value, m_x);
m_y = min(max_value, m_y);
m_z = min(max_value, m_z);
}
void normalize()
{
T inv_length = 1 / length();