Finally got the touch pressure calibration working
function pressureSizeCalc(force) {
let minDrawSize = 1;
if (force === 0) return minDrawSize;
let deltaX = this.maxTouchForce - this.minTouchForce;
let deltaY = this.maxDrawSize - minDrawSize;
let slope = deltaY / deltaX;
let intercept = minDrawSize - (slope * this.minTouchForce);
let result = (slope * force) + intercept;
return Math.min(this.maxDrawSize, Math.max(minDrawSize, result));
}
https://www.desmos.com/calculator/immaqerfbssoGraphing Calculator
I had to figure out how to calculate the factors in the slope-intercept equation (had to blow the dust off my math a bit) to figure out which line passes through both the lowest pressure (and thus, lowest stroke width) and the highest touch pressure (coupled with the user-specified maximum stroke width).
Dinner
I had tomato soup :)