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

Method translate

src/math/Matrices/Matrix.js:1101–1114  ·  view source on GitHub ↗

* Translates the current matrix by a given vector. * * This method applies a translation transformation to the current matrix. * Translation moves the matrix by a specified amount along the x, y, and z axes. * The input vector can be a 2D or 3D vector. If the z-component is not provided,

(v)

Source from the content-addressed store, hash-verified

1099 * }
1100 */
1101 translate(v) {
1102 const x = v[0],
1103 y = v[1],
1104 z = v[2] || 0;
1105 this.matrix[12] +=
1106 this.matrix[0] * x + this.matrix[4] * y + this.matrix[8] * z;
1107 this.matrix[13] +=
1108 this.matrix[1] * x + this.matrix[5] * y + this.matrix[9] * z;
1109 this.matrix[14] +=
1110 this.matrix[2] * x + this.matrix[6] * y + this.matrix[10] * z;
1111 this.matrix[15] +=
1112 this.matrix[3] * x + this.matrix[7] * y + this.matrix[11] * z;
1113 return this;
1114 }
1115
1116 /**
1117 * Rotates the matrix around the X-axis by a given angle.

Callers 15

sketch.jsFile · 0.45
makeSketchFunction · 0.45
setupFunction · 0.45
environment.jsFile · 0.45
p5.Framebuffer.jsFile · 0.45
p5.Geometry.jsFile · 0.45
p5.RendererGL.jsFile · 0.45
getColorsFunction · 0.45
getFilteredPixelsFunction · 0.45
testDepthGetsClearedFunction · 0.45
getClippedPixelsFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected