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

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

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

revision 1.5 by tjl, Wed Oct 23 06:13:04 2002 UTC revision 1.6 by tjl, Fri Oct 25 02:57:17 2002 UTC
# Line 89  namespace Fillet { Line 89  namespace Fillet {
89          Vec norm;          Vec norm;
90          int flags;          int flags;
91    
92          FilletDistort(ZPt center, ZPt to, float width, int flags) :          float blendw;
93              center(center), to(to), width(width), flags(flags) {          int power;
94    
95            FilletDistort(ZPt center, ZPt to, float width, int flags,
96                    float blendw, int power) :
97                center(center), to(to), width(width), flags(flags),
98                    blendw(blendw), power(power) {
99              dir = Vec(to-center).normalize();              dir = Vec(to-center).normalize();
100              norm = dir.cw90();              norm = dir.cw90();
101              length = Vec(to-center).length();              length = Vec(to-center).length();
102          }          }
103    
104          ZPt operator() (ZPt p, bool& wasshifted) ;          ZPt operator() (ZPt p, bool& wasshifted, float fract) ;
105      };      };
106    
107        // Dicer:
108        //  in: range of A,
109        //      f: A->B,
110        //      d: B,B->bool  (acceptable difference)
111    
112      template<class In, class Out, class Shift>      template<class In, class Out, class Shift>
113          void shiftEdge(const In &b,          void shiftEdge(const In &b,
114                          const In &e,                          const In &e,
# Line 107  namespace Fillet { Line 117  namespace Fillet {
117          In cur = b;          In cur = b;
118          In prev = b;          In prev = b;
119          bool prevshifted, curshifted;;          bool prevshifted, curshifted;;
120          ZPt prevpt = d(*prev, prevshifted);          ZPt prevpt = d(*prev, prevshifted, 0);
121          *o++ = prevpt;          *o++ = prevpt;
122          if(dbg_origs) *o++ = *prev;          if(dbg_origs) *o++ = *prev;
123            int n = e-b-1;
124            int curi = 0;
125          while( (++cur) != e) {          while( (++cur) != e) {
126              ZPt curpt = d(*cur, curshifted);              float fract = (curi / (float)n);
127                ZPt curpt = d(*cur, curshifted, fract);
128              if(curshifted || prevshifted) {              if(curshifted || prevshifted) {
129                  // Dice...                  // Dice...
130                  const int n = 30;                  const int n = 30;
131                  bool fooshifted;                  bool fooshifted;
132                  for(int i=1; i<n; i++) {                  for(int i=1; i<n; i++) {
133                      ZPt p = lerp(*prev, *cur, (float)i / n);                      ZPt p = lerp(*prev, *cur, (float)i / n);
134                      *o++ = d(p, fooshifted);                      *o++ = d(p, fooshifted, fract);
135                      if(dbg_origs) *o++ = p;                      if(dbg_origs) *o++ = p;
136                  }                  }
137              }              }
# Line 127  namespace Fillet { Line 140  namespace Fillet {
140              prev = cur;              prev = cur;
141              prevpt = curpt;              prevpt = curpt;
142              prevshifted = curshifted;              prevshifted = curshifted;
143                curi ++;
144          }          }
145      }      }
146    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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