gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz ./TODO gfx/libcoords/Coords.cxx gfx/libcoor...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./TODO gfx/libcoords/Coords.cxx gfx/libcoor...
Date: Thu, 19 Dec 2002 18:06:01 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/12/19 18:06:01

Modified files:
        .              : TODO 
        gfx/libcoords  : Coords.cxx Coords.hxx 
        gfx/librenderables: Renderables.hxx 
        gfx/libutil    : Vec23.hxx 
        gzz/view       : CellView.java 
        metacode       : umltool.py 
        test/gzz/vob   : vobcoorder.test 
        test/tools     : gfx.py 

Log message:
        Implement vobscene_interp

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.466&tr2=1.467&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx.diff?tr1=1.57&tr2=1.58&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.hxx.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/Renderables.hxx.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/Vec23.hxx.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellView.java.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/umltool.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/vob/vobcoorder.test.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/tools/gfx.py.diff?tr1=1.14&tr2=1.15&r1=text&r2=text

Patches:
Index: gzz/TODO
diff -u gzz/TODO:1.466 gzz/TODO:1.467
--- gzz/TODO:1.466      Thu Dec 19 12:45:17 2002
+++ gzz/TODO    Thu Dec 19 18:06:00 2002
@@ -48,15 +48,12 @@
            - less pages 
     tjl:
        + return ANKOS to Agora [ blocked by: waiting for trip to agora ]
-       - for mudyc, PP: vobscene_interp
        - go through most important GL demos and redo the interfaces
          and document
+           - paper
            - xupdf
                - fix for new buoys
            - irregu 
-           - paper
-       - gl demo help
-           - scenes!
        - a really comprehensive web page of screenshots, animations
          and instructions on how to get them working.
            - clean up OpenGL demos and views and document, list
@@ -553,12 +550,12 @@
 -------------------------------------------
 PUBLICATIONS (approximate planned time order)
 
-benja, tjl: article about urn-5 to First Monday
 humppake, tjl, benja: UML jlink tool --> HT03?
-tjl, benja, ?: nadir, buoys --> HT03? Basically, the 2002 general demo
+tjl, benja, ?: nadir, buoys --> HT03? Basically, the 2002 general demo xupdf
+benja, tjl: article about urn-5 to First Monday
 tjl, jvk, marke: paper generalizing fillets to Information Visualization
+jvk, tjl, benja: Software practice & experience: callgl + jython-java-c++ code 
path + vobs + 'r'  - ?
 tjl, ?: blobs
-jvk, tjl: Software practice & experience: callgl + jython-java-c++ code path + 
'r'  - ?
 benja, tjl, (anybody else?): diff paper (benja needs to submit a version
                              of this as a thesis for school in February 2003)
 
@@ -566,7 +563,6 @@
 - add suggestions below
 
 ?, benja, ?: General paper about Storm (*after* writing PEGs)
-?, benja, ?: The vob paper revived
 
 -------------------------------------------
 RESEARCH:
Index: gzz/gfx/libcoords/Coords.cxx
diff -u gzz/gfx/libcoords/Coords.cxx:1.57 gzz/gfx/libcoords/Coords.cxx:1.58
--- gzz/gfx/libcoords/Coords.cxx:1.57   Thu Dec 19 04:12:39 2002
+++ gzz/gfx/libcoords/Coords.cxx        Thu Dec 19 18:06:00 2002
@@ -1,151 +1,154 @@
 #include "libutil/Debug.hxx"
 #include "libfisheye/Fisheye.hxx"
 #include "Coords.hxx"
+#include "libutil/VecGL.hxx"
 #include <GL/gl.h>
 #include <math.h>
 
