| 5 |
|
* pf2.c - routines used by pfilt. |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
– |
#include <stdio.h> |
| 9 |
– |
#include <stdlib.h> |
| 10 |
– |
#include <math.h> |
| 11 |
– |
|
| 12 |
– |
#include "rterror.h" |
| 13 |
– |
#include "random.h" |
| 14 |
– |
#include "color.h" |
| 8 |
|
#include "pfilt.h" |
| 9 |
+ |
#include "random.h" |
| 10 |
|
|
| 17 |
– |
#define PI 3.14159265359 |
| 18 |
– |
#define FTINY (1e-6) |
| 19 |
– |
|
| 11 |
|
#define AVGLVL 0.5 /* target mean brightness */ |
| 12 |
|
|
| 13 |
|
double avgbrt; /* average picture brightness */ |
| 76 |
|
copycolor(hp->val, scan[x]); |
| 77 |
|
hp->x = x; |
| 78 |
|
hp->y = y; |
| 79 |
< |
hp->slope = tan(PI*(0.5-(random()%npts+0.5)/npts)); |
| 79 |
> |
hp->slope = tan(PI*(0.5-(irandom(npts)+0.5)/npts)); |
| 80 |
|
hp->next = head; |
| 81 |
|
head = hp; |
| 82 |
|
} |