/[gzz]/gzz/gfx/libcoords/Coords.cxx
ViewVC logotype

Diff of /gzz/gfx/libcoords/Coords.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.23 by tjl, Tue Oct 1 10:14:47 2002 UTC revision 1.24 by tjl, Tue Oct 1 10:33:13 2002 UTC
# Line 299  namespace Coords { Line 299  namespace Coords {
299          float w, h;          float w, h;
300          float mmin;          float mmin;
301          float mmax;          float mmax;
302            bool inverse; // kludge
303          F distort;          F distort;
304      public:      public:
305          enum { NParams = 6 };          enum { NParams = 6 };
# Line 310  namespace Coords { Line 311  namespace Coords {
311              w = p[4];              w = p[4];
312              h = p[5];              h = p[5];
313              distort.setMag(mmax / mmin);              distort.setMag(mmax / mmin);
314                inverse = false;
315          }          }
316          void tr(const ZPt &from, ZPt &to) const {          void tr(const ZPt &from, ZPt &to) const {
317              ZPt p = ZPt((from.x-x) / w, (from.y-y)/ h, from.z);              ZPt p = ZPt((from.x-x) / w, (from.y-y)/ h, from.z);
318                if(inverse) {
319                    p.x *= 1/mmin;
320                    p.y *= 1/mmin;
321                }
322              to = distort(p);              to = distort(p);
323              to.x *= w; to.y *= h;              to.x *= w; to.y *= h;
324              to.x *= mmin;              if(!inverse) {
325              to.y *= mmin;                  to.x *= mmin;
326                    to.y *= mmin;
327                }
328              to.x += x; to.y += y;              to.x += x; to.y += y;
329          }          }
330          typedef DistortCoords<typename F::InverseType>  InverseType; // XXX !!!          typedef DistortCoords<typename F::InverseType>  InverseType; // XXX !!!
# Line 326  namespace Coords { Line 334  namespace Coords {
334              inv.y = y;              inv.y = y;
335              inv.w = w;              inv.w = w;
336              inv.h = h;              inv.h = h;
337              inv.mmin = 1/mmin;              inv.mmin = mmin;
338              inv.mmax = mmax;              inv.mmax = mmax;
339              inv.distort.setMag(mmax/mmin);              inv.distort.setMag(mmax/mmin);
340                inv.inverse = !inverse;
341              return inv;              return inv;
342          }          }
343          bool canPerformGL() { return false; }          bool canPerformGL() { return false; }

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26