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

Comparing ray/src/common/jitteraperture.c (file contents):
Revision 2.2 by greg, Wed Dec 15 01:38:50 2021 UTC vs.
Revision 2.3 by greg, Fri Jan 14 22:57:40 2022 UTC

# Line 24 | Line 24 | double  dia
24   )
25   {
26          RREAL  df[2];
27 <        double  vc;
27 >        double  adj;
28          int  i;
29                                          /* are we even needed? */
30          if (dia <= FTINY)
# Line 33 | Line 33 | double  dia
33          square2disk(df, frandom(), frandom());
34          df[0] *= .5*dia;
35          df[1] *= .5*dia;
36 +
37          if ((v->type == VT_PER) | (v->type == VT_PAR)) {
38 <                double  adj = 1.0;      /* basic view cases */
38 >                adj = 1.0;              /* basic view cases */
39                  if (v->type == VT_PER)
40                          adj /= DOT(direc, v->vdir);
41                  df[0] /= sqrt(v->hn2);
42                  df[1] /= sqrt(v->vn2);
43                  for (i = 3; i--; ) {
44 <                        vc = v->vp[i] + adj*v->vdist*direc[i];
44 <                        orig[i] += df[0]*v->hvec[i] +
44 >                        orig[i] = v->vp[i] + df[0]*v->hvec[i] +
45                                                  df[1]*v->vvec[i] ;
46 <                        direc[i] = vc - orig[i];
46 >                        direc[i] = v->vp[i] + adj*v->vdist*direc[i]
47 >                                        - orig[i];
48                  }
49          } else {                        /* difficult view cases */
50 <                double  dfd = PI/4.*dia*(.5 - frandom());
50 >                adj = PI/4.*dia*(.5 - frandom());
51                  if ((v->type != VT_ANG) & (v->type != VT_PLS)) {
52                          if (v->type != VT_CYL)
53                                  df[0] /= sqrt(v->hn2);
54                          df[1] /= sqrt(v->vn2);
55                  }
56                  for (i = 3; i--; ) {
57 <                        vc = v->vp[i] + v->vdist*direc[i];
57 <                        orig[i] += df[0]*v->hvec[i] +
57 >                        orig[i] = v->vp[i] + df[0]*v->hvec[i] +
58                                                  df[1]*v->vvec[i] +
59 <                                                dfd*v->vdir[i] ;
60 <                        direc[i] = vc - orig[i];
59 >                                                adj*v->vdir[i] ;
60 >                        direc[i] = v->vp[i] + v->vdist*direc[i]
61 >                                        - orig[i];
62                  }
63          }
64 <        return(normalize(direc) != 0.0);
64 >        if (normalize(direc) == 0.0)
65 >                return(0);
66 >        if ((adj = v->vfore) <= FTINY)
67 >                return(1);
68 >        if (v->type == VT_PER)
69 >                adj /= DOT(direc, v->vdir);
70 >        VSUM(orig, orig, direc, adj);
71 >        return(1);
72   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines