* 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)
| 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. |
no test coverage detected