MCPcopy
hub / github.com/processing/p5.js / split

Method split

src/webgl/text.js:367–378  ·  view source on GitHub ↗

* @param {Number} t the value (0-1) at which to split * @return {Cubic} the second part of the curve * * splits the cubic into two parts at a point 't' along the curve. * this cubic keeps its start point and its end point becomes the * point at 't'. the '

(t)

Source from the content-addressed store, hash-verified

365 * point at 't'. the 'end half is returned.
366 */
367 split(t) {
368 const m1 = Vector.lerp(this.p0, this.c0, t);
369 const m2 = Vector.lerp(this.c0, this.c1, t);
370 const mm1 = Vector.lerp(m1, m2, t);
371
372 this.c1 = Vector.lerp(this.c1, this.p1, t);
373 this.c0 = Vector.lerp(m2, this.c1, t);
374 const pt = Vector.lerp(mm1, this.c0, t);
375 const part1 = new Cubic(this.p0, m1, mm1, pt);
376 this.p0 = pt;
377 return part1;
378 }
379
380 /**
381 * @return {Cubic[]} the non-inflecting pieces of this cubic

Callers 15

splitInflectionsMethod · 0.95
formatJSDocCommentFunction · 0.80
p5.sound.min.jsFile · 0.80
mFunction · 0.80
p5.sound.jsFile · 0.80
_checkFileFormatsFunction · 0.80
CustomErrorFunction · 0.80
passthroughFunction · 0.80
buzz.jsFile · 0.80
getExtFunction · 0.80
buzz.jsFile · 0.80
getExtFunction · 0.80

Calls 1

lerpMethod · 0.45

Tested by

no test coverage detected