ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/srcdraw.c
(Generate patch)

Comparing ray/src/rt/srcdraw.c (file contents):
Revision 2.10 by greg, Fri Oct 24 05:29:43 2003 UTC vs.
Revision 2.11 by schorsch, Tue Mar 30 16:13:01 2004 UTC

# Line 10 | Line 10 | static const char      RCSid[] = "$Id$";
10   #include "copyright.h"
11  
12   #include  "ray.h"
13
13   #include  "view.h"
15
14   #include  "source.h"
15  
16  
# Line 34 | Line 32 | extern VIEW    ourview;                /* our view parameters */
32   extern int      hres, vres;             /* our image resolution */
33   static SPLIST   *sphead = NULL;         /* our list of source polys */
34  
35 + static int inregion(RREAL p[2], double cv, int crit);
36 + static void clipregion(RREAL a[2], RREAL b[2], double cv, int crit, RREAL r[2]);
37 + static int hp_clip_poly(RREAL vl[][2], int nv, double cv, int crit,
38 +                RREAL vlo[][2]);
39 + static int box_clip_poly(RREAL vl[MAXVERT][2], int nv,
40 +                double xl, double xr, double yb, double ya, RREAL vlo[MAXVERT][2]);
41 + static double minw2(RREAL vl[][2], int nv, double ar2);
42 + static void convex_center(RREAL vl[][2], int nv, RREAL cv[2]);
43 + static double poly_area(RREAL vl[][2], int nv);
44 + static int convex_hull(RREAL vl[][2], int nv, RREAL vlo[][2]);
45 + static void spinsert(int sn, RREAL vl[][2], int nv);
46 + static int sourcepoly(int sn, RREAL sp[MAXVERT][2]);
47  
48 +
49   static int
50 < inregion(p, cv, crit)                   /* check if vertex is in region */
51 < RREAL   p[2];
52 < double  cv;
53 < int     crit;
50 > inregion(                       /* check if vertex is in region */
51 >        RREAL   p[2],
52 >        double  cv,
53 >        int     crit
54 > )
55   {
56          switch (crit) {
57          case CLIP_ABOVE:
# Line 55 | Line 67 | int    crit;
67   }
68  
69  
70 < static
71 < clipregion(a, b, cv, crit, r)           /* find intersection with boundary */
72 < register RREAL  a[2], b[2];
73 < double  cv;
74 < int     crit;
75 < RREAL   r[2];   /* return value */
70 > static void
71 > clipregion(             /* find intersection with boundary */
72 >        register RREAL  a[2],
73 >        register RREAL  b[2],
74 >        double  cv,
75 >        int     crit,
76 >        RREAL   r[2]    /* return value */
77 > )
78   {
79          switch (crit) {
80          case CLIP_ABOVE:
# Line 78 | Line 92 | RREAL  r[2];   /* return value */
92  
93  
94   static int
95 < hp_clip_poly(vl, nv, cv, crit, vlo)     /* clip polygon to half-plane */
96 < RREAL   vl[][2];
97 < int     nv;
98 < double  cv;
99 < int     crit;
100 < RREAL   vlo[][2];       /* return value */
95 > hp_clip_poly(   /* clip polygon to half-plane */
96 >        RREAL   vl[][2],
97 >        int     nv,
98 >        double  cv,
99 >        int     crit,
100 >        RREAL   vlo[][2]        /* return value */
101 > )
102   {
103          RREAL   *s, *p;
104          register int    j, nvo;
# Line 105 | Line 120 | RREAL  vlo[][2];       /* return value */
120  
121  
122   static int
123 < box_clip_poly(vl, nv, xl, xr, yb, ya, vlo)      /* clip polygon to box */
124 < RREAL   vl[MAXVERT][2];
125 < int     nv;
126 < double  xl, xr, yb, ya;
127 < RREAL   vlo[MAXVERT][2];        /* return value */
123 > box_clip_poly(  /* clip polygon to box */
124 >        RREAL   vl[MAXVERT][2],
125 >        int     nv,
126 >        double  xl,
127 >        double  xr,
128 >        double  yb,
129 >        double  ya,
130 >        RREAL   vlo[MAXVERT][2] /* return value */
131 > )
132   {
133          RREAL   vlt[MAXVERT][2];
134          int     nvt, nvo;
# Line 124 | Line 143 | RREAL  vlo[MAXVERT][2];        /* return value */
143  
144  
145   static double
146 < minw2(vl, nv, ar2)                      /* compute square of minimum width */
147 < RREAL   vl[][2];
148 < int     nv;
149 < double  ar2;
146 > minw2(                  /* compute square of minimum width */
147 >        RREAL   vl[][2],
148 >        int     nv,
149 >        double  ar2
150 > )
151   {
152          double  d2, w2, w2min, w2max;
153          register RREAL  *p0, *p1, *p2;
# Line 156 | Line 176 | double ar2;
176   }
177  
178  
179 < static
180 < convex_center(vl, nv, cv)               /* compute center of convex polygon */
181 < register RREAL  vl[][2];
182 < int     nv;
183 < RREAL   cv[2];          /* return value */
179 > static void
180 > convex_center(          /* compute center of convex polygon */
181 >        register RREAL  vl[][2],
182 >        int     nv,
183 >        RREAL   cv[2]           /* return value */
184 > )
185   {
186          register int    i;
187                                          /* simple average (suboptimal) */
# Line 175 | Line 196 | RREAL  cv[2];          /* return value */
196  
197  
198   static double
199 < poly_area(vl, nv)                       /* compute area of polygon */
200 < register RREAL  vl[][2];
201 < int     nv;
199 > poly_area(                      /* compute area of polygon */
200 >        register RREAL  vl[][2],
201 >        int     nv
202 > )
203   {
204          double  a;
205          RREAL   v0[2], v1[2];
# Line 197 | Line 219 | int    nv;
219  
220  
221   static int
222 < convex_hull(vl, nv, vlo)                /* compute polygon's convex hull */
223 < RREAL   vl[][2];
224 < int     nv;
225 < RREAL   vlo[][2];       /* return value */
222 > convex_hull(            /* compute polygon's convex hull */
223 >        RREAL   vl[][2],
224 >        int     nv,
225 >        RREAL   vlo[][2]        /* return value */
226 > )
227   {
228          int     nvo, nvt;
229          RREAL   vlt[MAXVERT][2];
# Line 232 | Line 255 | RREAL  vlo[][2];       /* return value */
255   }
256  
257  
258 < static
259 < spinsert(sn, vl, nv)                    /* insert new source polygon */
260 < int     sn;
261 < RREAL   vl[][2];
262 < int     nv;
258 > static void
259 > spinsert(                       /* insert new source polygon */
260 >        int     sn,
261 >        RREAL   vl[][2],
262 >        int     nv
263 > )
264   {
265          register SPLIST *spn;
266          register int    i;
# Line 258 | Line 282 | int    nv;
282   }
283  
284  
285 < int
286 < sourcepoly(sn, sp)                      /* compute image polygon for source */
287 < int     sn;
288 < RREAL   sp[MAXVERT][2];
285 > static int
286 > sourcepoly(                     /* compute image polygon for source */
287 >        int     sn,
288 >        RREAL   sp[MAXVERT][2]
289 > )
290   {
291          static short    cubeord[8][6] = {{1,3,2,6,4,5},{0,4,5,7,3,2},
292                                           {0,1,3,7,6,4},{0,1,5,7,6,2},
# Line 328 | Line 353 | RREAL  sp[MAXVERT][2];
353  
354  
355                          /* initialize by finding sources smaller than rad */
356 < init_drawsources(rad)
357 < int     rad;                            /* source sample size */
356 > extern void
357 > init_drawsources(
358 >        int     rad                             /* source sample size */
359 > )
360   {
361          RREAL   spoly[MAXVERT][2];
362          int     nsv;
# Line 357 | Line 384 | int    rad;                            /* source sample size */
384          }
385   }
386  
387 < void                    /* add sources smaller than rad to computed subimage */
388 < drawsources(pic, zbf, x0, xsiz, y0, ysiz)
389 < COLOR   *pic[];                         /* subimage pixel value array */
390 < float   *zbf[];                         /* subimage distance array (opt.) */
391 < int     x0, xsiz, y0, ysiz;             /* origin and size of subimage */
387 > extern void                     /* add sources smaller than rad to computed subimage */
388 > drawsources(
389 >        COLOR   *pic[],                         /* subimage pixel value array */
390 >        float   *zbf[],                         /* subimage distance array (opt.) */
391 >        int     x0,                             /* origin and size of subimage */
392 >        int     xsiz,
393 >        int     y0,
394 >        int     ysiz
395 > )
396   {
397          RREAL   spoly[MAXVERT][2], ppoly[MAXVERT][2];
398          int     nsv, npv;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines