aboutsummaryrefslogtreecommitdiffstats
path: root/src/blind-matrix-shear.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-07-14 21:15:32 +0200
committerMattias Andrée <maandree@kth.se>2017-07-14 21:15:32 +0200
commitff0286325a3dd1f4fe7e29e78341b9bd63e1725c (patch)
tree784b7ac282353a4d2b26f898c24f2f8cf2379975 /src/blind-matrix-shear.c
parentFix blind-invert-matrix and increase percision of blind-to-text (diff)
downloadblind-ff0286325a3dd1f4fe7e29e78341b9bd63e1725c.tar.gz
blind-ff0286325a3dd1f4fe7e29e78341b9bd63e1725c.tar.bz2
blind-ff0286325a3dd1f4fe7e29e78341b9bd63e1725c.tar.xz
blind-matrix-{rotate,shear}: add -d
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--src/blind-matrix-shear.c13
1 files changed, 9 insertions, 4 deletions
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);