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

Comparing ray/src/px/pmapgen.c (file contents):
Revision 2.1 by greg, Wed Oct 11 10:39:26 1995 UTC vs.
Revision 2.4 by schorsch, Sun Mar 28 20:33:14 2004 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1995 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * pmapgen.c: general routines for 2-D perspective mappings.
6   * These routines are independent of the poly structure,
# Line 12 | Line 9 | static char SCCSid[] = "$SunId$ LBL";
9   * Paul Heckbert        5 Nov 85, 12 Dec 85
10   */
11  
15 static char rcsid[] = "$Header$";
12   #include <stdio.h>
13   #include "pmap.h"
14   #include "mx3.h"
# Line 20 | Line 16 | static char rcsid[] = "$Header$";
16   #define TOLERANCE 1e-13
17   #define ZERO(x) ((x)<TOLERANCE && (x)>-TOLERANCE)
18  
19 < #define X(i) quad[i][0]         /* quadrilateral x and y */
20 < #define Y(i) quad[i][1]
19 > #define X(i) qdrl[i][0]         /* quadrilateral x and y */
20 > #define Y(i) qdrl[i][1]
21  
22   /*
23   * pmap_quad_rect: find mapping between quadrilateral and rectangle.
24   * The correspondence is:
25   *
26 < *      quad[0] --> (u0,v0)
27 < *      quad[1] --> (u1,v0)
28 < *      quad[2] --> (u1,v1)
29 < *      quad[3] --> (u0,v1)
26 > *      qdrl[0] --> (u0,v0)
27 > *      qdrl[1] --> (u1,v0)
28 > *      qdrl[2] --> (u1,v1)
29 > *      qdrl[3] --> (u0,v1)
30   *
31   * This method of computing the adjoint numerically is cheaper than
32   * computing it symbolically.
33   */
34          
35 < pmap_quad_rect(u0, v0, u1, v1, quad, QR)
36 < double u0, v0, u1, v1;          /* bounds of rectangle */
37 < double quad[4][2];              /* vertices of quadrilateral */
38 < double QR[3][3];                /* quad->rect transform (returned) */
35 > extern int
36 > pmap_quad_rect(
37 >        double u0,              /* bounds of rectangle */
38 >        double v0,
39 >        double u1,
40 >        double v1,
41 >        double qdrl[4][2],              /* vertices of quadrilateral */
42 >        double QR[3][3]         /* qdrl->rect transform (returned) */
43 > )
44   {
45      int ret;
46      double du, dv;
47 <    double RQ[3][3];            /* rect->quad transform */
47 >    double RQ[3][3];            /* rect->qdrl transform */
48  
49      du = u1-u0;
50      dv = v1-v0;
# Line 53 | Line 54 | double QR[3][3];               /* quad->rect transform (returned) *
54      }
55  
56      /* first find mapping from unit uv square to xy quadrilateral */
57 <    ret = pmap_square_quad(quad, RQ);
57 >    ret = pmap_square_quad(qdrl, RQ);
58      if (ret==PMAP_BAD) return PMAP_BAD;
59  
60      /* concatenate transform from uv rectangle (u0,v0,u1,v1) to unit square */
# Line 78 | Line 79 | double QR[3][3];               /* quad->rect transform (returned) *
79   * pmap_square_quad: find mapping between unit square and quadrilateral.
80   * The correspondence is:
81   *
82 < *      (0,0) --> quad[0]
83 < *      (1,0) --> quad[1]
84 < *      (1,1) --> quad[2]
85 < *      (0,1) --> quad[3]
82 > *      (0,0) --> qdrl[0]
83 > *      (1,0) --> qdrl[1]
84 > *      (1,1) --> qdrl[2]
85 > *      (0,1) --> qdrl[3]
86   */
87  
88 < pmap_square_quad(quad, SQ)
89 < register double quad[4][2];     /* vertices of quadrilateral */
90 < register double SQ[3][3];       /* square->quad transform */
88 > extern int
89 > pmap_square_quad(
90 >        register double qdrl[4][2],     /* vertices of quadrilateral */
91 >        register double SQ[3][3]        /* square->qdrl transform */
92 > )
93   {
94      double px, py;
95  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines