[gegl] transform: round numerical errors in transformation matrix
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] transform: round numerical errors in transformation matrix
- Date: Thu, 9 Jul 2020 07:06:08 +0000 (UTC)
commit 5b2c7dd489ab341ba52cdffa597d49aec3d77f5a
Author: Ell <ell_se yahoo com>
Date: Thu Jul 9 09:56:56 2020 +0300
transform: round numerical errors in transformation matrix
In the transform ops, round numerical errors in the generated
matrix to the nearest integer. This is especially important when
using the NEAREST sampler, which is sensitive to boundary
conditions.
In particular, a perfect 90-deg rotation matrix cannot be generated
naively using the trigonometric functions (since there is no double
x such that cos(x) = 1 exactly), which can cause a single row or
column to be missing from the output in some cases.
operations/transform/transform-core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/operations/transform/transform-core.c b/operations/transform/transform-core.c
index 97ad47caa..c5d8ac63b 100644
--- a/operations/transform/transform-core.c
+++ b/operations/transform/transform-core.c
@@ -306,7 +306,11 @@ gegl_transform_create_matrix (OpTransform *transform,
gegl_matrix3_identity (matrix);
if (OP_TRANSFORM_GET_CLASS (transform))
- OP_TRANSFORM_GET_CLASS (transform)->create_matrix (transform, matrix);
+ {
+ OP_TRANSFORM_GET_CLASS (transform)->create_matrix (transform, matrix);
+
+ gegl_matrix3_round_error (matrix);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]