MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / bezlen

Function bezlen

libraries/p5.js:30203–30219  ·  view source on GitHub ↗
(x1, y1, x2, y2, x3, y3, x4, y4, z)

Source from the content-addressed store, hash-verified

30201}
30202
30203function bezlen(x1, y1, x2, y2, x3, y3, x4, y4, z) {
30204 if (z == null) { z = 1; }
30205 z = z > 1 ? 1 : z < 0 ? 0 : z;
30206 var z2 = z / 2,
30207 n = 12, Tvalues = [-0.1252, 0.1252, -0.3678, 0.3678, -0.5873, 0.5873,
30208 -0.7699, 0.7699, -0.9041, 0.9041, -0.9816, 0.9816],
30209 sum = 0, Cvalues = [0.2491, 0.2491, 0.2335, 0.2335, 0.2032, 0.2032,
30210 0.1601, 0.1601, 0.1069, 0.1069, 0.0472, 0.0472 ];
30211 for (var i = 0; i < n; i++) {
30212 var ct = z2 * Tvalues[i] + z2,
30213 xbase = base3(ct, x1, x2, x3, x4),
30214 ybase = base3(ct, y1, y2, y3, y4),
30215 comb = xbase * xbase + ybase * ybase;
30216 sum += Cvalues[i] * Math.sqrt(comb);
30217 }
30218 return z2 * sum;
30219}
30220
30221function getTatLen(x1, y1, x2, y2, x3, y3, x4, y4, ll) {
30222 if (ll < 0 || bezlen(x1, y1, x2, y2, x3, y3, x4, y4) < ll) {

Callers 2

getPointAtSegmentLengthFunction · 0.85
getTatLenFunction · 0.85

Calls 1

base3Function · 0.85

Tested by

no test coverage detected