[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob include/vob/trans/LinearPrimitives.hxx i...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] libvob include/vob/trans/LinearPrimitives.hxx i... |
Date: |
Fri, 25 Apr 2003 13:16:45 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Changes by: Tuomas J. Lukka <address@hidden> 03/04/25 13:16:45
Modified files:
include/vob/trans: LinearPrimitives.hxx
include/vob/vobs: Trivial.hxx
test/tools : gfx.py
test/vob/gl : glvobcoorder.test
vob/buoy : buoymanager.py
Log message:
YESSSSSSSSS\!\!\! Finally, after a long chase, the bug (which turned
out to be in nadirunitsq) found
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/trans/LinearPrimitives.hxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Trivial.hxx.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/test/tools/gfx.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/test/vob/gl/glvobcoorder.test.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/buoy/buoymanager.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
Patches:
Index: libvob/include/vob/trans/LinearPrimitives.hxx
diff -u libvob/include/vob/trans/LinearPrimitives.hxx:1.4
libvob/include/vob/trans/LinearPrimitives.hxx:1.5
--- libvob/include/vob/trans/LinearPrimitives.hxx:1.4 Wed Apr 16 06:37:57 2003
+++ libvob/include/vob/trans/LinearPrimitives.hxx Fri Apr 25 13:16:45 2003
@@ -204,9 +204,9 @@
to.z = from.z;
}
void performGL() const {
- glTranslatef(ox, oy, 0);
- glRotatef(a, 0, 0, 1);
glTranslatef(-ox, -oy, 0);
+ glRotatef(a, 0, 0, 1);
+ glTranslatef(ox, oy, 0);
}
typedef RotateCenteredXY InverseType;
void inverse(InverseType &into) const {
@@ -238,6 +238,8 @@
float angle = atan2(x, -y);
a = angle * 180 / M_PI;
+
+ angleWasSet();
}
Pt getSqSize() const {
Index: libvob/include/vob/vobs/Trivial.hxx
diff -u libvob/include/vob/vobs/Trivial.hxx:1.15
libvob/include/vob/vobs/Trivial.hxx:1.16
--- libvob/include/vob/vobs/Trivial.hxx:1.15 Fri Apr 11 08:45:42 2003
+++ libvob/include/vob/vobs/Trivial.hxx Fri Apr 25 13:16:45 2003
@@ -43,6 +43,8 @@
namespace Vob {
namespace Vobs {
+using namespace Vob::VecGL;
+
/** A line drawn between the centers of two coordinate systems.
*/
struct LineConnector {
@@ -164,6 +166,41 @@
};
VOB_DEFINED(CallListBoxCoorded);
+/** For debugging differences between GL and real transformations.
+ */
+struct Quad {
+ enum { NTrans = 1 };
+ int flags;
+ template<class F> void params(F &f) {
+ f(flags);
+ }
+ template<class T> void render(const T &t) const {
+ Pt boxwh = t.getSqSize();
+ if(flags & 1) {
+ glPushMatrix();
+ t.performGL();
+ glBegin(GL_QUAD_STRIP);
+ glVertex(ZPt(0,0,0));
+ glVertex(ZPt(boxwh.x,0,0));
+ glVertex(ZPt(0,boxwh.y,0));
+ glVertex(ZPt(boxwh.x,boxwh.y,0));
+ glEnd();
+ glPopMatrix();
+ } else {
+ glBegin(GL_QUAD_STRIP);
+ glVertex(t.transform(ZPt(0,0,0)));
+ glVertex(t.transform(ZPt(boxwh.x,0,0)));
+ glVertex(t.transform(ZPt(0,boxwh.y,0)));
+ glVertex(t.transform(ZPt(boxwh.x,boxwh.y,0)));
+ glEnd();
+ }
+ }
+};
+VOB_DEFINED(Quad);
+
+
+/** Timing transformations.
+ */
struct TransTest {
enum { NTrans = 1 };
Index: libvob/test/tools/gfx.py
diff -u libvob/test/tools/gfx.py:1.8 libvob/test/tools/gfx.py:1.9
--- libvob/test/tools/gfx.py:1.8 Tue Apr 8 16:23:08 2003
+++ libvob/test/tools/gfx.py Fri Apr 25 13:16:45 2003
@@ -129,9 +129,22 @@
d = vob.vobs.TestSpotVob(src[i], src[i+1], src[i+2])
vs.map.put(d, cs)
render(vs)
+ if (not 3 < dstlist[i] < 500-3 or
+ not 3 < dstlist[i+1] < 500-3):
+ continue
checkNotAvgColor(
int(dstlist[i])-1, int(dstlist[i+1])-1,
3, 3, (255, 0, 0), delta=50)
+
+def checkTransEq(vs, cs, srclist):
+ """Check that opengl and c++ transformations yield equal results.
+ """
+ src = array(srclist, 'f')
+ dst = vs.coords.transformPoints3(cs, src, None)
+ failUnless(dst != None)
+ dstlist = [i for i in dst]
+ checkTrans(vs, cs, srclist, dstlist)
+
def checkInterp(vs1, vs2, i, fract, cs, srclist, dstlist, delta=0):
src = array(srclist, 'f')
Index: libvob/test/vob/gl/glvobcoorder.test
diff -u libvob/test/vob/gl/glvobcoorder.test:1.13
libvob/test/vob/gl/glvobcoorder.test:1.14
--- libvob/test/vob/gl/glvobcoorder.test:1.13 Thu Apr 17 01:21:40 2003
+++ libvob/test/vob/gl/glvobcoorder.test Fri Apr 25 13:16:45 2003
@@ -62,9 +62,10 @@
# Clockwise rotation
c.setRotateParams(r, 90)
checkTrans(vs, r, [0, 0, 0, 0, 50, 0], [100, 100, 0, 50, 100, 0])
+
def checkInverse(c, cs):
# unit cube
- src = array([
+ list = [
0, 0, 0,
0, 0, 1,
0, 1, 0,
@@ -82,7 +83,10 @@
-100, 0, -100,
-100, -100, 0,
-100, -100, -100,
- ], 'f')
+ ]
+ src = array(list , 'f')
+
+ checkTransEq(vs, cs, list)
dst = zeros(len(src), 'f')
src2 = zeros(len(src), 'f')
@@ -121,7 +125,6 @@
def testInverses():
for i in range(0,5):
- c = getvs().coords
cs_ortho = c.ortho(0, 2, 3.5, 9.1, 1.2, 3.9)
cs_ortho2 = c.ortho(cs_ortho, -1.92, 4.1, 2.951, 2.52, 291)
@@ -316,6 +319,10 @@
failUnlessEqual(wh[0], 6);
failUnlessEqual(wh[1], 7);
cs3 = vs.coords.nadirUnitSq(cs1, cs2)
+
+ checkTransEq(vs, cs1, [0,0,0, 1,1,1, 100,100,100])
+ checkTransEq(vs, cs2, [0,0,0, 1,1,1, 100,100,100])
+ checkTransEq(vs, cs3, [0,0,0, 1,1,1, 100,100,100])
wh = zeros(2, 'f')
Index: libvob/vob/buoy/buoymanager.py
diff -u libvob/vob/buoy/buoymanager.py:1.9 libvob/vob/buoy/buoymanager.py:1.10
--- libvob/vob/buoy/buoymanager.py:1.9 Fri Apr 25 10:07:42 2003
+++ libvob/vob/buoy/buoymanager.py Fri Apr 25 13:16:45 2003
@@ -80,10 +80,12 @@
# rule 1) this translate is 'FocusCenter'
center = vs.translateCS(0, "FocusCenter", self.ctrx, self.ctry)
+ #center = vs.affineCS(0, "FocusCenter", 0, self.ctrx, self.ctry,
+ # .6, .3, -.3, .9)
# rule 2) this box is 'FocusFrame'
into = vs.orthoBoxCS(center, "FocusFrame", 0,
- -mainsize/2, -mainsize/2, 1, 1, mainsize,
mainsize)
+ -mainsize/2, -mainsize/2, 1, 1, mainsize,
mainsize)
self.vs.activate(into)
@@ -110,6 +112,7 @@
anchorCenter = self.vs.translateCS(anchorUnit, "TR55", .5, .5)
x = self.ctrx
r = self.ctry * 1.05
+ print "Buoy: ",self.ctrx, self.ctry, x, r
if direction > 0:
buoy = self.vs.coords.buoyOnCircle1(0, anchorCenter,
x, self.ctry, r,
@@ -135,6 +138,7 @@
sca = 1.5
+ print "BuoyScaling: ",w, h, sca
into = self.vs.orthoBoxCS(buoy, "V"+str(linkId), -100, -w*sca/2.0,
-h*sca/2.0,
1, 1, w*sca, h*sca)
@@ -142,7 +146,7 @@
dbg1 = self.vs.unitSqCS(into, "U")
self.vs.put(coloredQuad((0,1,0)), dbg1)
into = self.nadir(into)
- into = self.vs.orthoBoxCS(into, "Kludge CS", 0, 0,0, 1,1, size[0],
size[1])
+ # into = self.vs.orthoBoxCS(into, "Kludge CS", 0, 0,0, 1,1, w*sca,
h*sca)
self.vs.activate(into)
otherAnchorCS = otherNode.renderBuoy(self.vs, into, linkId,
otherAnchor, None)
self.cs[into] = (otherNode, linkId, otherAnchor, into)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] libvob include/vob/trans/LinearPrimitives.hxx i...,
Tuomas J. Lukka <=