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: Mon, 07 Oct 2002 04:51:24 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/10/07 04:51:24

Modified files:
        .              : TODO 
        gfx/libcoords  : Coords.cxx Coords.hxx 
        gzz/gfx/gl     : GLVobCoorder.java 
        test/gzz/gfx/gl: glvobcoorder.test 

Log message:
        Concatenation of coordinate systems works

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.249&tr2=1.250&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.hxx.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLVobCoorder.java.diff?tr1=1.37&tr2=1.38&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/gfx/gl/glvobcoorder.test.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: gzz/TODO
diff -c gzz/TODO:1.249 gzz/TODO:1.250
*** gzz/TODO:1.249      Mon Oct  7 03:40:03 2002
--- gzz/TODO    Mon Oct  7 04:51:24 2002
***************
*** 79,85 ****
        - UML and APIs of ImageCache
        - implementation of ImageCache
      tjl:
-       - coordinate system concatenation!
        - PP [deadline 9.10]
            - make it work again
            - fix directory geometry
--- 79,84 ----
Index: gzz/gfx/libcoords/Coords.cxx
diff -c gzz/gfx/libcoords/Coords.cxx:1.32 gzz/gfx/libcoords/Coords.cxx:1.33
*** gzz/gfx/libcoords/Coords.cxx:1.32   Mon Oct  7 03:40:03 2002
--- gzz/gfx/libcoords/Coords.cxx        Mon Oct  7 04:51:24 2002
***************
*** 285,291 ****
      public:
        BuoyOnCircleCoords() : tr() { }
        BuoyOnCircleCoords(ZVec tr) : tr(tr) { }
!       enum { NParams = 6 };
        virtual void setParams(float *params) {
            float pointdir = params[5];
            ZVec ctr(params[0], params[1], 0);
--- 285,291 ----
      public:
        BuoyOnCircleCoords() : tr() { }
        BuoyOnCircleCoords(ZVec tr) : tr(tr) { }
!       enum { NParams = 6, NPrevious = 1 };
        virtual void setParams(float *params) {
            float pointdir = params[5];
            ZVec ctr(params[0], params[1], 0);
***************
*** 517,522 ****
--- 517,566 ----
        }
      };
  
