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 }; |
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 !!! |
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; } |