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; |
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) |
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"; |