aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-07-11 20:26:04 +0200
committerMattias Andrée <maandree@kth.se>2017-07-11 20:26:04 +0200
commitd91c5e12a53a33d50a5a0cef41255ae5b39bd55e (patch)
tree83420390a9571678b762aa72ad305702d46221c7
parentblind-spiral-gradient: fix -a (diff)
downloadblind-d91c5e12a53a33d50a5a0cef41255ae5b39bd55e.tar.gz
blind-d91c5e12a53a33d50a5a0cef41255ae5b39bd55e.tar.bz2
blind-d91c5e12a53a33d50a5a0cef41255ae5b39bd55e.tar.xz
blind-spiral-gradient: add -s
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--man/blind-spiral-gradient.112
-rw-r--r--src/blind-spiral-gradient.c10
2 files changed, 21 insertions, 1 deletions
diff --git a/man/blind-spiral-gradient.1 b/man/blind-spiral-gradient.1
index e91688f..954adcc 100644
--- a/man/blind-spiral-gradient.1
+++ b/man/blind-spiral-gradient.1
@@ -3,6 +3,8 @@
blind-spiral-gradient - Generate a video with a spiral gradient
.SH SYNOPSIS
.B blind-spiral-gradient
+[-s
+.IR spirals ]
[-al]
-w
.I width
@@ -100,6 +102,16 @@ Create a spiral that gones anticlockwise.
.B -l
Create a logarithmic spiral.
.TP
+.BR -s " "\fIspirals\fP
+Draw
+.I spirals
+spirals
+going out the specified centre instead of
+just one spiral. The spirals are uniformly
+distributed.
+.I spirals
+can be any non-zero real number.
+.TP
.BR -w " "\fIwidth\fP
The width of the video, in pixels.
.TP
diff --git a/src/blind-spiral-gradient.c b/src/blind-spiral-gradient.c
index 4cf5937..5d80bef 100644
--- a/src/blind-spiral-gradient.c
+++ b/src/blind-spiral-gradient.c
@@ -1,10 +1,11 @@
/* See LICENSE file for copyright and license details. */
#include "common.h"
-USAGE("[-al] -w width -h height")
+USAGE("[-s spirals] [-al] -w width -h height")
static int anticlockwise = 0;
static int logarithmic = 0;
+static double spirals = 1;
static size_t width = 0;
static size_t height = 0;
static int with_params;
@@ -58,6 +59,7 @@ static int with_vector;
y2 -= y1;\
u = atan2(y2, x2);\
b = sqrt(x2 * x2 + y2 * y2);\
+ b *= spirals;\
if (logarithmic)\
b = log(b);\
b /= pow(2 * (TYPE)M_PI, e);\
@@ -96,6 +98,7 @@ static int with_vector;
r = pow(r / b, ep);\
r = (r - v) / (2 * (TYPE)M_PI);\
}\
+ r = mod(r, 1 / (TYPE)spirals) * (TYPE)spirals + r - mod(r, (TYPE)1);\
buf[ptr][0] = buf[ptr][1] = buf[ptr][2] = buf[ptr][3] = r;\
if (++ptr == ELEMENTSOF(buf)) {\
ewriteall(STDOUT_FILENO, buf, sizeof(buf), "<stdout>");\
@@ -123,6 +126,11 @@ main(int argc, char *argv[])
case 'l':
logarithmic = 1;
break;
+ case 's':
+ spirals = etolf_flag('s', UARGF());
+ if (!spirals)
+ eprintf("the value of -s must not be 0");
+ break;
case 'w':
width = etozu_flag('w', UARGF(), 1, SIZE_MAX);
break;