@@ -83,7 +83,7 @@ export class Matrix extends MatrixInterface {
8383 * const matrix2 = new p5.Matrix([4, 5, 6]);
8484 * matrix1.add(matrix2); // matrix1 is now [5, 7, 9]
8585 *
86- *
86+ * // p5.js script example
8787 * <div class="norender"><code>
8888 * function setup() {
8989 *
@@ -148,7 +148,7 @@ export class Matrix extends MatrixInterface {
148148 * // Assuming matrix is an instance of Matrix with initial values [1, 2, 3, 4] matrix.setElement(2, 99);
149149 * // Now the matrix values are [1, 2, 99, 4]
150150 *
151- *
151+ * // p5.js script example
152152 * <div class="norender"><code>
153153 * function setup() {
154154 *
@@ -182,7 +182,7 @@ export class Matrix extends MatrixInterface {
182182 * matrix.reset(); // Reset to identity matrix
183183 * console.log(matrix.matrix); // Output: Identity matrix
184184 *
185- *
185+ * // p5.js script example
186186 * <div class="norender"><code>
187187 * function setup() {
188188 *
@@ -234,7 +234,7 @@ export class Matrix extends MatrixInterface {
234234 * matrix.set(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
235235 * console.log(matrix.matrix); // Output: [1, 2, 3, ..., 16]
236236 *
237- *
237+ * // p5.js script example
238238 * <div class="norender"><code>
239239 * function setup() {
240240 *
@@ -277,7 +277,7 @@ export class Matrix extends MatrixInterface {
277277 * same values as the original matrix.
278278 *
279279 * @example
280- *
280+ * // p5.js script example
281281 * <div class="norender"><code>
282282 * function setup() {
283283 *
@@ -309,7 +309,7 @@ export class Matrix extends MatrixInterface {
309309 * @return {p5.Matrix } The result matrix.
310310 *
311311 * @example
312- *
312+ * // p5.js script example
313313 * <div class="norender"><code>
314314 * function setup() {
315315 *
@@ -337,7 +337,7 @@ export class Matrix extends MatrixInterface {
337337 * @returns {Matrix } A new matrix instance that is a copy of the current matrix.
338338 *
339339 * @example
340- *
340+ * // p5.js script example
341341 * <div class="norender"><code>
342342 * function setup() {
343343 *
@@ -384,7 +384,7 @@ export class Matrix extends MatrixInterface {
384384 * const matrix = new p5.Matrix([1, 2, 3, 4, 5, 6, 7, 8, 9]);
385385 * const diagonal = matrix.diagonal(); // [1, 5, 9]
386386 *
387- *
387+ * // p5.js script example
388388 * <div class="norender"><code>
389389 * function setup() {
390390 *
@@ -419,7 +419,7 @@ export class Matrix extends MatrixInterface {
419419 * const matrix = new p5.Matrix([1, 2, 3, 4, 5, 6, 7, 8, 9]);
420420 * const rowVector = matrix.row(1); // Returns a vector [2, 5, 8]
421421 *
422- *
422+ * // p5.js script example
423423 * <div class="norender"><code>
424424 * function setup() {
425425 *
@@ -454,7 +454,7 @@ export class Matrix extends MatrixInterface {
454454 * const matrix = new p5.Matrix([1, 2, 3, 4, 5, 6, 7, 8, 9]);
455455 * const columnVector = matrix.column(1); // Returns a vector [4, 5, 6]
456456 *
457- *
457+ * // p5.js script example
458458 * <div class="norender"><code>
459459 * function setup() {
460460 *
@@ -497,7 +497,7 @@ export class Matrix extends MatrixInterface {
497497 * matrix4x4.transpose();
498498 * console.log(matrix4x4.matrix); // Output: Transposed 4x4 identity matrix
499499 *
500- *
500+ * // p5.js script example
501501 * <div class="norender"><code>
502502 * function setup() {
503503 *
@@ -548,7 +548,7 @@ export class Matrix extends MatrixInterface {
548548 * matrix4x4_1.mult(matrix4x4_2);
549549 * console.log(matrix4x4_1.matrix); // Output: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 2, 3, 1]
550550 *
551- *
551+ * // p5.js script example
552552 * <div class="norender"><code>
553553 * function setup() {
554554 *
@@ -601,7 +601,7 @@ export class Matrix extends MatrixInterface {
601601 * const result = matrix.multiplyVec(vector);
602602 * console.log(result.toString()); // Output: Transformed vector
603603 *
604- *
604+ * // p5.js script example
605605 * <div class="norender"><code>
606606 * function setup() {
607607 *
@@ -650,7 +650,7 @@ export class Matrix extends MatrixInterface {
650650 * const invertedMatrix4x4 = matrix4x4.invert();
651651 * console.log(invertedMatrix4x4.matrix); // Output: Inverted 4x4 matrix
652652 *
653- *
653+ * // p5.js script example
654654 * <div class="norender"><code>
655655 * function setup() {
656656 *
@@ -699,7 +699,7 @@ export class Matrix extends MatrixInterface {
699699 * console.log("Original 4x4 Matrix:", matrix4x4.matrix);
700700 * console.log("Extracted 3x3 Submatrix:", subMatrix3x3.matrix);
701701 *
702- *
702+ * // p5.js script example
703703 * <div class="norender"><code>
704704 * function setup() {
705705 *
@@ -751,7 +751,7 @@ export class Matrix extends MatrixInterface {
751751 * mat3.inverseTranspose4x4(mat4);
752752 * console.log("Converted 3×3 Matrix:", mat3.matrix);
753753 *
754- *
754+ * // p5.js script example
755755 * <div class="norender"><code>
756756 * function setup() {
757757 *
@@ -933,7 +933,7 @@ export class Matrix extends MatrixInterface {
933933 * matrix.scale(scaleArray);
934934 * console.log(matrix.matrix);
935935 *
936- *
936+ * // p5.js script example
937937 * <div class="norender"><code>
938938 * function setup() {
939939 *
@@ -1011,24 +1011,6 @@ export class Matrix extends MatrixInterface {
10111011 * - [0, 0, 1] rotates around the z-axis. *
10121012 * @chainable
10131013 * inspired by Toji's gl-matrix lib, mat4 rotation
1014- *
1015- * @example
1016- *
1017- * <div class="norender"><code>
1018- * function setup() {
1019- * const matrix = new p5.Matrix(4); // Create a 4x4 identity matrix
1020- * console.log("Original Matrix:", matrix.matrix);
1021- *
1022- * // Rotate the matrix 90 degrees (PI/2 radians) around the Y-axis
1023- * matrix.rotate4x4(Math.PI / 2, [0, 1, 0]);
1024- * console.log("After Rotation (Y-axis, 90 degrees):", matrix.matrix);
1025- *
1026- * // Rotate the matrix 45 degrees (PI/4 radians) around a custom axis
1027- * const axis = new p5.Vector(1, 1, 0); // Custom axis
1028- * matrix.rotate4x4(Math.PI / 4, axis);
1029- * console.log("After Rotation (Custom Axis, 45 degrees):", matrix.matrix);
1030- * }
1031- * </code></div>
10321014 */
10331015 rotate4x4 ( a , x , y , z ) {
10341016 if ( x instanceof Vector ) {
@@ -1115,7 +1097,7 @@ export class Matrix extends MatrixInterface {
11151097 * matrix.translate([5, 15]); // Translate by 5 units along x and 15 along y
11161098 * console.log(matrix.matrix);
11171099 *
1118- *
1100+ * // p5.js script example
11191101 * <div class="norender"><code>
11201102 * function setup() {
11211103 *
@@ -1165,7 +1147,7 @@ export class Matrix extends MatrixInterface {
11651147 * matrix.rotateX(Math.PI / 4); // Rotate 45 degrees around the X-axis
11661148 * console.log(matrix.matrix);
11671149 *
1168- *
1150+ * // p5.js script example
11691151 * <div class="norender"><code>
11701152 * function setup() {
11711153 *
@@ -1202,7 +1184,7 @@ export class Matrix extends MatrixInterface {
12021184 * matrix.rotateY(Math.PI / 4); // Rotate 45 degrees around the Y-axis
12031185 * console.log(matrix.matrix);
12041186 *
1205- *
1187+ * // p5.js script example
12061188 * <div class="norender"><code>
12071189 * function setup() {
12081190 *
@@ -1241,7 +1223,7 @@ export class Matrix extends MatrixInterface {
12411223 * matrix.rotateZ(Math.PI / 4); // Rotate 45 degrees around the Z-axis
12421224 * console.log(matrix.matrix);
12431225 *
1244- *
1226+ * // p5.js script example
12451227 * <div class="norender"><code>
12461228 * function setup() {
12471229 *
@@ -1282,7 +1264,7 @@ export class Matrix extends MatrixInterface {
12821264 * matrix.perspective(Math.PI / 4, 1.5, 0.1, 100); // Set perspective projection
12831265 * console.log(matrix.matrix);
12841266 *
1285- *
1267+ * // p5.js script example
12861268 * <div class="norender"><code>
12871269 * function setup() {
12881270 *
@@ -1398,7 +1380,7 @@ export class Matrix extends MatrixInterface {
13981380 * const result = matrix.multiplyVec4(1, 2, 3, 1); // Transform the vector [1, 2, 3, 1]
13991381 * console.log(result); // Output: [1, 2, 3, 1] (unchanged for identity matrix)
14001382 *
1401- *
1383+ * // p5.js script example
14021384 * <div class="norender"><code>
14031385 * function setup() {
14041386 *
@@ -1454,7 +1436,7 @@ export class Matrix extends MatrixInterface {
14541436 * const transformedPoint = matrix.multiplyPoint(point);
14551437 * console.log(transformedPoint.toString()); // Output: [1, 2, 3] (unchanged for identity matrix)
14561438 *
1457- *
1439+ * // p5.js script example
14581440 * <div class="norender"><code>
14591441 * function setup() {
14601442 *
@@ -1507,7 +1489,7 @@ export class Matrix extends MatrixInterface {
15071489 * const transformedPoint = matrix.multiplyAndNormalizePoint(point);
15081490 * console.log(transformedPoint.toString()); // Output: [1, 2, 3] (unchanged for identity matrix)
15091491 *
1510- *
1492+ * // p5.js script example
15111493 * <div class="norender"><code>
15121494 * function setup() {
15131495 *
@@ -1562,7 +1544,7 @@ export class Matrix extends MatrixInterface {
15621544 * const transformedDirection = matrix.multiplyDirection(direction);
15631545 * console.log(transformedDirection.toString()); // Output: [1, 0, 0] (unchanged for identity matrix)
15641546 *
1565- *
1547+ * // p5.js script example
15661548 * <div class="norender"><code>
15671549 * function setup() {
15681550 *
@@ -1615,7 +1597,7 @@ export class Matrix extends MatrixInterface {
16151597 * const result = matrix.multiplyVec3(vector);
16161598 * console.log(result.toString()); // Output: Transformed vector
16171599 *
1618- *
1600+ * // p5.js script example
16191601 * <div class="norender"><code>
16201602 * function setup() {
16211603 *
0 commit comments