[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx libcoords/Coords.cxx libfisheye/Fisheye...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz/gfx libcoords/Coords.cxx libfisheye/Fisheye... |
Date: |
Tue, 01 Oct 2002 06:33:13 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/10/01 06:33:13
Modified files:
gfx/libcoords : Coords.cxx
gfx/libfisheye : Fisheye.hxx
Log message:
Seems to be that distortion inverses work
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libfisheye/Fisheye.hxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: gzz/gfx/libcoords/Coords.cxx
diff -c gzz/gfx/libcoords/Coords.cxx:1.23 gzz/gfx/libcoords/Coords.cxx:1.24
*** gzz/gfx/libcoords/Coords.cxx:1.23 Tue Oct 1 06:14:47 2002
--- gzz/gfx/libcoords/Coords.cxx Tue Oct 1 06:33:13 2002
***************
*** 299,304 ****
--- 299,305 ----
float w, h;
float mmin;
float mmax;
+ bool inverse; // kludge
F distort;
public:
enum { NParams = 6 };
***************
*** 310,322 ****
w = p[4];
h = p[5];
distort.setMag(mmax / mmin);
}
void tr(const ZPt &from, ZPt &to) const {
ZPt p = ZPt((from.x-x) / w, (from.y-y)/ h, from.z);
to = distort(p);
to.x *= w; to.y *= h;
! to.x *= mmin;
! to.y *= mmin;
to.x += x; to.y += y;
}
typedef DistortCoords<typename F::InverseType> InverseType; // XXX !!!
--- 311,330 ----
w = p[4];
h = p[5];
distort.setMag(mmax / mmin);
+ inverse = false;
}
void tr(const ZPt &from, ZPt &to) const {
ZPt p = ZPt((from.x-x) / w, (from.y-y)/ h, from.z);
+ if(inverse) {
+ p.x *= 1/mmin;
+ p.y *= 1/mmin;
+ }
to = distort(p);
to.x *= w; to.y *= h;
! if(!inverse) {
! to.x *= mmin;
! to.y *= mmin;
! }
to.x += x; to.y += y;
}
typedef DistortCoords<typename F::InverseType> InverseType; // XXX !!!
***************
*** 326,334 ****
inv.y = y;
inv.w = w;
inv.h = h;
! inv.mmin = 1/mmin;
inv.mmax = mmax;
inv.distort.setMag(mmax/mmin);
return inv;
}
bool canPerformGL() { return false; }
--- 334,343 ----
inv.y = y;
inv.w = w;
inv.h = h;
! inv.mmin = mmin;
inv.mmax = mmax;
inv.distort.setMag(mmax/mmin);
+ inv.inverse = !inverse;
return inv;
}
bool canPerformGL() { return false; }
Index: gzz/gfx/libfisheye/Fisheye.hxx
diff -c gzz/gfx/libfisheye/Fisheye.hxx:1.4 gzz/gfx/libfisheye/Fisheye.hxx:1.5
*** gzz/gfx/libfisheye/Fisheye.hxx:1.4 Tue Oct 1 06:14:47 2002
--- gzz/gfx/libfisheye/Fisheye.hxx Tue Oct 1 06:33:13 2002
***************
*** 46,55 ****
if(z <= 0) return 1; // Fail gracefully
if (r2 > 0) {
float r_orig = sqrt(r2);
! float ylow = r_orig;
! float yhigh = r_orig + z * M_PI / 2;
// Then, loop a little bit // XXX Improve
! for(int i=0; i<15; i++) {
float y = 0.5*(ylow+yhigh);
float c = y * func(y);
if(c < r_orig) {
--- 46,55 ----
if(z <= 0) return 1; // Fail gracefully
if (r2 > 0) {
float r_orig = sqrt(r2);
! float ylow = r_orig - z * M_PI / 2;
! float yhigh = r_orig;
// Then, loop a little bit // XXX Improve
! for(int i=0; i<18; i++) {
float y = 0.5*(ylow+yhigh);
float c = y * func(y);
if(c < r_orig) {
***************
*** 58,67 ****
yhigh = y;
}
DBG(dbg) <<
! "r_orig: " << r_orig <<
! "ylow: " << ylow <<
! "yhigh: " << yhigh <<
! "c: " << c << "\n";
}
return 0.5*(ylow+yhigh) / r_orig;
}
--- 58,67 ----
yhigh = y;
}
DBG(dbg) <<
! " r_orig: " << r_orig <<
! " ylow: " << ylow <<
! " yhigh: " << yhigh <<
! " c: " << c << "\n";
}
return 0.5*(ylow+yhigh) / r_orig;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gfx libcoords/Coords.cxx libfisheye/Fisheye...,
Tuomas J. Lukka <=