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

Method getValue

src/math/p5.Vector.js:156–165  ·  view source on GitHub ↗

* Retrieves the value at the specified index from the vector. * * This method allows you to get the value of a specific component of the vector * by providing its index. Think of the vector as a list of numbers, where each * number represents a different direction (like x, y, or z). The

(index)

Source from the content-addressed store, hash-verified

154 * get a value from a position that doesn't exist in the vector.
155 */
156 getValue(index) {
157 if (index < this.values.length) {
158 return this.values[index];
159 } else {
160 this._friendlyError(
161 'The index parameter is trying to set a value outside the bounds of the vector',
162 'p5.Vector.setValue'
163 );
164 }
165 }
166
167 /**
168 * Sets the value at the specified index of the vector.

Callers 1

p5.Vector.jsFile · 0.45

Calls 1

_friendlyErrorMethod · 0.95

Tested by

no test coverage detected