/[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.11 by tjl, Thu Sep 26 18:39:24 2002 UTC revision 1.12 by tjl, Fri Sep 27 06:34:53 2002 UTC
# Line 129  namespace Coords { Line 129  namespace Coords {
129       * of the zoomed area.       * of the zoomed area.
130       */       */
131      class DistortCoords : public CoordSys {      class DistortCoords : public CoordSys {
132            float x, y;
133            float w, h;
134          float mmin;          float mmin;
135          float mmax;          float mmax;
136          Fisheye::vector_mag_isotropic<Fisheye::scalar_mag_atan> distort;          Fisheye::vector_mag_isotropic<Fisheye::scalar_mag_atan> distort;
# Line 136  namespace Coords { Line 138  namespace Coords {
138          enum { NParams = 6 };          enum { NParams = 6 };
139          virtual void setParams(float *params) {          virtual void setParams(float *params) {
140              CoordSys::setParams(params);              CoordSys::setParams(params);
141                x = params[0];
142                y = params[1];
143              mmax = exp(params[2]);              mmax = exp(params[2]);
144              mmin = exp(params[3]);              mmin = exp(params[3]);
145                w = params[4];
146                h = params[5];
147              distort.f = Fisheye::scalar_mag_atan(mmax / mmin);              distort.f = Fisheye::scalar_mag_atan(mmax / mmin);
148          }          }
149          virtual ZPt transform(const ZPt &p) const {          virtual ZPt transform(const ZPt &p) const {
# Line 151  namespace Coords { Line 157  namespace Coords {
157              super->vertex(mp);              super->vertex(mp);
158          }          }
159          void tr(const ZPt &from, ZPt &to) const {          void tr(const ZPt &from, ZPt &to) const {
160              to = distort(from);              ZPt p = ZPt((from.x-x) / w, (from.y-y)/ h, from.z);
161                to = distort(p);
162                to.x *= w; to.y *= h;
163                to.x += x; to.y += y;
164              to.x *= mmin;              to.x *= mmin;
165              to.y *= mmin;              to.y *= mmin;
166          }          }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

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