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

Method rem

src/math/p5.Vector.js:651–669  ·  view source on GitHub ↗

* @param {p5.Vector | Number[]} value divisor vector. * @chainable

(args)

Source from the content-addressed store, hash-verified

649 * @chainable
650 */
651 rem(args) {
652 const minDimension = prioritizeSmallerDimension(this.dimensions, args);
653
654 shrinkToDimension(this.values, minDimension);
655
656 if(Array.isArray(args)){
657 for (let i = 0; i < this.values.length; i++) {
658 if (args[i] > 0) {
659 this.values[i] = this.values[i] % args[i];
660 }
661 }
662 } else if(args > 0) {
663 for (let i = 0; i < this.values.length; i++) {
664 this.values[i] = this.values[i] % args;
665 }
666 }
667
668 return this;
669 }
670
671 /**
672 * Subtracts from a vector's components.

Callers 1

p5.Vector.jsFile · 0.80

Calls 3

shrinkToDimensionFunction · 0.85
copyMethod · 0.45

Tested by

no test coverage detected