/[gzz]/gzz/gfx/libfillet/Fillet.cxx
ViewVC logotype

Diff of /gzz/gfx/libfillet/Fillet.cxx

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

revision 1.1 by tjl, Tue Oct 22 16:28:22 2002 UTC revision 1.2 by tjl, Tue Oct 22 17:03:45 2002 UTC
# Line 1  Line 1 
1  #include "Fillet.hxx"  #include "Fillet.hxx"
2  namespace Fillet {  namespace Fillet {
3      DBGVAR(dbg, "Fillet.general");      DBGVAR(dbg, "Fillet.general");
4        DBGVAR(dbg_origs, "Fillet.origs");
5    
6        inline bool between(float start, float end, float it,
7                        float fuzz = 1) {
8            return (fuzz * fabs(start-end) >= fabs(it-end)) &&
9                    (fuzz * fabs(start-end) >= fabs(it-start));
10        }
11    
12      bool _Cutter::operator()(const ZPt &a, const ZPt &b) {      bool _Cutter::operator()(const ZPt &a, const ZPt &b) {
13          DBG(dbg) << "Cut "<<a<<" "<<b<<"\n";          DBG(dbg) << "Cut "<<a<<" "<<b<<"\n";
# Line 12  namespace Fillet { Line 19  namespace Fillet {
19          Pt p = (Pt)in;          Pt p = (Pt)in;
20          DBG(dbg) << "Cutter points: "<<p<<" "<<(p-center)<<"\n";          DBG(dbg) << "Cutter points: "<<p<<" "<<(p-center)<<"\n";
21          if((p-center).dot(fromCenter) < 0) return false;          if((p-center).dot(fromCenter) < 0) return false;
22          if(!between(a.x, b.x, p.x)) return false;  
23          if(!between(a.y, b.y, p.y)) return false;          Vec b2(b-a);
24            Vec p2(p-a);
25            float d = b2.dot(p2);
26            float e = b2.dot(b2);
27            if(d < 0 || d > e) return false;
28    
29            if(!between(a.x, b.x, p.x) &
30               !between(a.y, b.y, p.y)) return false;
31          this->cut = ZPt(p.x, p.y, a.z); // XXX          this->cut = ZPt(p.x, p.y, a.z); // XXX
32          DBG(dbg) << "CUT!!! "<<cut<<"\n";          DBG(dbg) << "CUT!!! "<<cut<<"\n";
33          return true;          return true;

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