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

Comparing ray/src/rt/rv3.c (file contents):
Revision 2.10 by greg, Sat Feb 22 02:07:29 2003 UTC vs.
Revision 2.37 by greg, Tue Mar 20 03:37:08 2012 UTC

# Line 7 | Line 7 | static const char      RCSid[] = "$Id$";
7   *  External symbols declared in rpaint.h
8   */
9  
10 < /* ====================================================================
11 < * The Radiance Software License, Version 1.0
12 < *
13 < * Copyright (c) 1990 - 2002 The Regents of the University of California,
14 < * through Lawrence Berkeley National Laboratory.   All rights reserved.
15 < *
16 < * Redistribution and use in source and binary forms, with or without
17 < * modification, are permitted provided that the following conditions
18 < * are met:
19 < *
20 < * 1. Redistributions of source code must retain the above copyright
21 < *         notice, this list of conditions and the following disclaimer.
22 < *
23 < * 2. Redistributions in binary form must reproduce the above copyright
24 < *       notice, this list of conditions and the following disclaimer in
25 < *       the documentation and/or other materials provided with the
26 < *       distribution.
27 < *
28 < * 3. The end-user documentation included with the redistribution,
29 < *           if any, must include the following acknowledgment:
30 < *             "This product includes Radiance software
31 < *                 (http://radsite.lbl.gov/)
32 < *                 developed by the Lawrence Berkeley National Laboratory
33 < *               (http://www.lbl.gov/)."
34 < *       Alternately, this acknowledgment may appear in the software itself,
35 < *       if and wherever such third-party acknowledgments normally appear.
36 < *
37 < * 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
38 < *       and "The Regents of the University of California" must
39 < *       not be used to endorse or promote products derived from this
40 < *       software without prior written permission. For written
41 < *       permission, please contact [email protected].
42 < *
43 < * 5. Products derived from this software may not be called "Radiance",
44 < *       nor may "Radiance" appear in their name, without prior written
45 < *       permission of Lawrence Berkeley National Laboratory.
46 < *
47 < * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
48 < * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
49 < * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
50 < * DISCLAIMED.   IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
51 < * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
52 < * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
53 < * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
54 < * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
55 < * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
56 < * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
57 < * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 < * SUCH DAMAGE.
59 < * ====================================================================
60 < *
61 < * This software consists of voluntary contributions made by many
62 < * individuals on behalf of Lawrence Berkeley National Laboratory.   For more
63 < * information on Lawrence Berkeley National Laboratory, please see
64 < * <http://www.lbl.gov/>.
65 < */
10 > #include "copyright.h"
11  
12 < #include  "ray.h"
12 > #include <string.h>
13  
14 + #include  "ray.h"
15   #include  "rpaint.h"
70
16   #include  "random.h"
17  
18   #ifndef WFLUSH
19 < #ifdef SPEED
75 < #define WFLUSH          (5*SPEED)
76 < #else
77 < #define WFLUSH          100             /* flush after this many rays */
19 > #define WFLUSH          64              /* flush after this many primary rays */
20   #endif
21 + #ifndef WFLUSH1
22 + #define WFLUSH1         512             /* or this many total rays */
23   #endif
24  
25 +
26   #ifdef  SMLFLT
27   #define  sscanvec(s,v)  (sscanf(s,"%f %f %f",v,v+1,v+2)==3)
28   #else
29   #define  sscanvec(s,v)  (sscanf(s,"%lf %lf %lf",v,v+1,v+2)==3)
30   #endif
31  
32 + extern int      ray_pnprocs;
33  
34 + static RNUMBER  niflush;                /* flushes since newimage() */
35 +
36   int
37 < getrect(s, r)                           /* get a box */
38 < char  *s;
39 < register RECT  *r;
37 > getrect(                                /* get a box */
38 >        char  *s,
39 >        RECT  *r
40 > )
41   {
42          int  x0, y0, x1, y1;
43  
# Line 133 | Line 82 | register RECT  *r;
82  
83  
84   int
85 < getinterest(s, direc, vec, mp)          /* get area of interest */
86 < char  *s;
87 < int  direc;
88 < FVECT  vec;
89 < double  *mp;
85 > getinterest(            /* get area of interest */
86 >        char  *s,
87 >        int  direc,
88 >        FVECT  vec,
89 >        double  *mp
90 > )
91   {
92          int  x, y;
93          RAY  thisray;
94 <        register int  i;
94 >        int  i;
95  
96          if (sscanf(s, "%lf", mp) != 1)
97                  *mp = 1.0;
# Line 163 | Line 113 | double  *mp;
113                          return(-1);
114                  }
115                  if (!direc || ourview.type == VT_PAR) {
116 <                        rayorigin(&thisray, NULL, PRIMARY, 1.0);
116 >                        rayorigin(&thisray, PRIMARY, NULL, NULL);
117                          if (!localhit(&thisray, &thescene)) {
118                                  error(COMMAND, "not a local object");
119                                  return(-1);
# Line 177 | Line 127 | double  *mp;
127                                  VCOPY(vec, thisray.rdir);
128                  else
129                          VCOPY(vec, thisray.rop);
130 <        } else if (direc)
131 <                        for (i = 0; i < 3; i++)
132 <                                vec[i] -= ourview.vp[i];
130 >        } else if (direc) {
131 >                for (i = 0; i < 3; i++)
132 >                        vec[i] -= ourview.vp[i];
133 >                if (normalize(vec) == 0.0) {
134 >                        error(COMMAND, "point at view origin");
135 >                        return(-1);
136 >                }
137 >        }
138          return(0);
139   }
140  
141  
142   float *         /* keep consistent with COLOR typedef */
143 < greyof(col)                             /* convert color to greyscale */
144 < register COLOR  col;
143 > greyof(                         /* convert color to greyscale */
144 >        COLOR  col
145 > )
146   {
147          static COLOR  gcol;
148          double  b;
# Line 196 | Line 152 | register COLOR  col;
152          return(gcol);
153   }
154  
155 + static void
156 + recolor(                                        /* recolor the given node */
157 +        PNODE *p
158 + )
159 + {
160 +        while (p->kid != NULL) {                /* need to propogate down */
161 +                int  mx = (p->xmin + p->xmax) >> 1;
162 +                int  my = (p->ymin + p->ymax) >> 1;
163 +                int  ki;
164 +                if (p->x >= mx)
165 +                        ki = (p->y >= my) ? UR : DR;
166 +                else
167 +                        ki = (p->y >= my) ? UL : DL;
168 +                pcopy(p, p->kid+ki);
169 +                p = p->kid + ki;
170 +        }
171  
172 < void
173 < paint(p, xmin, ymin, xmax, ymax)        /* compute and paint a rectangle */
174 < register PNODE  *p;
175 < int  xmin, ymin, xmax, ymax;
172 >        (*dev->paintr)(greyscale?greyof(p->v):p->v,
173 >                        p->xmin, p->ymin, p->xmax, p->ymax);
174 > }
175 >
176 > int
177 > paint(                  /* compute and paint a rectangle */
178 >        PNODE  *p
179 > )
180   {
205        static unsigned long  lastflush = 0;
181          static RAY  thisray;
182          double  h, v;
183  
184 <        if (xmax - xmin <= 0 || ymax - ymin <= 0) {     /* empty */
185 <                p->x = xmin;
186 <                p->y = ymin;
184 >        if ((p->xmax <= p->xmin) | (p->ymax <= p->ymin)) {      /* empty */
185 >                p->x = p->xmin;
186 >                p->y = p->ymin;
187                  setcolor(p->v, 0.0, 0.0, 0.0);
188 <                return;
188 >                return(0);
189          }
190                                                  /* jitter ray direction */
191 <        h = xmin + (xmax-xmin)*frandom();
192 <        v = ymin + (ymax-ymin)*frandom();
191 >        p->x = h = p->xmin + (p->xmax-p->xmin)*frandom();
192 >        p->y = v = p->ymin + (p->ymax-p->ymin)*frandom();
193          
194          if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, &ourview,
195                          h/hresolu, v/vresolu)) < -FTINY) {
196                  setcolor(thisray.rcol, 0.0, 0.0, 0.0);
197 <        } else {
198 <                rayorigin(&thisray, NULL, PRIMARY, 1.0);
199 <                samplendx++;
200 <                rayvalue(&thisray);
197 >        } else if (!ray_pnprocs) {              /* immediate mode */
198 >                ray_trace(&thisray);
199 >        } else {                                /* queuing mode */
200 >                int     rval;
201 >                rayorigin(&thisray, PRIMARY, NULL, NULL);
202 >                thisray.rno = (RNUMBER)p;
203 >                rval = ray_pqueue(&thisray);
204 >                if (!rval)
205 >                        return(0);
206 >                if (rval < 0)
207 >                        return(-1);
208 >                                                /* get node for returned ray */
209 >                p = (PNODE *)thisray.rno;
210          }
211  
228        p->x = h;
229        p->y = v;
212          copycolor(p->v, thisray.rcol);
213          scalecolor(p->v, exposure);
214  
215 <        (*dev->paintr)(greyscale?greyof(p->v):p->v, xmin, ymin, xmax, ymax);
215 >        recolor(p);                             /* paint it */
216  
217 <        if (dev->flush != NULL && nrays - lastflush >= WFLUSH) {
218 <                lastflush = nrays;
219 <                (*dev->flush)();
217 >        if (dev->flush != NULL) {               /* shall we check for input? */
218 >                static RNUMBER  lastflush = 0;
219 >                RNUMBER         counter = raynum;
220 >                int             flushintvl;
221 >                if (!ray_pnprocs) {
222 >                        counter = nrays;
223 >                        flushintvl = WFLUSH1;
224 >                } else if (ambounce == 0)
225 >                        flushintvl = ray_pnprocs*WFLUSH;
226 >                else if (niflush < WFLUSH)
227 >                        flushintvl = ray_pnprocs*niflush/(ambounce+1);
228 >                else
229 >                        flushintvl = ray_pnprocs*WFLUSH/(ambounce+1);
230 >                if (lastflush > counter)
231 >                        lastflush = 0;          /* counter wrapped */
232 >
233 >                if (counter - lastflush >= flushintvl) {
234 >                        lastflush = counter;
235 >                        (*dev->flush)();
236 >                        niflush++;
237 >                }
238          }
239 +        return(1);
240   }
241  
242  
243 + int
244 + waitrays(void)                                  /* finish up pending rays */
245 + {
246 +        int     nwaited = 0;
247 +        int     rval;
248 +        RAY     raydone;
249 +
250 +        if (!ray_pnprocs)                       /* immediate mode? */
251 +                return(0);
252 +        while ((rval = ray_presult(&raydone, 0)) > 0) {
253 +                PNODE  *p = (PNODE *)raydone.rno;
254 +                copycolor(p->v, raydone.rcol);
255 +                scalecolor(p->v, exposure);
256 +                recolor(p);
257 +                nwaited++;
258 +        }
259 +        if (rval < 0)
260 +                return(-1);
261 +        return(nwaited);
262 + }
263 +
264 +
265   void
266 < newimage()                              /* start a new image */
266 > newimage(                                       /* start a new image */
267 >        char *s
268 > )
269   {
270 +        int             newnp = 0;
271 +                                                /* # rendering procs arg? */
272 +        if (s != NULL)
273 +                sscanf(s, "%d", &newnp);
274                                                  /* free old image */
275          freepkids(&ptrunk);
247                                                /* save reserve memory */
248        fillreserves();
276                                                  /* compute resolution */
277          hresolu = dev->xsiz;
278          vresolu = dev->ysiz;
279          normaspect(viewaspect(&ourview), &dev->pixaspect, &hresolu, &vresolu);
280 <        pframe.l = pframe.d = 0;
281 <        pframe.r = hresolu; pframe.u = vresolu;
280 >        ptrunk.xmin = ptrunk.ymin = pframe.l = pframe.d = 0;
281 >        ptrunk.xmax = pframe.r = hresolu;
282 >        ptrunk.ymax = pframe.u = vresolu;
283          pdepth = 0;
284                                                  /* clear device */
285          (*dev->clear)(hresolu, vresolu);
286 <                                                /* get first value */
287 <        paint(&ptrunk, 0, 0, hresolu, vresolu);
286 >
287 >        if (newparam) {                         /* (re)start rendering procs */
288 >                if (ray_pnprocs)
289 >                        ray_pclose(0);          /* should already be closed */
290 >                if (newnp > 0)
291 >                        nproc = newnp;
292 >                if (nproc > 1)
293 >                        ray_popen(nproc);
294 >                newparam = 0;
295 >        } else if ((newnp > 0) & (newnp != nproc)) {
296 >                if (newnp == 1)                 /* change # rendering procs */
297 >                        ray_pclose(0);
298 >                else if (newnp < ray_pnprocs)
299 >                        ray_pclose(ray_pnprocs - newnp);
300 >                else
301 >                        ray_popen(newnp - ray_pnprocs);
302 >                nproc = newnp;
303 >        }
304 >        niflush = 0;                            /* get first value */
305 >        paint(&ptrunk);
306   }
307  
308  
309   void
310 < redraw()                                /* redraw the image */
310 > redraw(void)                            /* redraw the image */
311   {
312          (*dev->clear)(hresolu, vresolu);
313          (*dev->comout)("redrawing...\n");
# Line 271 | Line 317 | redraw()                               /* redraw the image */
317  
318  
319   void
320 < repaint(xmin, ymin, xmax, ymax)                 /* repaint a region */
321 < int  xmin, ymin, xmax, ymax;
320 > repaint(                                /* repaint a region */
321 >        int  xmin,
322 >        int  ymin,
323 >        int  xmax,
324 >        int  ymax
325 > )
326   {
327          RECT  reg;
328  
329          reg.l = xmin; reg.r = xmax;
330          reg.d = ymin; reg.u = ymax;
331  
332 <        paintrect(&ptrunk, 0, 0, hresolu, vresolu, &reg);
332 >        paintrect(&ptrunk, &reg);
333   }
334  
335  
336   void
337 < paintrect(p, xmin, ymin, xmax, ymax, r)         /* paint picture rectangle */
338 < register PNODE  *p;
339 < int  xmin, ymin, xmax, ymax;
340 < register RECT  *r;
337 > paintrect(                              /* paint picture rectangle */
338 >        PNODE  *p,
339 >        RECT  *r
340 > )
341   {
342          int  mx, my;
343  
344 <        if (xmax - xmin <= 0 || ymax - ymin <= 0)
344 >        if (p->xmax - p->xmin <= 0 || p->ymax - p->ymin <= 0)
345                  return;
346  
347          if (p->kid == NULL) {
348                  (*dev->paintr)(greyscale?greyof(p->v):p->v,
349 <                                xmin, ymin, xmax, ymax);        /* do this */
349 >                        p->xmin, p->ymin, p->xmax, p->ymax);    /* do this */
350                  return;
351          }
352 <        mx = (xmin + xmax) >> 1;                                /* do kids */
353 <        my = (ymin + ymax) >> 1;
352 >        mx = (p->xmin + p->xmax) >> 1;                          /* do kids */
353 >        my = (p->ymin + p->ymax) >> 1;
354          if (mx > r->l) {
355                  if (my > r->d)
356 <                        paintrect(p->kid+DL, xmin, ymin, mx, my, r);
356 >                        paintrect(p->kid+DL, r);
357                  if (my < r->u)
358 <                        paintrect(p->kid+UL, xmin, my, mx, ymax, r);
358 >                        paintrect(p->kid+UL, r);
359          }
360          if (mx < r->r) {
361                  if (my > r->d)
362 <                        paintrect(p->kid+DR, mx, ymin, xmax, my, r);
362 >                        paintrect(p->kid+DR, r);
363                  if (my < r->u)
364 <                        paintrect(p->kid+UR, mx, my, xmax, ymax, r);
364 >                        paintrect(p->kid+UR, r);
365          }
366   }
367  
368  
369   PNODE *
370 < findrect(x, y, p, r, pd)                /* find a rectangle */
371 < int  x, y;
372 < register PNODE  *p;
373 < register RECT  *r;
374 < int  pd;
370 > findrect(                               /* find a rectangle */
371 >        int  x,
372 >        int  y,
373 >        PNODE  *p,
374 >        int  pd
375 > )
376   {
377          int  mx, my;
378  
379          while (p->kid != NULL && pd--) {
380  
381 <                mx = (r->l + r->r) >> 1;
382 <                my = (r->d + r->u) >> 1;
381 >                mx = (p->xmin + p->xmax) >> 1;
382 >                my = (p->ymin + p->ymax) >> 1;
383  
384                  if (x < mx) {
334                        r->r = mx;
385                          if (y < my) {
336                                r->u = my;
386                                  p = p->kid+DL;
387                          } else {
339                                r->d = my;
388                                  p = p->kid+UL;
389                          }
390                  } else {
343                        r->l = mx;
391                          if (y < my) {
345                                r->u = my;
392                                  p = p->kid+DR;
393                          } else {
348                                r->d = my;
394                                  p = p->kid+UR;
395                          }
396                  }
# Line 355 | Line 400 | int  pd;
400  
401  
402   void
403 < scalepict(p, sf)                        /* scale picture values */
404 < register PNODE  *p;
405 < double  sf;
403 > compavg(                                /* recompute averages */
404 >        PNODE   *p
405 > )
406   {
407 +        int     i, navg;
408 +        
409 +        if (p->kid == NULL)
410 +                return;
411 +
412 +        setcolor(p->v, .0, .0, .0);
413 +        navg = 0;
414 +        for (i = 0; i < 4; i++) {
415 +                if (p->kid[i].xmin >= p->kid[i].xmax) continue;
416 +                if (p->kid[i].ymin >= p->kid[i].ymax) continue;
417 +                compavg(p->kid+i);
418 +                addcolor(p->v, p->kid[i].v);
419 +                navg++;
420 +        }
421 +        if (navg > 1)
422 +                scalecolor(p->v, 1./navg);
423 + }
424 +
425 +
426 + void
427 + scalepict(                              /* scale picture values */
428 +        PNODE  *p,
429 +        double  sf
430 + )
431 + {
432          scalecolor(p->v, sf);           /* do this node */
433  
434          if (p->kid == NULL)
# Line 372 | Line 442 | double  sf;
442  
443  
444   void
445 < getpictcolrs(yoff, scan, p, xsiz, ysiz) /* get scanline from picture */
446 < int  yoff;
447 < register COLR  *scan;
448 < register PNODE  *p;
449 < int  xsiz, ysiz;
445 > getpictcolrs(                           /* get scanline from picture */
446 >        int  yoff,
447 >        COLR  *scan,
448 >        PNODE  *p,
449 >        int  xsiz,
450 >        int  ysiz
451 > )
452   {
453 <        register int  mx;
453 >        int  mx;
454          int  my;
455  
456          if (p->kid == NULL) {                   /* do this node */
# Line 403 | Line 475 | int  xsiz, ysiz;
475  
476  
477   void
478 < freepkids(p)                            /* free pnode's children */
479 < register PNODE  *p;
478 > freepkids(                              /* free pnode's children */
479 >        PNODE  *p
480 > )
481   {
482          if (p->kid == NULL)
483                  return;
# Line 418 | Line 491 | register PNODE  *p;
491  
492  
493   void
494 < newview(vp)                             /* change viewing parameters */
495 < register VIEW  *vp;
494 > newview(                                        /* change viewing parameters */
495 >        VIEW  *vp
496 > )
497   {
498          char  *err;
499  
500          if ((err = setview(vp)) != NULL) {
501                  sprintf(errmsg, "view not set - %s", err);
502                  error(COMMAND, errmsg);
503 <        } else if (bcmp((char *)vp, (char *)&ourview, sizeof(VIEW))) {
504 <                copystruct(&oldview, &ourview);
505 <                copystruct(&ourview, vp);
506 <                newimage();
503 >        } else if (memcmp((char *)vp, (char *)&ourview, sizeof(VIEW))) {
504 >                oldview = ourview;
505 >                ourview = *vp;
506 >                newimage(NULL);
507          }
508   }
509  
510  
511   void
512 < moveview(angle, elev, mag, vc)                  /* move viewpoint */
513 < double  angle, elev, mag;
514 < FVECT  vc;
512 > moveview(                                       /* move viewpoint */
513 >        double  angle,
514 >        double  elev,
515 >        double  mag,
516 >        FVECT  vc
517 > )
518   {
519          double  d;
520          FVECT  v1;
521 <        VIEW  nv;
522 <        register int  i;
521 >        VIEW  nv = ourview;
522 >        int  i;
523  
447        VCOPY(nv.vup, ourview.vup);
448        nv.hoff = ourview.hoff; nv.voff = ourview.voff;
524          spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.));
525          if (elev != 0.0) {
526                  fcross(v1, ourview.vup, nv.vdir);
527                  normalize(v1);
528                  spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.));
529          }
530 <        if ((nv.type = ourview.type) == VT_PAR) {
531 <                nv.horiz = ourview.horiz / mag;
532 <                nv.vert = ourview.vert / mag;
530 >        if (nv.type == VT_PAR) {
531 >                nv.horiz /= mag;
532 >                nv.vert /= mag;
533                  d = 0.0;                        /* don't move closer */
534                  for (i = 0; i < 3; i++)
535                          d += (vc[i] - ourview.vp[i])*ourview.vdir[i];
461                nv.vfore = ourview.vfore;
462                nv.vaft = ourview.vaft;
536          } else {
464                nv.horiz = ourview.horiz;
465                nv.vert = ourview.vert;
537                  d = sqrt(dist2(ourview.vp, vc)) / mag;
538 <                if ((nv.vfore = ourview.vfore) > FTINY) {
538 >                if (nv.vfore > FTINY) {
539                          nv.vfore += d - d*mag;
540                          if (nv.vfore < 0.0) nv.vfore = 0.0;
541                  }
542 <                if ((nv.vaft = ourview.vaft) > FTINY) {
542 >                if (nv.vaft > FTINY) {
543                          nv.vaft += d - d*mag;
544                          if (nv.vaft <= nv.vfore) nv.vaft = 0.0;
545                  }
546 +                nv.vdist /= mag;
547          }
548          for (i = 0; i < 3; i++)
549                  nv.vp[i] = vc[i] - d*nv.vdir[i];
# Line 480 | Line 552 | FVECT  vc;
552  
553  
554   void
555 < pcopy(p1, p2)                           /* copy paint node p1 into p2 */
556 < register PNODE  *p1, *p2;
555 > pcopy(                                  /* copy paint node p1 into p2 */
556 >        PNODE  *p1,
557 >        PNODE  *p2
558 > )
559   {
560          copycolor(p2->v, p1->v);
561          p2->x = p1->x;
# Line 490 | Line 564 | register PNODE  *p1, *p2;
564  
565  
566   void
567 < zoomview(vp, zf)                        /* zoom in or out */
568 < register VIEW  *vp;
569 < double  zf;
567 > zoomview(                               /* zoom in or out */
568 >        VIEW  *vp,
569 >        double  zf
570 > )
571   {
572          switch (vp->type) {
573          case VT_PAR:                            /* parallel view */
# Line 506 | Line 581 | double  zf;
581                  vp->vert /= zf;
582                  if (vp->vert > 360.)
583                          vp->vert = 360.;
584 +                return;
585 +        case VT_PLS:                            /* planisphere fisheye */
586 +                vp->horiz = sin((PI/180./2.)*vp->horiz) /
587 +                                (1.0 + cos((PI/180./2.)*vp->horiz)) / zf;
588 +                vp->horiz *= vp->horiz;
589 +                vp->horiz = (2.*180./PI)*acos((1. - vp->horiz) /
590 +                                                (1. + vp->horiz));
591 +                vp->vert = sin((PI/180./2.)*vp->vert) /
592 +                                (1.0 + cos((PI/180./2.)*vp->vert)) / zf;
593 +                vp->vert *= vp->vert;
594 +                vp->vert = (2.*180./PI)*acos((1. - vp->vert) /
595 +                                                (1. + vp->vert));
596                  return;
597          case VT_CYL:                            /* cylindrical panorama */
598                  vp->horiz /= zf;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines