Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## plplot-cvs

 [Plplot-cvs] plplot/src plwind.c,1.15,1.16 plcvt.c,1.10,1.11 From: Alan W. Irwin - 2004-05-05 20:00:37 ```Update of /cvsroot/plplot/plplot/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2635 Modified Files: plwind.c plcvt.c Log Message: Documentation of mathematical transformation between 3D world coordinates and 2D projected coordinates. Index: plwind.c =================================================================== RCS file: /cvsroot/plplot/plplot/src/plwind.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- plwind.c 17 Jan 2004 16:41:40 -0000 1.15 +++ plwind.c 5 May 2004 20:00:27 -0000 1.16 @@ -186,7 +186,44 @@ plsc->base3y = basey; plsc->basecx = 0.5 * (xmin + xmax); plsc->basecy = 0.5 * (ymin + ymax); - +/* Mathematical explanation of the 3 transformations of coordinates: + * (I) Scaling: + * x' = cx*(x-x_mid) = cx*(x-plsc->basecx) + * y' = cy*(y-y_mid) = cy*(y-plsc->basecy) + * z' = zscale*(z-zmin) = zscale*(z-plsc->ranmi) + * (II) Rotation about z' axis clockwise by the angle of the azimut when + * looking from the top in a right-handed coordinate system. + * x'' x' + * y'' = M_1 * y' + * z'' z' + * where the rotation matrix M_1 (see any mathematical physics book such + * as Mathematical Methods in the Physical Sciences by Boas) is + * caz -saz 0 + * saz caz 0 + * 0 0 1 + * (III) Rotation about x'' axis by 90 deg - alt to bring z''' axis + * coincident with line of sight and x''' and y''' corresponding to + * x and y coordinates in the 2D plane of the plot. + * x''' x'' + * y''' = M_2 * y'' + * z''' z'' + * where the rotation matrix M_2 is + * 1 0 0 + * 0 salt calt + * 0 -calt salt + * Note + * x''' x' + * y''' = M * y' + * z''' z' + * where M = M_2*M_1 is given by + * caz -saz 0 + * salt*saz salt*caz calt + * -calt*saz -calt*caz salt + * plP_w3wcx and plP_w3wcy take the combination of the plsc->basecx, + * plsc->basecy, plsc->ranmi, plsc->cxx, plsc->cxy, plsc->cyx, plsc->cyy, and + * plsc->cyz data stored here to implement the combination of the 3 + * transformations to determine x''' and y''' from x, y, and z. + */ plsc->cxx = cx * caz; plsc->cxy = -cy * saz; plsc->cyx = cx * saz * salt; Index: plcvt.c =================================================================== RCS file: /cvsroot/plplot/plplot/src/plcvt.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- plcvt.c 17 Jan 2004 16:41:40 -0000 1.10 +++ plcvt.c 5 May 2004 20:00:28 -0000 1.11 @@ -204,6 +204,7 @@ \*--------------------------------------------------------------------------*/ /* 3-d coords to 2-d projection (x) */ +/* See c_plw3d for a mathematical explanation of the transformation. */ PLFLT plP_w3wcx(PLFLT x, PLFLT y, PLFLT z) @@ -213,6 +214,7 @@ } /* 3-d coords to 2-d projection (y) */ +/* See c_plw3d for a mathematical explanation of the transformation. */ PLFLT plP_w3wcy(PLFLT x, PLFLT y, PLFLT z) ```