gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob include/vob/trans/LinearPrimitives.hxx o...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob include/vob/trans/LinearPrimitives.hxx o...
Date: Sat, 09 Aug 2003 09:28:36 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Tuomas J. Lukka <address@hidden>        03/08/09 09:28:36

Modified files:
        include/vob/trans: LinearPrimitives.hxx 
        org/nongnu/libvob: VobCoorder.java 
        org/nongnu/libvob/buoy: BuoyGeometer.java 
        org/nongnu/libvob/buoy/impl: BuoyOnCircleGeometer.java 
                                     RatioBuoyOnCircleGeometer.java 
        src/jni        : Makefile-Gen 
        src/main       : Renderer.cxx 
        vob/buoy       : buoymanager.py 
        vob/putil      : dbg.py 

Log message:
        More progress: use buoy geometer

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/trans/LinearPrimitives.hxx.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/VobCoorder.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/buoy/BuoyGeometer.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/buoy/impl/BuoyOnCircleGeometer.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/buoy/impl/RatioBuoyOnCircleGeometer.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Makefile-Gen.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/main/Renderer.cxx.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/buoy/buoymanager.py.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/putil/dbg.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: libvob/include/vob/trans/LinearPrimitives.hxx
diff -u libvob/include/vob/trans/LinearPrimitives.hxx:1.7 
libvob/include/vob/trans/LinearPrimitives.hxx:1.8
--- libvob/include/vob/trans/LinearPrimitives.hxx:1.7   Wed Jul  9 10:05:25 2003
+++ libvob/include/vob/trans/LinearPrimitives.hxx       Sat Aug  9 09:28:35 2003
@@ -36,9 +36,12 @@
 #include <vob/trans/Primitives.hxx>
 #include <vob/geom/Quadrics.hxx>
 
