62 |
} |
} |
63 |
|
|
64 |
virtual float nonlinearity(const ZPt &p, float radius) { |
virtual float nonlinearity(const ZPt &p, float radius) { |
65 |
|
radius = fabs(radius); |
66 |
ZPt mp; |
ZPt mp; |
67 |
t.tr(p, mp); |
t.tr(p, mp); |
68 |
float srad = t.tr_radius(p, radius); |
float srad = fabs(t.tr_radius(p, radius)); |
69 |
float snon = super->nonlinearity(mp, srad); |
float snon = super->nonlinearity(mp, srad); |
70 |
// Multiply to take into account shrinking / magnifying. |
// Multiply to take into account shrinking / magnifying. |
71 |
snon *= srad / radius; |
snon *= (srad+0.000001) / (radius+0.00001); |
72 |
float non = t.nonlinearity(p, radius); |
float non = t.nonlinearity(p, radius); |
73 |
return (non > snon ? non : snon); |
return (non > snon ? non : snon); |
74 |
} |
} |
383 |
float wh = 0.5*(w+h); |
float wh = 0.5*(w+h); |
384 |
float dist = hypot((p.x-x)/w, (p.y-y)/h) - radius/wh; |
float dist = hypot((p.x-x)/w, (p.y-y)/h) - radius/wh; |
385 |
if(dist < 0) dist = 0; |
if(dist < 0) dist = 0; |
386 |
|
if(!finite(dist)) return 1; |
387 |
return 1 + 10 / (dist + 1); |
return 1 + 10 / (dist + 1); |
388 |
} |
} |
389 |
}; |
}; |