home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 344b.lha / plplot_v2.6 / src / fcnvrt.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-27  |  1.5 KB  |  93 lines

  1. /* Coordinate transformations for plotting package */
  2.  
  3. #include "plplot.h"
  4. #include "declare.h"
  5. #include <math.h>
  6.  
  7. /* dcmm. converts from device coordinates to millimetres from bottom */
  8. /* left-hand corner */
  9.  
  10. PLFLT dcmmx(x)
  11. PLFLT x;
  12. {
  13.       return((PLFLT)(x * abs(phyxma-phyxmi) / xpmm));
  14. }
  15.  
  16. PLFLT dcmmy(y)
  17. PLFLT y;
  18. {
  19.       return((PLFLT)(y * abs(phyyma-phyymi) / ypmm));
  20. }
  21.  
  22. /* dcsc. define transformations between device coordinates and subpage */
  23. /* coordinates */
  24.  
  25. PLFLT dcscx(x)
  26. PLFLT x;
  27. {
  28.       return((PLFLT)((x - spdxmi)/(spdxma-spdxmi)));
  29. }
  30.  
  31. PLFLT dcscy(y)
  32. PLFLT y;
  33. {
  34.       return((PLFLT)((y - spdymi)/(spdyma-spdymi)));
  35. }
  36.  
  37. /* mmdc. converts millimetres from bottom left corner into device */
  38. /* coordinates */
  39.  
  40. PLFLT mmdcx(x)
  41. PLFLT x;
  42. {
  43.       return((PLFLT)(x * xpmm / abs(phyxma - phyxmi)));
  44. }
  45.  
  46. PLFLT mmdcy(y)
  47. PLFLT y;
  48. {
  49.       return((PLFLT)(y * ypmm / abs(phyyma - phyymi)));
  50. }
  51.  
  52. /* scdc. converts subpage coordinates to device coordinates */
  53.  
  54. PLFLT scdcx(x)
  55. PLFLT x;
  56. {
  57.       return((PLFLT)(spdxmi + (spdxma-spdxmi) * x));
  58. }
  59.  
  60. PLFLT scdcy(y)
  61. PLFLT y;
  62. {
  63.       return((PLFLT)(spdymi + (spdyma-spdymi) * y));
  64. }
  65.  
  66. /* wcmm. converts world coordinates into millimetres */
  67.  
  68. PLFLT wcmmx(x)
  69. PLFLT x;
  70. {
  71.       return((PLFLT)(wmxoff + wmxscl*x));
  72. }
  73.  
  74. PLFLT wcmmy(y)
  75. PLFLT y;
  76. {
  77.       return((PLFLT)(wmyoff + wmyscl*y));
  78. }
  79.  
  80. PLFLT w3wcx(x,y,z)
  81. PLFLT x, y, z;
  82. {
  83.       return((PLFLT)((x-basecx)*cxx + (y-basecy)*cxy));
  84. }
  85.  
  86. PLFLT w3wcy(x,y,z)
  87. PLFLT x, y, z;
  88. {
  89.       return((PLFLT)((x-basecx)*cyx+(y-basecy)*cyy+(z-ranmi)*cyz));
  90. }
  91.  
  92.  
  93.