Back to index

radiance  4R0+20100331
Defines | Functions
pmap.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define PMAP_BAD   -1
#define PMAP_LINEAR   0
#define PMAP_PERSP   1
#define DET2(a, b, c, d)   ((a)*(d) - (b)*(c))

Functions

int pmap_quad_rect (double u0, double v0, double u1, double v1, double qdrl[4][2], double QR[3][3])
int pmap_square_quad (double qdrl[4][2], double SQ[3][3])

Define Documentation

#define DET2 (   a,
  b,
  c,
  d 
)    ((a)*(d) - (b)*(c))

Definition at line 17 of file pmap.h.

#define PMAP_BAD   -1

Definition at line 10 of file pmap.h.

#define PMAP_LINEAR   0

Definition at line 11 of file pmap.h.

#define PMAP_PERSP   1

Definition at line 12 of file pmap.h.


Function Documentation

int pmap_quad_rect ( double  u0,
double  v0,
double  u1,
double  v1,
double  qdrl[4][2],
double  QR[3][3] 
)

Definition at line 36 of file pmapgen.c.

{
    int ret;
    double du, dv;
    double RQ[3][3];        /* rect->qdrl transform */

    du = u1-u0;
    dv = v1-v0;
    if (du==0. || dv==0.) {
       fprintf(stderr, "pmap_quad_rect: null rectangle\n");
       return PMAP_BAD;
    }

    /* first find mapping from unit uv square to xy quadrilateral */
    ret = pmap_square_quad(qdrl, RQ);
    if (ret==PMAP_BAD) return PMAP_BAD;

    /* concatenate transform from uv rectangle (u0,v0,u1,v1) to unit square */
    RQ[0][0] /= du;
    RQ[1][0] /= dv;
    RQ[2][0] -= RQ[0][0]*u0 + RQ[1][0]*v0;
    RQ[0][1] /= du;
    RQ[1][1] /= dv;
    RQ[2][1] -= RQ[0][1]*u0 + RQ[1][1]*v0;
    RQ[0][2] /= du;
    RQ[1][2] /= dv;
    RQ[2][2] -= RQ[0][2]*u0 + RQ[1][2]*v0;

    /* now RQ is transform from uv rectangle to xy quadrilateral */
    /* QR = inverse transform, which maps xy to uv */
    if (mx3d_adjoint(RQ, QR)==0.)
       fprintf(stderr, "pmap_quad_rect: warning: determinant=0\n");
    return ret;
}

Here is the call graph for this function:

int pmap_square_quad ( double  qdrl[4][2],
double  SQ[3][3] 
)

Here is the caller graph for this function: