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
commit 93f4388e45
Notes: sideshowbarker 2024-07-19 01:55:05 +09:00
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();