/[libvob]/libvob/src/util/intersect.cxx
ViewVC logotype

Diff of /libvob/src/util/intersect.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by humppake, Mon May 19 09:13:00 2003 UTC revision 1.2 by tjl, Wed Aug 13 06:42:01 2003 UTC
# Line 30  intersect.cxx Line 30  intersect.cxx
30    
31  #include <vob/Transform.hxx>  #include <vob/Transform.hxx>
32  #include <vob/Vec23.hxx>  #include <vob/Vec23.hxx>
33    #include <vob/Debug.hxx>
34  #include "vob/intersect.hxx"  #include "vob/intersect.hxx"
35    
36  using Vob::Transform;  using Vob::Transform;
37  using Vob::Vec23::ZPt;  using Vob::Vec23::ZPt;
38  using Vob::Vec23::Pt;  using Vob::Vec23::Pt;
39    
40    namespace Vob {
41  namespace Util {  namespace Util {
42    DBGVAR(dbg_intersect, "Intersect");
43    bool parallelRectIntersect(ZPt &p1, ZPt &p2, ZPt &p3, ZPt &p4) {    bool parallelRectIntersect(ZPt &p1, ZPt &p2, ZPt &p3, ZPt &p4) {
44      return (p2.x > p3.x) && (p4.x > p1.x) && (p2.y > p3.y) && (p4.y > p1.y);      return (p2.x > p3.x) && (p4.x > p1.x) && (p2.y > p3.y) && (p4.y > p1.y);
45    }    }
# Line 44  namespace Util { Line 47  namespace Util {
47      return (p1.x <= p3.x) && (p1.y <= p3.y) && (p4.x <= p2.x) && (p4.y <= p2.y);      return (p1.x <= p3.x) && (p1.y <= p3.y) && (p4.x <= p2.x) && (p4.y <= p2.y);
48    }    }
49    void findBoundingBox(const Transform *t, ZPt &p1, ZPt &p2) {    void findBoundingBox(const Transform *t, ZPt &p1, ZPt &p2) {
50      float i, j;      int i0, j0;
51      Pt box = t->getSqSize();      Pt box = t->getSqSize();
52      float x1=0, y1=0, x2=0, y2=0;      float x1=0, y1=0, x2=0, y2=0;
53      for (i=0; i<=box.x; i+=box.x) {      DBG(dbg_intersect) << "Find bb "<<t<<" "<<box<<"\n";
54        for (j=0; j<=box.y; j+=box.y) {      for (i0=0; i0<=1; i0+=1) {
55          for (j0=0; j0<=1; j0+=1) {
56            float i = i0 * box.x;
57            float j = j0 * box.x;
58          if (i==0 && j==0) {          if (i==0 && j==0) {
59            /** Initializing. */            /** Initializing. */
60            ZPt tmpPt = t->transform(ZPt(i, j, 0));            ZPt tmpPt = t->transform(ZPt(i, j, 0));
# Line 66  namespace Util { Line 72  namespace Util {
72      }      }
73      p1 = ZPt(x1, y1, 0);      p1 = ZPt(x1, y1, 0);
74      p2 = ZPt(x2, y2, 0);      p2 = ZPt(x2, y2, 0);
75        DBG(dbg_intersect) << "Return "<<p1<<" "<<p2<<"\n";
76    }    }
77    void findDistortedBoundingBox(const Transform *t, ZPt &p1, ZPt &p2) {    void findDistortedBoundingBox(const Transform *t, ZPt &p1, ZPt &p2) {
78      double i, step_x, step_y;      double i, step_x, step_y;
79      Pt box = t->getSqSize();      Pt box = t->getSqSize();
80      float x1, y1, x2, y2;      float x1, y1, x2, y2;
81      int check_dist;      int check_dist;
82        DBG(dbg_intersect) << "Find distortedbb "<<t<<" "<<box<<"\n";
83            
84      /** Initializing. */      /** Initializing. */
85      check_dist = 100; // XXX Adjusts the scanning frequency.      check_dist = 100; // XXX Adjusts the scanning frequency.
# Line 128  namespace Util { Line 136  namespace Util {
136                    
137      p1 = ZPt(x1, y1, 0);      p1 = ZPt(x1, y1, 0);
138      p2 = ZPt(x2, y2, 0);      p2 = ZPt(x2, y2, 0);
139        DBG(dbg_intersect) << "Return "<<p1<<" "<<p2<<"\n";
140    }    }
141  }  }
142    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26