+     class ConcatCoordSys : public CoordSys {
+       CoordSys *super2;
+     public:
+       ConcatCoordSys() : super2(0) { }
+       ConcatCoordSys(CoordSys *a, CoordSys *b) 
+           : CoordSys(a), super2(b) {
+       }
+       ConcatCoordSys(CoordSys *a, CoordSys *b, CoordSys *inverse, bool 
ownInverse) 
+           : CoordSys(a, inverse, ownInverse), super2(b) {
+       }
+       virtual void setSuper(CoordSys **super) {
+           CoordSys::setSuper(super);
+           this->super2 = super[1];
+       }
+       enum { NParams = 0, NPrevious = 2 } ;
+       virtual void setParams(float *params) { }
+       virtual CoordSys *createInverse() {
+           return new ConcatCoordSys( super2->getInverse(), 
super->getInverse(),
+                       this, 0
+               );
+       }
+       virtual void vertex(const ZPt &p) const {
+           ZPt p2 = super2->transform(p);
+           super->vertex(p2);
+       }
+       virtual ZPt transform(const ZPt &p) const {
+           ZPt p2 = super2->transform(p);
+           return super->transform(p2);
+       }
+       virtual float nonlinearity(const ZPt &p, float radius) { 
+           float n1 = super2->nonlinearity(p, radius);
+           float n2 = super->nonlinearity(super2->transform(p), radius);
+           return (n1 > n2 ? n1 : n2);
+       }
+       virtual bool canPerformGL() { 
+           return super->canPerformGL() && super2->canPerformGL();
+       }
+       virtual bool performGL() { 
+           if(!super2->performGL()) return false;
+           return super->performGL();
+       }
+ 
+     };
+ 
      struct SomeFactory {
        virtual int nparams() = 0;
        virtual int nprevious() = 0;
***************
*** 532,538 ****
      template<class C> class NoTransFactory : public SomeFactory {
      public:
        virtual int nparams() { return C::NParams; }
!       virtual int nprevious() { return 1; }
        virtual CoordSys *create() { return new C(); }
      };
  
--- 576,582 ----
      template<class C> class NoTransFactory : public SomeFactory {
      public:
        virtual int nparams() { return C::NParams; }
!       virtual int nprevious() { return C::NPrevious; }
        virtual CoordSys *create() { return new C(); }
      };
  
***************
*** 543,555 ****
       */
      SomeFactory* facs[] = {
        0, 
!       new Factory<AffineXYCoords>(),
!       new Factory<RotateXYCoords>(),
        new 
Factory<DistortCoords<Fisheye::vector_mag_isotropic<Fisheye::scalar_mag_atan> > 
>(),
!       new Factory<RotateXYZCoords>(),
!       new Factory<ScaleXYZCoords>(),
!       new Factory<TranslateXYZCoords>(),
!       new NoTransFactory<BuoyOnCircleCoords>(),
        0
      };
  
--- 587,601 ----
       */
      SomeFactory* facs[] = {
        0, 
!       new Factory<AffineXYCoords>(), // 1
!       new Factory<RotateXYCoords>(), // 2
        new 
Factory<DistortCoords<Fisheye::vector_mag_isotropic<Fisheye::scalar_mag_atan> > 
>(),
!                                       // 3
!       new Factory<RotateXYZCoords>(), // 4
!       new Factory<ScaleXYZCoords>(), // 5
!       new Factory<TranslateXYZCoords>(), // 6
!       new NoTransFactory<BuoyOnCircleCoords>(), // 7
!       new NoTransFactory<ConcatCoordSys>(), // 8
        0
      };
  
Index: gzz/gfx/libcoords/Coords.hxx
diff -c gzz/gfx/libcoords/Coords.hxx:1.13 gzz/gfx/libcoords/Coords.hxx:1.14
*** gzz/gfx/libcoords/Coords.hxx:1.13   Mon Oct  7 03:40:03 2002
--- gzz/gfx/libcoords/Coords.hxx        Mon Oct  7 04:51:24 2002
***************
*** 16,21 ****
--- 16,26 ----
      public:
        CoordSys() : super(0), inverse(0), ownInverse(1) {
        }
+       CoordSys(CoordSys *super) : super(super), inverse(0), ownInverse(1) {
+       }
+       CoordSys(CoordSys *super, CoordSys *inverse, bool ownInverse = 0) : 
+               super(super), inverse(inverse), ownInverse(ownInverse) {
+       }
  
        virtual void setSuper(CoordSys **super) {
            this->super = super[0];
Index: gzz/gzz/gfx/gl/GLVobCoorder.java
diff -c gzz/gzz/gfx/gl/GLVobCoorder.java:1.37 
gzz/gzz/gfx/gl/GLVobCoorder.java:1.38
*** gzz/gzz/gfx/gl/GLVobCoorder.java:1.37       Mon Oct  7 03:40:03 2002
--- gzz/gzz/gfx/gl/GLVobCoorder.java    Mon Oct  7 04:51:24 2002
***************
*** 29,35 ****
  import gzz.client.gl.*;
  
  public class GLVobCoorder extends AffineVobCoorder {
! public static final String rcsid = "$Id: GLVobCoorder.java,v 1.37 2002/10/07 
07:40:03 tjl Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
--- 29,35 ----
  import gzz.client.gl.*;
  
  public class GLVobCoorder extends AffineVobCoorder {
! public static final String rcsid = "$Id: GLVobCoorder.java,v 1.38 2002/10/07 
08:51:24 tjl Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
***************
*** 183,188 ****
--- 183,200 ----
  
        int was = ninds;
        ninds += 3;
+       return was;
+     }
+ 
+     public int concat(int parent, int child) {
+       int paramInd = nfloats;
+       inds[ninds+0] = 8;
+       inds[ninds+1] = parent;
+       inds[ninds+2] = child;
+       inds[ninds+3] = paramInd;
+ 
+       int was = ninds;
+       ninds += 4; 
        return was;
      }
  
Index: gzz/test/gzz/gfx/gl/glvobcoorder.test
diff -c gzz/test/gzz/gfx/gl/glvobcoorder.test:1.7 
gzz/test/gzz/gfx/gl/glvobcoorder.test:1.8
*** gzz/test/gzz/gfx/gl/glvobcoorder.test:1.7   Tue Oct  1 06:58:17 2002
--- gzz/test/gzz/gfx/gl/glvobcoorder.test       Mon Oct  7 04:51:24 2002
***************
*** 16,30 ****
  def testTransform():
      c = GLVobCoorder()
  
!     cs = c.coordsys(0, 5, 10, 15, 0, 0)
!     checkTrans(c, cs, [0, 0, 0, 1, 1, 1], [10, 15, 5, 10, 15, 6])
  
!     cs = c.scaleXYZ(0, 2, 3, 4)
!     checkTrans(c, cs, [0, 0, 0, 1, 1, 1], [0, 0, 0, 2, 3, 4])
!     
  
!     cs = c.distort(0, 0, 0, 0.1, 0.1, 20, 5)
!     checkTrans(c, cs, [0, 0, 0, 0.001, 0.001, 1], [0, 0, 0, 0.02, 0.02, 1], 
delta=0.00001)
  
  def checkInverse(c, cs):
      # unit cube
--- 16,32 ----
  def testTransform():
      c = GLVobCoorder()
  
!     cs1 = c.coordsys(0, 5, 10, 15, 0.5, 1)
!     checkTrans(c, cs1, [0, 0, 0, 1, 1, 1], [10, 15, 5, 10.5, 16, 6])
  
!     cs2 = c.scaleXYZ(0, 2, 3, 4)
!     checkTrans(c, cs2, [0, 0, 0, 1, 1, 1], [0, 0, 0, 2, 3, 4])
  
!     cs3 = c.distort(0, 0, 0, 0.1, 0.1, 20, 5)
!     checkTrans(c, cs3, [0, 0, 0, 0.001, 0.001, 1], [0, 0, 0, 0.02, 0.02, 1], 
delta=0.00001)
! 
!     cs = c.concat(cs1, cs2)
!     checkTrans(c, cs, [0, 0, 0, 1, 1, 1, 2, 2, 2], [10, 15, 5, 11, 18, 9, 12, 
21, 13])
  
  def checkInverse(c, cs):
      # unit cube




reply via email to

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