gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob include/vob/intersect.hxx include/vob/tr...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob include/vob/intersect.hxx include/vob/tr...
Date: Wed, 13 Aug 2003 02:42:02 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Tuomas J. Lukka <address@hidden>        03/08/13 02:42:02

Modified files:
        include/vob    : intersect.hxx 
        include/vob/trans: DisablablePrimitives.hxx 
        org/nongnu/libvob/impl: DefaultVobMatcher.java 
        src/trans      : Coorder.cxx 
        src/util       : intersect.cxx 
        vob/buoy       : buoymanager.py 

Log message:
        Various little fixes for tt connector, among others boundingbox should 
not freeze if box size == 0

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/intersect.hxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/trans/DisablablePrimitives.hxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/impl/DefaultVobMatcher.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/trans/Coorder.cxx.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/util/intersect.cxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/buoy/buoymanager.py.diff?tr1=1.52&tr2=1.53&r1=text&r2=text

Patches:
Index: libvob/include/vob/intersect.hxx
diff -u libvob/include/vob/intersect.hxx:1.1 
libvob/include/vob/intersect.hxx:1.2
--- libvob/include/vob/intersect.hxx:1.1        Mon May 19 05:13:00 2003
+++ libvob/include/vob/intersect.hxx    Wed Aug 13 02:42:01 2003
@@ -37,6 +37,7 @@
 using Vob::Vec23::ZPt;
 using Vob::Transform;
 
+namespace Vob {
 namespace Util {
   /** Checks if two parallel rectangle intersects.
    * "Two rectangles, represented by lower left and upper right points (p1, p2)
@@ -77,6 +78,7 @@
    * @param p2 "upper right corner"
    */
   void findDistortedBoundingBox(const Transform *t, ZPt &p1, ZPt &p2);
+}
 }
 
 #endif
Index: libvob/include/vob/trans/DisablablePrimitives.hxx
diff -u libvob/include/vob/trans/DisablablePrimitives.hxx:1.4 
libvob/include/vob/trans/DisablablePrimitives.hxx:1.5
--- libvob/include/vob/trans/DisablablePrimitives.hxx:1.4       Mon May 19 
05:13:00 2003
+++ libvob/include/vob/trans/DisablablePrimitives.hxx   Wed Aug 13 02:42:01 2003
@@ -42,12 +42,12 @@
 #include <vob/intersect.hxx>
 #include <vob/Debug.hxx>
 
-using Util::findBoundingBox;
-using Util::findDistortedBoundingBox;
-using Util::parallelRectIntersect;
-
 namespace Vob {
 namespace Primitives {
+
+    using ::Vob::Util::findBoundingBox;
+    using ::Vob::Util::findDistortedBoundingBox;
+    using ::Vob::Util::parallelRectIntersect;
        
 DBGVAR(dbg_cull, "Vob.Primitives.Cull");
 
Index: libvob/org/nongnu/libvob/impl/DefaultVobMatcher.java
diff -u libvob/org/nongnu/libvob/impl/DefaultVobMatcher.java:1.4 
libvob/org/nongnu/libvob/impl/DefaultVobMatcher.java:1.5
--- libvob/org/nongnu/libvob/impl/DefaultVobMatcher.java:1.4    Fri Apr 25 
09:41:58 2003
+++ libvob/org/nongnu/libvob/impl/DefaultVobMatcher.java        Wed Aug 13 
02:42:01 2003
@@ -33,7 +33,7 @@
 /** A simple hierarchical implementation of VobMatcher.
  */
 public class DefaultVobMatcher implements VobMatcher {
-private static final String rcsid = "$Id: DefaultVobMatcher.java,v 1.4 
2003/04/25 13:41:58 benja Exp $";  
+private static final String rcsid = "$Id: DefaultVobMatcher.java,v 1.5 
2003/08/13 06:42:01 tjl Exp $";  
     public static boolean dbg = false;
     private static void pa(String s) { System.out.println(s); }
 
@@ -56,7 +56,7 @@
            return parent == k.parent && key.equals(k.key);
        }
        public String toString() {
-           return "DefaultVobMatcher key: "+key+" parent: "+parent;
+           return "[DefaultVobMatcher key: "+key+" parent: "+parent+"]";
        }
     }
     void ensure(int n) {
@@ -90,6 +90,8 @@
     }
     public int add(int into, int cs, Object key) {
         ensure(cs);
+       if(cs < 0)
+           throw new Error("Trying to add negative parent!");
         if(key == null) key = NULL;
 
        if (dbg) checkIfKeyAlreadyExist(new Key(key, into));
@@ -190,8 +192,10 @@
                    }
                }
 
-               if(k.parent < 0 || k.parent >= i)
-                   throw new Error("argh "+k.parent);
+               if(k.parent < 0 || k.parent >= i) {
+                   dumpSimply();
+                   throw new Error("Got an invalid parent for "+i+" 
"+k.parent);
+               }
 
                // XXX assumes that parent is set already
                int other_parent = interpList[k.parent];
@@ -312,6 +316,13 @@
        for (int i=0; i<keyByCs.length; i++) {
            if (keyByCs[i] == NULL)
                pa(i + " : Real NULL");     
+       }
+    }
+
+    public void dumpSimply() {
+       for(int i=1; i<maxcs+1; i++) {
+           if(keyByCs[i] != null)
+               pa(i+" "+keyByCs[i]);
        }
     }
 }
