blind-spiral-gradient: set the value of the singularity to 0 - blind - suckless command-line video editing utility
(HTM) git clone git://git.suckless.org/blind
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 484d84596ef059463d905f07c65672b92a38a28c
(DIR) parent 862b01e204b651cb20fd7aae9caad470e86a11ca
(HTM) Author: Mattias Andrée <maandree@kth.se>
Date: Tue, 11 Jul 2017 19:18:56 +0200
blind-spiral-gradient: set the value of the singularity to 0
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat:
M src/blind-spiral-gradient.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/src/blind-spiral-gradient.c b/src/blind-spiral-gradient.c
@@ -66,12 +66,16 @@ static int with_vector;
y = (TYPE)iy - y1;\
for (ix = 0; ix < width; ix++) {\
x = (TYPE)ix - x1;\
- v = atan2(y, x);\
- if (anticlockwise)\
- v = 1 - v;\
- v -= u;\
- v += 4 * (TYPE)M_PI;\
- v = mod(v, 2 * (TYPE)M_PI);\
+ if (!x && !y) {\
+ v = 0;\
+ } else {\
+ v = atan2(y, x);\
+ if (anticlockwise)\
+ v = 1 - v;\
+ v -= u;\
+ v += 4 * (TYPE)M_PI;\
+ v = mod(v, 2 * (TYPE)M_PI);\
+ }\
if (!with_vector) {\
r = sqrt(x * x + y * y);\
} else {\