Warning: session_start(): open(/var/lib/php/sessions/sess_bbrsm0n4kr9nl4hs57637b8ioi, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// from https://codepen.io/tculda/pen/pogwpOw
/**
* Given some points with color attached, calculate the color for a new point
* @param p The new point position {x: number, y: number}
* @param points The array of given colored points [{x: nember, y: number, c: hexColor}]
* @return hex color string -- The weighted color mix
*/
static Color multiPointGradientPixel(DoublePt p, LPair gradientPoints) {
double[] colorRatios = new [gradientPoints.length];
fillArray(colorRatios, 1);
for i over gradientPoints:
for j over gradientPoints:
if (i != j) {
double d = getProjectionDistance(
gradientPoints.get(i).a,
gradientPoints.get(j).a, p);
colorRatios[i] *= clampZeroToOne(d.y);
}
ret blendMultipleColors(countIteratorAsList(l(gradientPoints),
i -> pair(gradientPoints.get(i).b, colorRatios[i])));
}