+
 namespace Vob {
 namespace Primitives {
 
+PREDBGVAR(dbg_buoyoncircle);
+
 
     /** A simple translation in 3 dimensions.
      * Can't be used in HierarchicalTransform directly
@@ -623,11 +626,16 @@
            Pt anchor = Pt(depends[0]->getInverse().transform(
                            depends[1]->transform(
                                .5 * depends[1]->getSqSize())));
+           DBG(dbg_buoyoncircle) <<
+                   "anchor: "<<anchor<<"\n";
            // And transform it to the square coordsys
            Pt sq = depends[0]->getSqSize();
            anchor.x /= sq.x;
            anchor.y /= sq.y;
 
+           DBG(dbg_buoyoncircle) <<
+                   "anchor sqd: "<<anchor<<"\n";
+
            float shift = shiftamount / sq.x;
 
            // Here, the circle center is always .5, .5
@@ -657,6 +665,10 @@
            this->z = -scale;
            this->sx = scale;
            this->sy = scale;
+
+           DBG(dbg_buoyoncircle) <<
+                   "finished : "<<this->x<<" "<<this->y<<" "<<this->z<<" "
+                           <<this->sx<<" "<<this->sy<<"\n";
        }
     };
 
Index: libvob/org/nongnu/libvob/VobCoorder.java
diff -u libvob/org/nongnu/libvob/VobCoorder.java:1.5 
libvob/org/nongnu/libvob/VobCoorder.java:1.6
--- libvob/org/nongnu/libvob/VobCoorder.java:1.5        Thu Apr 24 14:46:39 2003
+++ libvob/org/nongnu/libvob/VobCoorder.java    Sat Aug  9 09:28:35 2003
@@ -177,6 +177,7 @@
     abstract public int getCSAt(int parent, float x, float y, float[] 
targetcoords);
 
     /** Transform a point to screen coordinates from the given cs.
+     * It is explicitly allowed for pt and into to be the same array.
      */
     public float[] transformPoints3(int withCS, float[] pt, float[]into) {
        throw new UnsupportedOperationException("transform not supported yet");
Index: libvob/org/nongnu/libvob/buoy/BuoyGeometer.java
diff -u libvob/org/nongnu/libvob/buoy/BuoyGeometer.java:1.2 
libvob/org/nongnu/libvob/buoy/BuoyGeometer.java:1.3
--- libvob/org/nongnu/libvob/buoy/BuoyGeometer.java:1.2 Sat Aug  9 07:15:50 2003
+++ libvob/org/nongnu/libvob/buoy/BuoyGeometer.java     Sat Aug  9 09:28:35 2003
@@ -43,7 +43,7 @@
      * @param scale The scale that should be applied to the w, h at
      * focus
      */
-    int buoyCS(VobScene vs, int into, int anchor, 
+    int buoyCS(VobScene vs, int anchor, 
                int direction,
                Object key, 
                int index, int total,
Index: libvob/org/nongnu/libvob/buoy/impl/BuoyOnCircleGeometer.java
diff -u libvob/org/nongnu/libvob/buoy/impl/BuoyOnCircleGeometer.java:1.1 
libvob/org/nongnu/libvob/buoy/impl/BuoyOnCircleGeometer.java:1.2
--- libvob/org/nongnu/libvob/buoy/impl/BuoyOnCircleGeometer.java:1.1    Sat Aug 
 9 07:15:50 2003
+++ libvob/org/nongnu/libvob/buoy/impl/BuoyOnCircleGeometer.java        Sat Aug 
 9 09:28:35 2003
@@ -16,15 +16,17 @@
      * This coordinate system defines the ellipse used by
      * the buoy geometry algorithm, and should be set by
      * the derived class.
+     * <p>
+     * PUBLIC ONLY FOR DEBUGGING! DO NOT TOUCH OR USE
      */
-    protected int buoyinto;
+    public int buoyinto;
 
     /** The factor by which to shift the anchor when 
      * multiple buoys float from the same anchor.
      */
     public float shiftFactor = 18;
 
-    public int buoyCS(VobScene vs, int into, int anchor, int direction,
+    public int buoyCS(VobScene vs, int anchor, int direction,
                Object key, 
                int index, int total,
                float w, float h, float scale) {
Index: libvob/org/nongnu/libvob/buoy/impl/RatioBuoyOnCircleGeometer.java
diff -u libvob/org/nongnu/libvob/buoy/impl/RatioBuoyOnCircleGeometer.java:1.1 
libvob/org/nongnu/libvob/buoy/impl/RatioBuoyOnCircleGeometer.java:1.2
--- libvob/org/nongnu/libvob/buoy/impl/RatioBuoyOnCircleGeometer.java:1.1       
Sat Aug  9 07:15:50 2003
+++ libvob/org/nongnu/libvob/buoy/impl/RatioBuoyOnCircleGeometer.java   Sat Aug 
 9 09:28:35 2003
@@ -24,13 +24,13 @@
 
     public void prepare(VobScene vs, int into, Object key, boolean create) {
        if(create) {
-           this.buoyinto = vs.orthoCS(into, key, 1, 1, 1,  1, 1);
+           this.buoyinto = vs.orthoBoxCS(into, key, 1, 1, 1,  1, 1, 1, 1);
        } else {
            this.buoyinto = vs.matcher.getCS(into, key);
        }
        vs.coords.getSqSize(into, tmp);
 
-       vs.coords.setOrthoParams(this.buoyinto,
-                   0, x * tmp[0], y * tmp[1], w * tmp[0], h * tmp[1]);
+       vs.coords.setOrthoBoxParams(this.buoyinto,
+                   0, x * tmp[0], y * tmp[1], 1, 1, w * tmp[0], h * tmp[1]);
     }
 }
Index: libvob/src/jni/Makefile-Gen
diff -u libvob/src/jni/Makefile-Gen:1.9 libvob/src/jni/Makefile-Gen:1.10
--- libvob/src/jni/Makefile-Gen:1.9     Tue Aug  5 06:08:09 2003
+++ libvob/src/jni/Makefile-Gen Sat Aug  9 09:28:35 2003
@@ -41,7 +41,7 @@
 
 
 Generator: GeneratorMain.o $(VOB_OBJS) $(TRANS_OBJS)
-       $(CXX) -o Generator $(CXXFLAGS) $(EXTRAINCLUDE) GeneratorMain.cxx 
$(VOB_OBJS) $(TRANS_OBJS) ../util/Debug.o ../util/intersect.o 
../trans/Transform.o $(LIBS)
+       $(CXX) -o Generator $(CXXFLAGS) $(EXTRAINCLUDE) GeneratorMain.cxx 
$(VOB_OBJS) $(TRANS_OBJS) ../util/Debug.o ../util/intersect.o 
../trans/Transform.o ../main/Renderer.o $(LIBS)
 
 .PHONY: javahs
 
Index: libvob/src/main/Renderer.cxx
diff -u libvob/src/main/Renderer.cxx:1.10 libvob/src/main/Renderer.cxx:1.11
--- libvob/src/main/Renderer.cxx:1.10   Tue Jul 22 08:01:50 2003
+++ libvob/src/main/Renderer.cxx        Sat Aug  9 09:28:35 2003
@@ -63,6 +63,10 @@
        DBGVAR(dbg_fillets, "Fillets");
     }
 
+    namespace Primitives {
+       DBGVAR(dbg_buoyoncircle, "BuoyOnCircle");
+    }
+
 namespace CurrentFPS {
     // bool showFPS;
     double current_fps;
Index: libvob/vob/buoy/buoymanager.py
diff -u libvob/vob/buoy/buoymanager.py:1.41 libvob/vob/buoy/buoymanager.py:1.42
--- libvob/vob/buoy/buoymanager.py:1.41 Sat Aug  9 08:26:09 2003
+++ libvob/vob/buoy/buoymanager.py      Sat Aug  9 09:28:35 2003
@@ -74,7 +74,7 @@
        self.buoyMainViewGeometer = vob.buoy.impl.RatioMainGeometer(
                                        .2, .25, .6, .5)
        self.buoyGeometer = vob.buoy.impl.RatioBuoyOnCircleGeometer(
-                                   -.1, -.1, 1.2, 1.2)
+                                   .1, .1, .8, .8)
 
     def getMainNode(self):
         return self.mainNode
@@ -90,6 +90,8 @@
 
        into = self.buoyMainViewGeometer.mainCS(vs, mainboxinto, "K", 1)
 
+       self.buoyGeometer.prepare(vs, mainboxinto, "J", 1)
+
        self.vs.activate(into)
 
        self.mainNode.renderMain(vs, into)
@@ -116,21 +118,6 @@
        """
         if dbg: pa('link really')
 
-        ### Shift the anchorCS for some degrees
-        if shift > 0:
-            # evens 2,4,6 ->  1,2,3,4,..
-            # odds 1,3,5,7 -> -1,-2,-3,-4 
-            if shift%2 == 1:
-                shift += 1
-                shift *= -1
-        shift *= 0.5
-        shiftedAnchorCS = self.vs.translateCS(anchorCS, 'Shift',0, shift*18)
-
-       ### Buoy coordinate system
-       buoy = self.vs.coords.buoyOnCircle2(self.buoyinto, shiftedAnchorCS,
-                               direction, 10)
-       self.vs.matcher.add(self.buoyinto, buoy, (linkId, direction))
-
        #### Buoy size
        obj = otherNode.getSize(linkId, otherAnchor, size)
        w = size[0]
@@ -147,10 +134,11 @@
        sca = 1.5
         if dbg: pa("BuoyScaling: ",w, h, sca)
 
-       ### Create the buoy coordinate system
-       into = self.vs.orthoBoxCS(buoy, "V"+str(linkId), -100, -w*sca/2.0, 
-h*sca/2.0, 
-                                                   1, 1, w*sca, h*sca)
-        
+       into = self.buoyGeometer.buoyCS(self.vs, anchorCS, direction,
+               (linkId, direction),
+               shift, 1,
+               w, h, sca)
+       
        if dbg:
            dbg1 = self.vs.unitSqCS(into, "U")
            self.vs.put(coloredQuad((0,1,0)), dbg1)
Index: libvob/vob/putil/dbg.py
diff -u libvob/vob/putil/dbg.py:1.1 libvob/vob/putil/dbg.py:1.2
--- libvob/vob/putil/dbg.py:1.1 Thu Apr 10 10:00:19 2003
+++ libvob/vob/putil/dbg.py     Sat Aug  9 09:28:36 2003
@@ -20,7 +20,7 @@
 # 
 # 
 
-"""Read standard libvob debugging commandline options.
+"""Read standard libvob debugging commandline options + debug utils.
 
 The standard debug options are:
 
@@ -81,4 +81,24 @@
        prop = System.getProperties()
         prop.setProperty(m.group(1), m.group(2))
        System.setProperties(prop)
+
+import jarray
+
+
+
+def showCS(vs, cs):
+    """Print data about the given coordinate system.
+    """
+    arr = jarray.array([0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0], 'f')
+    vs.coords.transformPoints3(cs, arr, arr)
+
+    print "(0,0,0) -> (%f,%f,%f)" % (arr[0], arr[1], arr[2])
+    print "(1,0,0) -> (%f,%f,%f)" % (arr[3], arr[4], arr[5])
+    print "(0,1,0) -> (%f,%f,%f)" % (arr[6], arr[7], arr[8])
+    print "(1,1,0) -> (%f,%f,%f)" % (arr[9], arr[10], arr[11])
+
+    vs.coords.getSqSize(cs, arr)
+
+    print "Unit box: (%s, %s)" % (arr[0], arr[1])
+
 




reply via email to

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