Index: libvob/src/trans/Coorder.cxx
diff -u libvob/src/trans/Coorder.cxx:1.7 libvob/src/trans/Coorder.cxx:1.8
--- libvob/src/trans/Coorder.cxx:1.7    Mon Aug 11 07:56:11 2003
+++ libvob/src/trans/Coorder.cxx        Wed Aug 13 02:42:01 2003
@@ -245,13 +245,16 @@
            if(csind2 <= 0) {
 
                if(show1) {
+                   DBG(dbg_coorder) << "Interpolate but no to, show1\n";
                    for(int j = 0; j<npars; j++) {
                        params.push_back(points1[ind1 + j]);
                    }
                } else {
+                   DBG(dbg_coorder) << "Interpolate but no to, not showing, 
continuing\n";
                    continue;
                }
            } else {
+               DBG(dbg_coorder) << "Interpolate \n";
                for(int j = 0; j<npars; j++) {
                    DBG(dbg_coorder) << "Interpolating "
                        <<(ind1+j)<<" " <<(ind2+j)<<"  = "
@@ -263,9 +266,11 @@
            }
            const Transform *prev[nprev];
            
+           DBG(dbg_coorder) << "Parents \n";
            for(int j=0; j<nprev; j++) {
                int parent = inds1[i+1+j];
                Transform *parentcs = get(parent); // cs[parent]; -- check 
bounds using geT()
+               DBG(dbg_coorder) << "Parent "<<j<<" "<<parent<<" "<<parentcs<<" 
\n";
                if(parentcs == 0) {
                    DBG(dbg_coorder) << "Parent "<<j<<" not interp\n";
                    goto nextInd; // If parent's not interpolating, neither are 
we.
Index: libvob/src/util/intersect.cxx
diff -u libvob/src/util/intersect.cxx:1.1 libvob/src/util/intersect.cxx:1.2
--- libvob/src/util/intersect.cxx:1.1   Mon May 19 05:13:00 2003
+++ libvob/src/util/intersect.cxx       Wed Aug 13 02:42:01 2003
@@ -30,13 +30,16 @@
 
 #include <vob/Transform.hxx>
 #include <vob/Vec23.hxx>
+#include <vob/Debug.hxx>
 #include "vob/intersect.hxx"
 
 using Vob::Transform;
 using Vob::Vec23::ZPt;
 using Vob::Vec23::Pt;
 
+namespace Vob {
 namespace Util {
+DBGVAR(dbg_intersect, "Intersect");
   bool parallelRectIntersect(ZPt &p1, ZPt &p2, ZPt &p3, ZPt &p4) {
     return (p2.x > p3.x) && (p4.x > p1.x) && (p2.y > p3.y) && (p4.y > p1.y);
   }
@@ -44,11 +47,14 @@
     return (p1.x <= p3.x) && (p1.y <= p3.y) && (p4.x <= p2.x) && (p4.y <= 
p2.y);
   }
   void findBoundingBox(const Transform *t, ZPt &p1, ZPt &p2) {
-    float i, j;
+    int i0, j0;
     Pt box = t->getSqSize();
     float x1=0, y1=0, x2=0, y2=0;
-    for (i=0; i<=box.x; i+=box.x) {
-      for (j=0; j<=box.y; j+=box.y) {
+    DBG(dbg_intersect) << "Find bb "<<t<<" "<<box<<"\n";
+    for (i0=0; i0<=1; i0+=1) {
+      for (j0=0; j0<=1; j0+=1) {
+       float i = i0 * box.x;
+       float j = j0 * box.x;
        if (i==0 && j==0) {
          /** Initializing. */
          ZPt tmpPt = t->transform(ZPt(i, j, 0));
@@ -66,12 +72,14 @@
     }
     p1 = ZPt(x1, y1, 0);
     p2 = ZPt(x2, y2, 0);
+    DBG(dbg_intersect) << "Return "<<p1<<" "<<p2<<"\n";
   }
   void findDistortedBoundingBox(const Transform *t, ZPt &p1, ZPt &p2) {
     double i, step_x, step_y;
     Pt box = t->getSqSize();
     float x1, y1, x2, y2;
     int check_dist;
+    DBG(dbg_intersect) << "Find distortedbb "<<t<<" "<<box<<"\n";
     
     /** Initializing. */
     check_dist = 100; // XXX Adjusts the scanning frequency.
@@ -128,5 +136,7 @@
        
     p1 = ZPt(x1, y1, 0);
     p2 = ZPt(x2, y2, 0);
+    DBG(dbg_intersect) << "Return "<<p1<<" "<<p2<<"\n";
   }
+}
 }
Index: libvob/vob/buoy/buoymanager.py
diff -u libvob/vob/buoy/buoymanager.py:1.52 libvob/vob/buoy/buoymanager.py:1.53
--- libvob/vob/buoy/buoymanager.py:1.52 Tue Aug 12 05:28:21 2003
+++ libvob/vob/buoy/buoymanager.py      Wed Aug 13 02:42:01 2003
@@ -172,6 +172,7 @@
        self.vs.activate(into)
 
        ### Render the buoy, get back anchor cs
+       if dbg: pa("Render buoy ",into, linkId, otherAnchor)
        otherAnchorCS = otherNode.renderBuoy(self.vs, into, linkId, 
otherAnchor, None)
        self.cs[into] = (otherNode, linkId, otherAnchor, into)
 




reply via email to

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