/[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.4 by tjl, Wed Oct 23 09:40:07 2002 UTC revision 1.5 by tjl, Fri Oct 25 02:57:17 2002 UTC
# Line 33  namespace Fillet { Line 33  namespace Fillet {
33          return true;          return true;
34      }      }
35    
36      ZPt FilletDistort::operator() (ZPt p, bool &wasshifted) {      ZPt FilletDistort::operator() (ZPt p, bool &wasshifted, float fract) {
37          Vec p2c(p-center);          Vec p2c(p-center);
38          float x0 = norm.dot(p2c) ;          float x0 = norm.dot(p2c) ;
39          float x = x0 / width;          float x = x0 / width;
# Line 46  namespace Fillet { Line 46  namespace Fillet {
46          }          }
47    
48          float t = fabs(x);          float t = fabs(x);
49  #define BLENDW .125          t -= blendw;
         t -= BLENDW;  
50          if (t < 0) t = 0;          if (t < 0) t = 0;
51          if (t > 1) t = 1;          if (t > 1) t = 1;
52                        
53          // Blending functions          // Blending functions
54          float b = 1 - sqrt(sqrt(1-(1-t)*(1-t)*(1-t)*(1-t))); // distance          float b = 1 - pow( 1 - pow( 1-t, power ), 1.0/power);
55            // float b = 1 - sqrt(sqrt(1-(1-t)*(1-t)*(1-t)*(1-t))); // distance
56          // float b = 1 - sqrt(1-(1-t)*(1-t)); // distance          // float b = 1 - sqrt(1-(1-t)*(1-t)); // distance
57                    
58          if(flags & 1)          if(flags & 1)
# Line 62  namespace Fillet { Line 62  namespace Fillet {
62    
63          ZPt res;          ZPt res;
64          if (t < 1E-4) {          if (t < 1E-4) {
65              int sign = (x > 0 ? 1 : -1);              int sign = (fract > 0.5 ? 1 : -1);
66              res.x = to.x + sign * BLENDW * width * norm.x;              res.x = to.x + sign * blendw * width * norm.x;
67              res.y = to.y + sign * BLENDW * width * norm.y;              res.y = to.y + sign * blendw * width * norm.y;
68              res.z = to.z;              res.z = to.z;
69              DBG(dbg) << "Result by close range " << res << " from "<<              DBG(dbg) << "Result by close range " << res << " from "<<
70                      to<<" "<<x<<" "<<width<<" "<<norm<<"\n";                      to<<" "<<x<<" "<<width<<" "<<norm<<"\n";

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

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