+using namespace VecGL;
+
 namespace Coords {
-    DBGVAR(dbg, "Coords.general");
-    DBGVAR(dbg_buoy, "Coords.buoy");
-    DBGVAR(dbg_cull, "Coords.culling");
-
-    // The (STL-like) concept of transform:
-    // enum { NParams = n };
-    // void tr(const ZPt &from, ZPt &to) const
-    // float tr_radius(const ZPt &from, float radius) const
-    // bool canPerformGL()
-    // bool performGL()
-    // float nonlinearity(const ZPt &p, float radius)
-    // void setParams(array/iterator i)
-    // typedef X InverseType;
-    //
-    // This approach is needed because inverse transforms and transforms need
-    // to call their parents at different points.
-    //
-    // XXX Nonlinearity is calculated wrong!
-    
-    template<class Transform> class TransformCoordSysBase : public CoordSys {
-    protected:
-       Transform t;
-    public:
-       TransformCoordSysBase() : t() { }
-       TransformCoordSysBase(const Transform &tr) : t(tr) { }
-       virtual void setParams(float *params) {
-           t.setParams(params, super);
-       }
-       bool canPerformGL() { 
-           return t.canPerformGL() && super->canPerformGL();  
-       }
-    };
+DBGVAR(dbg, "Coords.general");
+DBGVAR(dbg_buoy, "Coords.buoy");
+DBGVAR(dbg_cull, "Coords.culling");
+
+// The (STL-like) concept of transform:
+// enum { NParams = n };
+// void tr(const ZPt &from, ZPt &to) const
+// float tr_radius(const ZPt &from, float radius) const
+// bool canPerformGL()
+// bool performGL()
+// float nonlinearity(const ZPt &p, float radius)
+// void setParams(array/iterator i)
+// typedef X InverseType;
+//
+// This approach is needed because inverse transforms and transforms need
+// to call their parents at different points.
+//
+// XXX Nonlinearity is calculated wrong!
+
+template<class Transform> class TransformCoordSysBase : public CoordSys {
+protected:
+    Transform t;
+public:
+    TransformCoordSysBase() : t() { }
+    TransformCoordSysBase(const Transform &tr) : t(tr) { }
+    virtual void setParams(float *params) {
+       t.setParams(params, super);
+    }
+    bool canPerformGL() { 
+       return t.canPerformGL() && super->canPerformGL();  
+    }
+};
 
-    template<class Transform> class InverseTransformCoordSys;
+template<class Transform> class InverseTransformCoordSys;
 
-    template<class Transform> class TransformCoordSys : public 
TransformCoordSysBase<Transform> {
-    public:
-       virtual ZPt transform(const ZPt &p) const {
-           ZPt mp;
-           t.tr(p, mp);
-           return super->transform(mp);
-       }
-       virtual void vertex(const ZPt &p) const {
-           ZPt mp;
-           t.tr(p, mp);
-           super->vertex(mp);
-       }
-        virtual bool performGL() {
-           if(!super->performGL()) return false;
-           return t.performGL();
-       }
+template<class Transform> class TransformCoordSys : public 
TransformCoordSysBase<Transform> {
+public:
+    virtual ZPt transform(const ZPt &p) const {
+       ZPt mp;
+       t.tr(p, mp);
+       return super->transform(mp);
+    }
+    virtual void vertex(const ZPt &p) const {
+       ZPt mp;
+       t.tr(p, mp);
+       super->vertex(mp);
+    }
+    virtual bool performGL() {
+       if(!super->performGL()) return false;
+       return t.performGL();
+    }
 
-       virtual CoordSys *createInverse() {
-           CoordSys *sinv = super->getInverse();
-           typedef InverseTransformCoordSys<typename Transform::InverseType> 
Inv;
-           Inv *ret = new Inv(sinv, t);
-           ret->setOriginal(this);
-           return ret;
-       }
+    virtual CoordSys *createInverse() {
+       CoordSys *sinv = super->getInverse();
+       typedef InverseTransformCoordSys<typename Transform::InverseType> Inv;
+       Inv *ret = new Inv(sinv, t);
+       ret->setOriginal(this);
+       return ret;
+    }
 
-       virtual float nonlinearity(const ZPt &p, float radius) { 
-           radius = fabs(radius);
-           ZPt mp;
-           t.tr(p, mp);
-           float srad = fabs(t.tr_radius(p, radius));
-           float snon = super->nonlinearity(mp, srad);
-           // Multiply to take into account shrinking / magnifying.
-           snon *= (srad+0.000001) / (radius+0.00001);
-           float non = t.nonlinearity(p, radius);
-           return (non > snon ? non : snon);
-       }
+    virtual float nonlinearity(const ZPt &p, float radius) { 
+       radius = fabs(radius);
+       ZPt mp;
+       t.tr(p, mp);
+       float srad = fabs(t.tr_radius(p, radius));
+       float snon = super->nonlinearity(mp, srad);
+       // Multiply to take into account shrinking / magnifying.
+       snon *= (srad+0.000001) / (radius+0.00001);
+       float non = t.nonlinearity(p, radius);
+       return (non > snon ? non : snon);
+    }
 
-    };
+};
 
-    /** A TransformCoordSys that also uses the W, H definition of its 
parameter.
-     */
-    template<class Transform> class TransformWHCoordSys : public 
TransformCoordSys<Transform> {
-    public:
-       virtual Pt getSqSize() {
-           return t.getSqSize(); 
-       }
+/** A TransformCoordSys that also uses the W, H definition of its parameter.
+ */
+template<class Transform> class TransformWHCoordSys : public 
TransformCoordSys<Transform> {
+public:
+    virtual Pt getSqSize() {
+       return t.getSqSize(); 
+    }
 
-    };
+};
 
-    template<class Deriver> 
-           class DerivedTransformCoordSys : 
-               public TransformCoordSys<typename Deriver::BaseTransform> {
-       CoordSys *dep[Deriver::NDetermining >? 1];
-       float nparams[Deriver::BaseTransform::NParams];
-       Deriver d;
+template<class Deriver> 
+       class DerivedTransformCoordSys : 
+           public TransformCoordSys<typename Deriver::BaseTransform> {
+    CoordSys *dep[Deriver::NDetermining >? 1];
+    float nparams[Deriver::BaseTransform::NParams];
+    Deriver d;
 
 
-       virtual void setSuper(CoordSys **super) {
-           CoordSys::setSuper(super);
-           for(int i=0; i<Deriver::NDetermining; i++)
-               this->dep[i] = super[1 + i];
-       }
+    virtual void setSuper(CoordSys **super) {
+       CoordSys::setSuper(super);
+       for(int i=0; i<Deriver::NDetermining; i++)
+           this->dep[i] = super[1 + i];
+    }
 
-       virtual void setParams(float *params) {
-           d.derivedParams(super, dep, params, nparams);
-           t.setParams(nparams, super);
-       }
-       virtual bool getOthertypeParams(int type, float *into) {
-           if(type == Deriver::BaseTransform::TransId) {
-               for(int i=0; i<Deriver::BaseTransform::NParams; i++)
-                   into[i] = nparams[i];
-               return true;
-           }
-           return false;
-       }
-       virtual bool shouldBeDrawn() {
-           return d.shouldBeDrawn();
+    virtual void setParams(float *params) {
+       d.derivedParams(super, dep, params, nparams);
+       t.setParams(nparams, super);
+    }
+    virtual bool getOthertypeParams(int type, float *into) {
+       if(type == Deriver::BaseTransform::TransId) {
+           for(int i=0; i<Deriver::BaseTransform::NParams; i++)
+               into[i] = nparams[i];
+           return true;
        }
-    };
+       return false;
+    }
+    virtual bool shouldBeDrawn() {
+       return d.shouldBeDrawn();
+    }
+};
 
-    template<class Transform> class InverseTransformCoordSys : public 
TransformCoordSysBase<Transform> {
-    public:
-       template<class Original> InverseTransformCoordSys(CoordSys *s, Original 
&o) : 
-               TransformCoordSysBase<Transform>(o.inverseTransform()) {
-           super = s;
-       }
+template<class Transform> class InverseTransformCoordSys : public 
TransformCoordSysBase<Transform> {
+public:
+    template<class Original> InverseTransformCoordSys(CoordSys *s, Original 
&o) : 
+           TransformCoordSysBase<Transform>(o.inverseTransform()) {
+       super = s;
+    }
 
-       virtual ZPt transform(const ZPt &p) const {
-           ZPt mp = super->transform(p);
-           ZPt res;
-           t.tr(mp, res);
-           return res;
-       }
-       virtual void vertex(const ZPt &p) const {
-           ZPt mp = transform(p);
-           glVertex3f(mp.x, mp.y, mp.z);
-       }
-        virtual bool performGL() {
-           if(!t.performGL()) return false;
-           return super->performGL();
-       }
-       void setOriginal(CoordSys *orig) { inverse = orig; ownInverse = 0;}
+    virtual ZPt transform(const ZPt &p) const {
+       ZPt mp = super->transform(p);
+       ZPt res;
+       t.tr(mp, res);
+       return res;
+    }
+    virtual void vertex(const ZPt &p) const {
+       ZPt mp = transform(p);
+       glVertex3f(mp.x, mp.y, mp.z);
+    }
+    virtual bool performGL() {
+       if(!t.performGL()) return false;
+       return super->performGL();
+    }
+    void setOriginal(CoordSys *orig) { inverse = orig; ownInverse = 0;}
 
-    };
+};
 
-    class RootCoords : public CoordSys {
+class RootCoords : public CoordSys {
     public:
        virtual void setParams(float *params) { }
        virtual ZPt transform(const ZPt &p) const {
@@ -166,6 +169,71 @@
        }
     };
 
+
+struct PointInterpCoordSys : public CoordSys {
+    CoordSys *cs1, *cs2;
+    float fract;
+    PointInterpCoordSys(CoordSys *cs1, CoordSys *cs2, float fract)
+           : cs1(cs1), cs2(cs2), fract(fract) { }
+    virtual CoordSys *createInverse() {
+       // XXX ARGH!
+       ownInverse = true;
+       return new RootCoords();
+    }
+    virtual void setSuper(CoordSys **super) {
+    }
+    virtual void setParams(float *params) {
+    }
+    virtual void vertex(const ZPt &p) const {
+       glVertex(transform(p));
+    }
+    virtual ZPt transform(const ZPt &p) const {
+       return lerp(cs1->transform(p), 
+                   cs2->transform(p),
+                   fract);
+    }
+    virtual float nonlinearity(const ZPt &p, float radius) { 
+       return lerp(cs1->nonlinearity(p, radius), 
+               cs2->nonlinearity(p, radius), fract);
+    }
+
+    virtual bool shouldBeDrawn() {
+       return cs1->shouldBeDrawn() && cs2->shouldBeDrawn();
+    }
+    virtual Pt getSqSize() {
+       return lerp(cs1->getSqSize(), cs2->getSqSize(), fract);
+    }
+    
+    bool canPerformGL() { 
+       return cs1->canPerformGL() && cs2->canPerformGL(); 
+    }
+    bool performGL() { 
+       // XXX Allow using of vertex weighting or something
+       if(!canPerformGL()) return false;
+       GLfloat mat1[16], mat2[16];
+       glPushAttrib(GL_TRANSFORM_BIT);
+       glMatrixMode(GL_MODELVIEW);
+       glPushMatrix();
+
+       glLoadIdentity();
+       cs1->performGL();
+       glGetFloatv(GL_MODELVIEW_MATRIX, mat1);
+
+       glLoadIdentity();
+       cs2->performGL();
+       glGetFloatv(GL_MODELVIEW_MATRIX, mat2);
+
+       for(int i=0; i<16; i++) mat1[i] = lerp(mat1[i], mat2[i], fract);
+
+
+       glPopMatrix();
+       glPopAttrib();
+
+       glMultMatrixf(mat1);
+       return true; 
+    }
+};
+
     struct UnitCoords {
        enum { NParams = 0 };
        void tr(const ZPt &from, ZPt &to) const {
@@ -1144,6 +1212,27 @@
        return facs[typecode]->create();
     }
 
+    CoordSet::CoordSet() : cs1_tmp(0), cs2_tmp(0) {
+    }
+    CoordSet::~CoordSet() {
+       if(cs1_tmp) { delete cs1_tmp; cs1_tmp = 0; }
+       if(cs2_tmp) { delete cs2_tmp; cs2_tmp = 0; }
+    }
+
+    // Once types are checked, this method checks the parents.
+    bool CoordSet::shouldInterpolate(int cs1, int cs2, int nprev) {
+       DBG(dbg) << "Shouldinterp "<<cs1<<" "<<cs2<<" "<<nprev<<"\n";
+       for(int i=0; i<nprev; i++) {
+           int par1 = inds1[cs1+1+i];
+           if(!cs[par1]) return false;
+           int par2 = inds1[cs2+1+i];
+           if(par1 >= interpinds[0]) return false;
+           if(interpinds[par1] != par2) return false;
+       }
+       DBG(dbg) << "DO interpolate\n";
+       return true;
+    }
+
     void CoordSet::setPoints( int ninds, 
                                 int *inds1, float *points1, 
                                 int *interpinds, 
@@ -1157,6 +1246,14 @@
                    << points2 << " " 
                    << fract << " " 
                    << show1 << "\n" ;
+#define ASG(x) this->x = x;
+       ASG(ninds)
+       ASG(inds1)
+       ASG(points1)
+       ASG(interpinds)
+       ASG(inds2)
+       ASG(points2)
+
        params.resize(0);
        DBG(dbg)  << "Resized\n";
        params.reserve(3*ninds);
@@ -1167,8 +1264,8 @@
        DBG(dbg)  << "setroot\n";
        int lastIndSize = 1;
 
-       CoordSet *cs1_tmp = 0;
-       CoordSet *cs2_tmp = 0;
+       if(cs1_tmp) { delete cs1_tmp; cs1_tmp = 0; }
+       if(cs2_tmp) { delete cs2_tmp; cs2_tmp = 0; }
 
        this->maxcs = ninds;
 
@@ -1185,28 +1282,37 @@
 
            lastIndSize = nprev + 2; // typecode, prevs and paramind
 
-           CoordSys *prev[nprev];
 
            ind1 = inds1[i+1+nprev];
            csind2 = ((interpinds && i < interpinds[0]) ? interpinds[i] : -1);
            DBG(dbg) << "inds: "<<parind<<" typ:"<<tp<<" npars:"<<npars<<
-                           " parent:"<<prev[0]<<" "<<
                            " ind1:"<<ind1<<" "<<csind2<<"\n";
 
-
-           if(csind2 <= 0) {
-
-               if(show1) {
-                   for(int j = 0; j<npars; j++) {
-                       params.push_back(points1[ind1 + j]);
+           CoordSys *c;
+           int t2 = 0;
+           int ind2 = 0;
+           if(csind2 > 0) {
+               t2 = inds2[csind2] & ~CSFLAGS;
+               ind2 = inds2[csind2 + 1 + nprevious(t2)];
+           }
+           // We need to interpolate. Check the structural constraints:
+           // If
+           //   1) both are of same type
+           //   2) all parents interpolate to each other exactly
+           // then use parameter interpolation
+           // Else, use pointwise interpolation
+           if(csind2 <= 0 || (t2 == tp && shouldInterpolate(i, csind2, 
nprev))) {
+
+               if(csind2 <= 0) {
+
+                   if(show1) {
+                       for(int j = 0; j<npars; j++) {
+                           params.push_back(points1[ind1 + j]);
+                       }
+                   } else {
+                       continue;
                    }
                } else {
-                   continue;
-               }
-           } else {
-               int t2 = inds2[csind2] & ~CSFLAGS;
-               int ind2 = inds2[csind2 + 1 + nprevious(t2)];
-               if(t2 == tp) {
                    for(int j = 0; j<npars; j++) {
                        DBG(dbg) << "Interpolating "
                            <<(ind1+j)<<" " <<(ind2+j)<<"  = "
@@ -1215,68 +1321,8 @@
                            lerp(points1[ind1 + j], 
                                 points2[ind2 + j], fract));
                    }
-               } else {
-                   // Now, the hairy case.
-                   DBG(dbg) << "It got hairy now: "<<tp<<" "<<t2<<"\n";
-                   if(!cs1_tmp) {
-                       cs1_tmp = new CoordSet();
-                       cs1_tmp->setPoints(ninds, inds1, points1,
-                                   0,  0,      0,      0, true);
-                   }
-                   if(!cs2_tmp) {
-                       int maxind = 0;
-                       for(int k = 1; k<interpinds[0]; k++)
-                           if(interpinds[k] > maxind) 
-                               maxind = interpinds[k];
-                       cs2_tmp = new CoordSet();
-                       cs2_tmp->setPoints(maxind+1, inds2, points2, 0, 0, 0,
-                                           0, true);
-                   }
-                   CoordSys *cs1_non = cs1_tmp->get(i);
-                   CoordSys *cs2_non = cs2_tmp->get(csind2);
-
-                   if(!cs1_non || !cs2_non) goto nextInd;
-
-                   // Next, the conversion.
-                   // For now, insist on one converting directly
-                   // to the other. Later need to search
-                   // inheritance tree
-                   int cs1_np = npars;
-                   int cs2_np = nparams(t2);
-                   // Just try each conversion routine;
-                   int maxpar = cs1_np >? cs2_np; // gnu c++-ism.
-                   float newpars[maxpar];
-                   DBG(dbg) << "Try getOther: "<<maxpar<<
-                        " " << cs1_non << " " 
-                        << cs2_non << "\n";
-                   if(cs1_non->getOthertypeParams(t2, newpars)) {
-                       DBG(dbg) << "Changed 1\n";
-                       for(int i=0; i<cs2_np; i++) {
-                           DBG(dbg) << "Interp "<<newpars[i]<<" 
"<<points2[ind2+i]<<"\n";
-                           params.push_back(
-                                   lerp(newpars[i], 
-                                        points2[ind2 + i],
-                                        fract));
-                       }
-                       // NOTE!!!
-                       tp = t2;
-                       nprev = nprevious(tp);
-                       // Now, fall through, it gets created right.
-                   } else if(cs2_non->getOthertypeParams(tp, newpars)) {
-                       DBG(dbg) << "Changed 2\n";
-                       for(int i=0; i<cs1_np; i++) {
-                           DBG(dbg) << "Interp "<<points1[ind1+i]<<" 
"<<newpars[i]<<" "<<"\n";
-                           params.push_back(
-                                   lerp(points1[ind1 + i],
-                                        newpars[i], 
-                                        fract));
-                       }
-                       // Fall through, it's the right type
-                   }
-                   DBG(dbg) << "Done getother: "<<tp<<"\n";
                }
-           }
-           {
+               CoordSys *prev[nprev];
                
                for(int j=0; j<nprev; j++) {
                    int parent = inds1[i+1+j];
@@ -1293,10 +1339,36 @@
                 * params. If the initialized coordsys (according to its 
initialized attributes) 
                 * decides not to be drawn, it will be deleted and replaced 
with the NULL pointer. 
                 */
-               CoordSys *c = create(tp);
-               cs[i] = c;
+               c = create(tp);
                c->setSuper(prev);
                c->setParams(&(params[0]) + parind);
+           } else {
+               // Now, the hairy case.
+               DBG(dbg) << "It got hairy now: "<<tp<<" "<<t2<<"\n";
+               if(!cs1_tmp) {
+                   cs1_tmp = new CoordSet();
+                   cs1_tmp->setPoints(ninds, inds1, points1,
+                               0,      0,      0,      0, true);
+               }
+               if(!cs2_tmp) {
+                   int maxind = 0;
+                   for(int k = 1; k<interpinds[0]; k++)
+                       if(interpinds[k] > maxind) 
+                           maxind = interpinds[k];
+                   cs2_tmp = new CoordSet();
+                   cs2_tmp->setPoints(maxind+1, inds2, points2, 0, 0, 0,
+                                       0, true);
+               }
+               CoordSys *cs1_non = cs1_tmp->get(i);
+               CoordSys *cs2_non = cs2_tmp->get(csind2);
+
+               if(!cs1_non || !cs2_non) goto nextInd;
+
+               c = new PointInterpCoordSys(cs1_non, cs2_non, fract);
+
+           }
+           {
+               cs[i] = c;
 
                if (!cs[i]->shouldBeDrawn()) {
                  DBG(dbg) << "CS should not be drawn... freeing it with 
delete.\n";
@@ -1306,8 +1378,6 @@
            }
        nextInd:;
        }
-       if(cs1_tmp) delete cs1_tmp;
-       if(cs2_tmp) delete cs2_tmp;
        DBG(dbg)  << "end\n";
     }
 
Index: gzz/gfx/libcoords/Coords.hxx
diff -u gzz/gfx/libcoords/Coords.hxx:1.25 gzz/gfx/libcoords/Coords.hxx:1.26
--- gzz/gfx/libcoords/Coords.hxx:1.25   Sat Dec 14 03:11:34 2002
+++ gzz/gfx/libcoords/Coords.hxx        Thu Dec 19 18:06:00 2002
@@ -120,7 +120,7 @@
         *      is in an undefined state. If this is
         *      not acecptable, try canPerformGL() first.
         */
-       virtual bool performGL() ;
+       virtual bool performGL();
 
        virtual ~CoordSys() { 
            if(inverse && ownInverse) delete inverse;
@@ -180,9 +180,20 @@
        int nparams(int typecode) ;
        int nprevious(int typecode) ;
        CoordSys *create(int typecode) ;
+
+       CoordSet *cs1_tmp ;
+       CoordSet *cs2_tmp ;
+
+       // Not to be ever trusted except inside setPoints()
+       // calls: used to make it possible to use submethods.
+       int ninds;
+        int *inds1; float *points1; 
+        int *interpinds; 
+        int *inds2; float *points2; 
+       bool shouldInterpolate(int cs1, int cs2, int nprev);
     public:
-       ~CoordSet() {
-       }
+       CoordSet();
+       ~CoordSet();
        void clean() {
            for(unsigned i=0; i<cs.size(); i++) {
                if(cs[i]) {
Index: gzz/gfx/librenderables/Renderables.hxx
diff -u gzz/gfx/librenderables/Renderables.hxx:1.26 
gzz/gfx/librenderables/Renderables.hxx:1.27
--- gzz/gfx/librenderables/Renderables.hxx:1.26 Fri Dec 13 07:16:06 2002
+++ gzz/gfx/librenderables/Renderables.hxx      Thu Dec 19 18:06:00 2002
@@ -20,6 +20,7 @@
 #include "libcoords/Coords.hxx"
 
 #include "libutil/Irregu.hxx"
+#include "libutil/VecGL.hxx"
 
 namespace CurrentFPS {
     // bool showFPS;
@@ -43,10 +44,8 @@
     PREDBGVAR(dbg_calendar);
 
     using namespace Vec23;
+    using namespace VecGL;
 
-    inline void glVertex(const ZVec &v) { 
-       glVertex3f(v.x, v.y, v.z); 
-    }
 
 
     /** The points of the unit square,
Index: gzz/gfx/libutil/Vec23.hxx
diff -u gzz/gfx/libutil/Vec23.hxx:1.13 gzz/gfx/libutil/Vec23.hxx:1.14
--- gzz/gfx/libutil/Vec23.hxx:1.13      Thu Dec 19 04:12:39 2002
+++ gzz/gfx/libutil/Vec23.hxx   Thu Dec 19 18:06:00 2002
@@ -21,8 +21,8 @@
  * Written by Tuomas J. Lukka
  */
 
-#ifndef __GUMMIBASIC_H
-#define __GUMMIBASIC_H
+#ifndef __VEC23_HXX
+#define __VEC23_HXX
 #include <iostream>
 #include <math.h>
 
Index: gzz/gzz/view/CellView.java
diff -u gzz/gzz/view/CellView.java:1.9 gzz/gzz/view/CellView.java:1.10
--- gzz/gzz/view/CellView.java:1.9      Thu Dec  5 20:03:51 2002
+++ gzz/gzz/view/CellView.java  Thu Dec 19 18:06:00 2002
@@ -1,5 +1,5 @@
 /*
-CellInBox.java
+CellView.java
  *    
  *    Copyright (c) 2002, Tuomas J. Lukka
  *    
@@ -36,7 +36,7 @@
  * the default implementations call each other.
  */
 public abstract class CellView {
-public static final String rcsid = "$Id: CellView.java,v 1.9 2002/12/06 
01:03:51 benja Exp $";
+public static final String rcsid = "$Id: CellView.java,v 1.10 2002/12/19 
23:06:00 tjl Exp $";
     /** Place the contents of one cell into the given coord system.
      * The coordsys given shall be a mapping from the rectangle
      * (0,w)x(0,h) onto the screen.
Index: gzz/metacode/umltool.py
diff -u gzz/metacode/umltool.py:1.8 gzz/metacode/umltool.py:1.9
--- gzz/metacode/umltool.py:1.8 Thu Dec 19 17:24:42 2002
+++ gzz/metacode/umltool.py     Thu Dec 19 18:06:00 2002
@@ -783,11 +783,12 @@
     bbox = psbbox(bbox[1:])
     for link in links: link.mapCorners(bbox.mapPoint)
 
-    list = bbox.pstopnm(4)
+    scaling = 2
+    list = bbox.pstopnm(scaling)
     print "PSTOPNM: ", list
     syscmd = ("pstopnm -verbose "+" ".join(list)+" <"+path+prefix_out\
-              +""".1 | pnmscale -reduce 4 |
-              pnmtopng >"""+path+prefix_out+".png")
+              +""".1 | pnmscale -reduce %s |
+              pnmtopng >"""%scaling+path+prefix_out+".png")
     print "Command:",syscmd
     os.system(syscmd)
 
Index: gzz/test/gzz/vob/vobcoorder.test
diff -u gzz/test/gzz/vob/vobcoorder.test:1.8 
gzz/test/gzz/vob/vobcoorder.test:1.9
--- gzz/test/gzz/vob/vobcoorder.test:1.8        Thu Nov 21 05:09:11 2002
+++ gzz/test/gzz/vob/vobcoorder.test    Thu Dec 19 18:06:00 2002
@@ -114,6 +114,22 @@
     failUnlessEqual(-1, c.getCSAt(0, 275, 165.5, None))
     failUnlessEqual(-1, c.getCSAt(0, 265, 175.5, None))
 
+def testInterpolateAlways():
+    """Test that vobs always get interpolated, even when hierarchy changes.
+    """
+    cs1 = c.translate(0, 100, 100, 0)
+    cs1_1 = c.translate(cs1, 50, 50, 0)
+    vs.matcher.add(cs1_1, "FOO")
+
+    vs2 = getvs()
+    c2 = vs2.coords
+    cs2 = c2.translate(0, 200, 100, 0)
+    vs2.matcher.add(cs2, "FOO")
+
+    interp = vs.matcher.interpList(vs2.matcher)
+    interp[0] = len(interp)
+    failUnlessEqual(interp[cs1_1], cs2)
+    checkInterp(vs, vs2, interp , .5, cs1_1, [0, 0, 0], [175, 125, 0])
 
 
     
Index: gzz/test/tools/gfx.py
diff -u gzz/test/tools/gfx.py:1.14 gzz/test/tools/gfx.py:1.15
--- gzz/test/tools/gfx.py:1.14  Wed Dec 11 01:15:29 2002
+++ gzz/test/tools/gfx.py       Thu Dec 19 18:06:01 2002
@@ -115,7 +115,7 @@
     src = array(srclist, 'f')
     dst = zeros(len(src), 'f')
     if not vs1.coords.transformPoints3_interp(i, vs2.coords, fract, 0, cs, 
src, dst):
-       raise str("transformpoints for checkinterp negative!", vs1, vs2, cs)
+       raise str(("transformpoints for checkinterp not done!", vs1, vs2, cs))
     for i in range(0, len(src)):
        if abs(dst[i]-dstlist[i]) > delta:
            raise str([srclist, dstlist, dst, i, dst[i], dstlist[i]])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]