From ff0286325a3dd1f4fe7e29e78341b9bd63e1725c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 14 Jul 2017 21:15:32 +0200 Subject: blind-matrix-{rotate,shear}: add -d MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/blind-matrix-shear.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/blind-matrix-shear.c') diff --git a/src/blind-matrix-shear.c b/src/blind-matrix-shear.c index a4c742b..0a4310e 100644 --- a/src/blind-matrix-shear.c +++ b/src/blind-matrix-shear.c @@ -1,16 +1,18 @@ /* See LICENSE file for copyright and license details. */ #include "common.h" -USAGE("[-ac]") +USAGE("[-a [-d]][c]") static int by_angle = 0; static int per_channel = 0; +static int in_degrees = 0; #define PROCESS(TYPE)\ do {\ typedef TYPE pixel_t[4];\ pixel_t matrix[9];\ pixel_t buf[2];\ + TYPE conv = in_degrees ? (TYPE)(M_PI / 180.) : 1;\ int i;\ \ for (i = 0; i < 4; i++) {\ @@ -22,8 +24,8 @@ static int per_channel = 0; while (eread_frame(stream, buf)) {\ if (by_angle) {\ for (i = !per_channel; i < (per_channel ? 4 : 2); i++) {\ - buf[0][i] = tan(buf[0][i]);\ - buf[1][i] = tan(buf[1][i]);\ + buf[0][i] = tan(buf[0][i] * conv);\ + buf[1][i] = tan(buf[1][i] * conv);\ }\ }\ if (per_channel) {\ @@ -55,11 +57,14 @@ main(int argc, char *argv[]) case 'c': per_channel = 1; break; + case 'd': + in_degrees = 1; + break; default: usage(); } ARGEND; - if (argc) + if (argc || (in_degrees && !by_angle)) usage(); eopen_stream(&stream, NULL); -- cgit v1.2.3-70-g09d2