gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob ./TODO include/vob/trans/DisablablePrimi...


From: Asko Soukka
Subject: [Gzz-commits] libvob ./TODO include/vob/trans/DisablablePrimi...
Date: Mon, 19 May 2003 05:13:00 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Asko Soukka <address@hidden>    03/05/19 05:13:00

Modified files:
        .              : TODO 
        include/vob/trans: DisablablePrimitives.hxx 
        src/jni        : Makefile Makefile-Gen 
        src/util       : Makefile 
Added files:
        include/vob    : intersect.hxx 
        src/util       : intersect.cxx 

Log message:
        split Culling

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/TODO.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/intersect.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/trans/DisablablePrimitives.hxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Makefile.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Makefile-Gen.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/util/intersect.cxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/util/Makefile.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: libvob/TODO
diff -u libvob/TODO:1.24 libvob/TODO:1.25
--- libvob/TODO:1.24    Fri May 16 11:15:29 2003
+++ libvob/TODO Mon May 19 05:12:59 2003
@@ -51,9 +51,6 @@
          was compiled into the list when an error occurs.
        - fix the generator to pass on the parameter names
          defined in the "vob_defined" call somehow!
-   humppake:
-        - fix Culling: too much too long code inline right now.
-         separate box intersection into Util/.
 
 Unscheduled, pending fixes
     tjl:
Index: libvob/include/vob/trans/DisablablePrimitives.hxx
diff -u libvob/include/vob/trans/DisablablePrimitives.hxx:1.3 
libvob/include/vob/trans/DisablablePrimitives.hxx:1.4
--- libvob/include/vob/trans/DisablablePrimitives.hxx:1.3       Tue Apr  8 
16:25:02 2003
+++ libvob/include/vob/trans/DisablablePrimitives.hxx   Mon May 19 05:13:00 2003
@@ -39,8 +39,13 @@
 #define F <vob/trans/LinearPrimitives.hxx> 
 #include <vob/trans/leaf.hxx>
 
+#include <vob/intersect.hxx>
 #include <vob/Debug.hxx>
 
+using Util::findBoundingBox;
+using Util::findDistortedBoundingBox;
+using Util::parallelRectIntersect;
+
 namespace Vob {
 namespace Primitives {
        
@@ -116,137 +121,6 @@
        else findBoundingBox(clip, p3, p4);
        
        return (parallelRectIntersect(p1, p2, p3, p4));
-      }
-
-    protected:
-      /** Checks if two parallel rectangle intersects.
-       * "Two rectangles, represented by lower left and upper right points 
(p1, p2)
-       *  and (p3, p4), intersects if and only if the conjunction
-       *  (x2 >= x3) && (x4 >= x1) && (y2 >= y3) && (y4 >= y1)
-       *  is true. (The rectangles must intersect in both dimensions.)"
-       * @param p1 first rectangle, "lower left corner"
-       * @param p2 first rectangle, "upper right corner"
-       * @param p3 second rectangle, "lower left corner"
-       * @param p4 second rectangle, "upper right corner"
-       * @return true if the given rectangles intersect
-       */
-      static 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);
-      }
-
-      /** Checks if two parallel rectangle are within each other.
-       * @param p1 first rectangle, "lower left corner"
-       * @param p2 first rectangle, "upper right corner"
-       * @param p3 second rectangle, "lower left corner"
-       * @param p4 second rectangle, "upper right corner"
-       * @return true if the given rectangles are within each other.
-       */
-      static bool parallelRectWithin(ZPt &p1, ZPt &p2,
-                             ZPt &p3, ZPt &p4) {
-       return (p1.x <= p3.x) && (p1.y <= p3.y) && (p4.x <= p2.x) && (p4.y <= 
p2.y);
-      }
-
-      /** Finds the bounding box of coordsys' box after
-       * transformation. Assumes linear transform and transforms only
-       * corner's of the box.
-       * @param t the coordinate system, whose box to use
-       * @param p1 "lower left corner"
-       * @param p2 "upper right corner"
-       */
-      static void findBoundingBox(const Transform *t, ZPt &p1, ZPt &p2) {
-       float i, j;
-       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) {
-           if (i==0 && j==0) {
-             /** Initializing. */
-             ZPt tmpPt = t->transform(ZPt(i, j, 0));
-             x1 = tmpPt.x; y1 = tmpPt.y;
-             x2 = tmpPt.x; y2 = tmpPt.y;
-           } else {
-             /** Comparing. */
-             ZPt tmpPt = t->transform(ZPt(i, j, 0));
-             if (tmpPt.x < x1) x1 = tmpPt.x;
-             else if (tmpPt.x > x2) x2 = tmpPt.x;
-             if (tmpPt.y < y1) y1 = tmpPt.y;
-             else if (tmpPt.y > y2) y2 = tmpPt.y;
-           }
-         }
-       }
-       p1 = ZPt(x1, y1, 0);
-       p2 = ZPt(x2, y2, 0);
-      }
-
-      /** Finds the bounding box of coordsys' box after
-       * transformation. Because the transform may be distorted,
-       * searches bounding box's coners also along vertices.
-       * @param t the coordinate system, whose box to use
-       * @param p1 "lower left corner"
-       * @param p2 "upper right corner"
-       */
-      static 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;
-       
-       /** Initializing. */
-       check_dist = 100; // XXX Adjusts the scanning frequency.
-       
-       ZPt o = t->transform(ZPt(0, 0, 0));
-       ZPt u = t->transform(ZPt(box.x, box.y, 0));
-       
-       if (fabs(o.x - u.x) / check_dist > box.x)
-         step_x = box.x/(fabs(o.x - u.x) / check_dist);
-       else step_x = box.x;
-       if (fabs(o.y - u.y) / check_dist > box.y)
-         step_y = box.y/(fabs(o.y - u.y) / check_dist);
-       else step_y = box.y;
-       
-       x1 = u.x; y1 = u.y;
-       x2 = u.x; y2 = u.y;
-       
-       /** Sweeps the box's vertices. */
-       /** Vertice (0,0) -> (w,0). */
-       for (i=0; i < box.x; i+=step_x) {
-         ZPt tmpPt = t->transform(ZPt(i, 0, 0));
-         if (tmpPt.x < x1) x1 = tmpPt.x;
-         else if (tmpPt.x > x2) x2 = tmpPt.x;
-         if (tmpPt.y < y1) y1 = tmpPt.y;
-         else if (tmpPt.y > y2) y2 = tmpPt.y;
-       }
-       
-       /** Vertice (0,0) -> (0,h). */
-       for (i=step_y; i < box.y; i+=step_y) {
-         ZPt tmpPt = t->transform(ZPt(0, i, 0));
-         if (tmpPt.x < x1) x1 = tmpPt.x;
-         else if (tmpPt.x > x2) x2 = tmpPt.x;
-         if (tmpPt.y < y1) y1 = tmpPt.y;
-         else if (tmpPt.y > y2) y2 = tmpPt.y;
-       }
-       
-       /** Vertice (0,h) -> (w,h) */
-       for (i=0; i < box.x; i+=step_x) {
-         ZPt tmpPt = t->transform(ZPt(i, box.y, 0));
-         if (tmpPt.x < x1) x1 = tmpPt.x;
-         else if (tmpPt.x > x2) x2 = tmpPt.x;
-         if (tmpPt.y < y1) y1 = tmpPt.y;
-         else if (tmpPt.y > y2) y2 = tmpPt.y;
-       }
-       
-       /** Vertice (w,0) -> (w,h) */
-       for (i=0; i < box.y; i+=step_y) {
-         ZPt tmpPt = t->transform(ZPt(box.x, i, 0));
-         if (tmpPt.x < x1) x1 = tmpPt.x;
-         else if (tmpPt.x > x2) x2 = tmpPt.x;
-         if (tmpPt.y < y1) y1 = tmpPt.y;
-         else if (tmpPt.y > y2) y2 = tmpPt.y;
-       }
-       
-       p1 = ZPt(x1, y1, 0);
-       p2 = ZPt(x2, y2, 0);
       }
     };
     VOB_PRIMITIVETRANS_DEFINED(Cull, "cull");
