[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/librenderables renderables.py
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx/librenderables renderables.py |
Date: |
Tue, 01 Oct 2002 08:53:15 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/10/01 08:53:15
Modified files:
gfx/librenderables: renderables.py
Log message:
Fix IrregularQuad::vert float lerp inaccuracy so that the polygon
clipping does not recurse infinitely
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.87&tr2=1.88&r1=text&r2=text
Patches:
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.87
gzz/gfx/librenderables/renderables.py:1.88
*** gzz/gfx/librenderables/renderables.py:1.87 Mon Sep 30 18:20:28 2002
--- gzz/gfx/librenderables/renderables.py Tue Oct 1 08:53:15 2002
***************
*** 613,623 ****
// Do vert(pts, v) for any crossings and then vert(pts, v1)
void vert(vector<ZPt> &pts, ZPt v0, ZPt v1) {
ZPt v;
! if ((v0.x - x0) * (v1.x - x0) < 0) v = lerp(v0, v1, (x0
- v0.x) / (v1.x - v0.x));
! else if ((v0.x - x1) * (v1.x - x1) < 0) v = lerp(v0, v1, (x1
- v0.x) / (v1.x - v0.x));
! else if ((v0.y - y0) * (v1.y - y0) < 0) v = lerp(v0, v1, (y0
- v0.y) / (v1.y - v0.y));
! else if ((v0.y - y1) * (v1.y - y1) < 0) v = lerp(v0, v1, (y1
- v0.y) / (v1.y - v0.y));
else {
return vert(pts, v1);
}
--- 613,624 ----
// Do vert(pts, v) for any crossings and then vert(pts, v1)
void vert(vector<ZPt> &pts, ZPt v0, ZPt v1) {
+ cout << "vert:" << v0 << v1 << "\n";
ZPt v;
! if ((v0.x - x0) * (v1.x - x0) < 0) v = lerp(v0, v1, (x0
- v0.x) / (v1.x - v0.x)), v.x = x0;
! else if ((v0.x - x1) * (v1.x - x1) < 0) v = lerp(v0, v1, (x1
- v0.x) / (v1.x - v0.x)), v.x = x1;
! else if ((v0.y - y0) * (v1.y - y0) < 0) v = lerp(v0, v1, (y0
- v0.y) / (v1.y - v0.y)), v.y = y0;
! else if ((v0.y - y1) * (v1.y - y1) < 0) v = lerp(v0, v1, (y1
- v0.y) / (v1.y - v0.y)), v.y = y1;
else {
return vert(pts, v1);
}
***************
*** 636,643 ****
cx += (p[i].x + p[i+1].x) * t;
cy += (p[i].y + p[i+1].y) * t;
}
! cx /= 3 * A;
! cy /= 3 * A;
glBegin(GL_TRIANGLE_FAN);
coords1.vertex(ZPt(cx, cy, p[0].z));
--- 637,649 ----
cx += (p[i].x + p[i+1].x) * t;
cy += (p[i].y + p[i+1].y) * t;
}
! if (A != 0) {
! cx /= 3 * A;
! cy /= 3 * A;
! } else {
! cx = 0.5 * (x0 + x1);
! cy = 0.5 * (y0 + y1);
! }
glBegin(GL_TRIANGLE_FAN);
coords1.vertex(ZPt(cx, cy, p[0].z));
***************
*** 667,673 ****
float bx = border * (cs2inv.transform(ZPt(0,0,0) + xvec) -
cs2inv.transform(ZPt(0,0,0))).length();
float by = border * (cs2inv.transform(ZPt(0,0,0) + yvec) -
cs2inv.transform(ZPt(0,0,0))).length();
! //cout << bx << "," << by << "\\n";
float x0 = 1;
float x1 = 1 - bx;
--- 673,679 ----
float bx = border * (cs2inv.transform(ZPt(0,0,0) + xvec) -
cs2inv.transform(ZPt(0,0,0))).length();
float by = border * (cs2inv.transform(ZPt(0,0,0) + yvec) -
cs2inv.transform(ZPt(0,0,0))).length();
! cout << bx << "," << by << "\\n";
float x0 = 1;
float x1 = 1 - bx;
***************
*** 708,715 ****
*/
float texf = 0.5;
! DBG(dbg) << "Dice: " << dice <<"\\n";
!
for (int pass = 0; pass < (mode ? 4 : 1); pass++) {
--- 714,720 ----
*/
float texf = 0.5;
! DBG(dbg) << "Dice: " << dicex << " " << dicey << " " << diceb << "\n";
for (int pass = 0; pass < (mode ? 4 : 1); pass++) {
***************
*** 798,803 ****
--- 803,810 ----
}
glPopAttrib();
+
+ DBG(dbg) << "IrregularQuad done\\n";
""",
} ,
- [Gzz-commits] gzz/gfx/librenderables renderables.py,
Janne V. Kujala <=
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Janne V. Kujala, 2002/10/01
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Janne V. Kujala, 2002/10/01
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Tuomas J. Lukka, 2002/10/06
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Matti Katila, 2002/10/10
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Matti Katila, 2002/10/14
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Matti Katila, 2002/10/15
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Janne V. Kujala, 2002/10/18
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Janne V. Kujala, 2002/10/18
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Matti Katila, 2002/10/29