Index: libvob/src/jni/Makefile
diff -u libvob/src/jni/Makefile:1.28 libvob/src/jni/Makefile:1.29
--- libvob/src/jni/Makefile:1.28        Fri May 16 09:53:37 2003
+++ libvob/src/jni/Makefile     Mon May 19 05:13:00 2003
@@ -18,7 +18,7 @@
 PAPEROBJS=../paper/Paper.o 
 OSOBJS=../os/Os-GLX.o 
 TEXTUREOBJS=../texture/Texture.o ../texture/Texture_pipetexture.o 
-UTILOBJS=../util/Perlin.o ../util/buildmipmaps.o ../util/Debug.o 
../util/ImageLoader.o
+UTILOBJS=../util/Perlin.o ../util/buildmipmaps.o ../util/Debug.o 
../util/ImageLoader.o ../util/intersect.o
 
 TRANSOBJS=../trans/Transform.o ../trans/Coorder.o
 
Index: libvob/src/jni/Makefile-Gen
diff -u libvob/src/jni/Makefile-Gen:1.6 libvob/src/jni/Makefile-Gen:1.7
--- libvob/src/jni/Makefile-Gen:1.6     Fri May 16 09:53:37 2003
+++ libvob/src/jni/Makefile-Gen Mon May 19 05:13:00 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 $(LIBS)
+       $(CXX) -o Generator $(CXXFLAGS) $(EXTRAINCLUDE) GeneratorMain.cxx 
$(VOB_OBJS) $(TRANS_OBJS) ../util/Debug.o ../util/intersect.o $(LIBS)
 
 .PHONY: javahs
 
Index: libvob/src/util/Makefile
diff -u libvob/src/util/Makefile:1.3 libvob/src/util/Makefile:1.4
--- libvob/src/util/Makefile:1.3        Mon Mar 24 14:03:31 2003
+++ libvob/src/util/Makefile    Mon May 19 05:13:00 2003
@@ -1,6 +1,6 @@
 include ../../rules.mk
 
-sources = Perlin.cxx buildmipmaps.cxx Debug.cxx ImageLoader.cxx
+sources = Perlin.cxx buildmipmaps.cxx intersect.cxx Debug.cxx ImageLoader.cxx
 
 all: $(sources:.cxx=.o) 
 




reply via email to

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