@@ -83,7 +83,7 @@ export class Matrix extends MatrixInterface {
83
83
* const matrix2 = new p5.Matrix([4, 5, 6]);
84
84
* matrix1.add(matrix2); // matrix1 is now [5, 7, 9]
85
85
*
86
- *
86
+ * // p5.js script example
87
87
* <div class="norender"><code>
88
88
* function setup() {
89
89
*
@@ -148,7 +148,7 @@ export class Matrix extends MatrixInterface {
148
148
* // Assuming matrix is an instance of Matrix with initial values [1, 2, 3, 4] matrix.setElement(2, 99);
149
149
* // Now the matrix values are [1, 2, 99, 4]
150
150
*
151
- *
151
+ * // p5.js script example
152
152
* <div class="norender"><code>
153
153
* function setup() {
154
154
*
@@ -182,7 +182,7 @@ export class Matrix extends MatrixInterface {
182
182
* matrix.reset(); // Reset to identity matrix
183
183
* console.log(matrix.matrix); // Output: Identity matrix
184
184
*
185
- *
185
+ * // p5.js script example
186
186
* <div class="norender"><code>
187
187
* function setup() {
188
188
*
@@ -234,7 +234,7 @@ export class Matrix extends MatrixInterface {
234
234
* matrix.set(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
235
235
* console.log(matrix.matrix); // Output: [1, 2, 3, ..., 16]
236
236
*
237
- *
237
+ * // p5.js script example
238
238
* <div class="norender"><code>
239
239
* function setup() {
240
240
*
@@ -277,7 +277,7 @@ export class Matrix extends MatrixInterface {
277
277
* same values as the original matrix.
278
278
*
279
279
* @example
280
- *
280
+ * // p5.js script example
281
281
* <div class="norender"><code>
282
282
* function setup() {
283
283
*
@@ -309,7 +309,7 @@ export class Matrix extends MatrixInterface {
309
309
* @return {p5.Matrix } The result matrix.
310
310
*
311
311
* @example
312
- *
312
+ * // p5.js script example
313
313
* <div class="norender"><code>
314
314
* function setup() {
315
315
*
@@ -337,7 +337,7 @@ export class Matrix extends MatrixInterface {
337
337
* @returns {Matrix } A new matrix instance that is a copy of the current matrix.
338
338
*
339
339
* @example
340
- *
340
+ * // p5.js script example
341
341
* <div class="norender"><code>
342
342
* function setup() {
343
343
*
@@ -384,7 +384,7 @@ export class Matrix extends MatrixInterface {
384
384
* const matrix = new p5.Matrix([1, 2, 3, 4, 5, 6, 7, 8, 9]);
385
385
* const diagonal = matrix.diagonal(); // [1, 5, 9]
386
386
*
387
- *
387
+ * // p5.js script example
388
388
* <div class="norender"><code>
389
389
* function setup() {
390
390
*
@@ -419,7 +419,7 @@ export class Matrix extends MatrixInterface {
419
419
* const matrix = new p5.Matrix([1, 2, 3, 4, 5, 6, 7, 8, 9]);
420
420
* const rowVector = matrix.row(1); // Returns a vector [2, 5, 8]
421
421
*
422
- *
422
+ * // p5.js script example
423
423
* <div class="norender"><code>
424
424
* function setup() {
425
425
*
@@ -454,7 +454,7 @@ export class Matrix extends MatrixInterface {
454
454
* const matrix = new p5.Matrix([1, 2, 3, 4, 5, 6, 7, 8, 9]);
455
455
* const columnVector = matrix.column(1); // Returns a vector [4, 5, 6]
456
456
*
457
- *
457
+ * // p5.js script example
458
458
* <div class="norender"><code>
459
459
* function setup() {
460
460
*
@@ -497,7 +497,7 @@ export class Matrix extends MatrixInterface {
497
497
* matrix4x4.transpose();
498
498
* console.log(matrix4x4.matrix); // Output: Transposed 4x4 identity matrix
499
499
*
500
- *
500
+ * // p5.js script example
501
501
* <div class="norender"><code>
502
502
* function setup() {
503
503
*
@@ -548,7 +548,7 @@ export class Matrix extends MatrixInterface {
548
548
* matrix4x4_1.mult(matrix4x4_2);
549
549
* console.log(matrix4x4_1.matrix); // Output: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 2, 3, 1]
550
550
*
551
- *
551
+ * // p5.js script example
552
552
* <div class="norender"><code>
553
553
* function setup() {
554
554
*
@@ -601,7 +601,7 @@ export class Matrix extends MatrixInterface {
601
601
* const result = matrix.multiplyVec(vector);
602
602
* console.log(result.toString()); // Output: Transformed vector
603
603
*
604
- *
604
+ * // p5.js script example
605
605
* <div class="norender"><code>
606
606
* function setup() {
607
607
*
@@ -650,7 +650,7 @@ export class Matrix extends MatrixInterface {
650
650
* const invertedMatrix4x4 = matrix4x4.invert();
651
651
* console.log(invertedMatrix4x4.matrix); // Output: Inverted 4x4 matrix
652
652
*
653
- *
653
+ * // p5.js script example
654
654
* <div class="norender"><code>
655
655
* function setup() {
656
656
*
@@ -699,7 +699,7 @@ export class Matrix extends MatrixInterface {
699
699
* console.log("Original 4x4 Matrix:", matrix4x4.matrix);
700
700
* console.log("Extracted 3x3 Submatrix:", subMatrix3x3.matrix);
701
701
*
702
- *
702
+ * // p5.js script example
703
703
* <div class="norender"><code>
704
704
* function setup() {
705
705
*
@@ -751,7 +751,7 @@ export class Matrix extends MatrixInterface {
751
751
* mat3.inverseTranspose4x4(mat4);
752
752
* console.log("Converted 3×3 Matrix:", mat3.matrix);
753
753
*
754
- *
754
+ * // p5.js script example
755
755
* <div class="norender"><code>
756
756
* function setup() {
757
757
*
@@ -933,7 +933,7 @@ export class Matrix extends MatrixInterface {
933
933
* matrix.scale(scaleArray);
934
934
* console.log(matrix.matrix);
935
935
*
936
- *
936
+ * // p5.js script example
937
937
* <div class="norender"><code>
938
938
* function setup() {
939
939
*
@@ -1011,24 +1011,6 @@ export class Matrix extends MatrixInterface {
1011
1011
* - [0, 0, 1] rotates around the z-axis. *
1012
1012
* @chainable
1013
1013
* 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>
1032
1014
*/
1033
1015
rotate4x4 ( a , x , y , z ) {
1034
1016
if ( x instanceof Vector ) {
@@ -1115,7 +1097,7 @@ export class Matrix extends MatrixInterface {
1115
1097
* matrix.translate([5, 15]); // Translate by 5 units along x and 15 along y
1116
1098
* console.log(matrix.matrix);
1117
1099
*
1118
- *
1100
+ * // p5.js script example
1119
1101
* <div class="norender"><code>
1120
1102
* function setup() {
1121
1103
*
@@ -1165,7 +1147,7 @@ export class Matrix extends MatrixInterface {
1165
1147
* matrix.rotateX(Math.PI / 4); // Rotate 45 degrees around the X-axis
1166
1148
* console.log(matrix.matrix);
1167
1149
*
1168
- *
1150
+ * // p5.js script example
1169
1151
* <div class="norender"><code>
1170
1152
* function setup() {
1171
1153
*
@@ -1202,7 +1184,7 @@ export class Matrix extends MatrixInterface {
1202
1184
* matrix.rotateY(Math.PI / 4); // Rotate 45 degrees around the Y-axis
1203
1185
* console.log(matrix.matrix);
1204
1186
*
1205
- *
1187
+ * // p5.js script example
1206
1188
* <div class="norender"><code>
1207
1189
* function setup() {
1208
1190
*
@@ -1241,7 +1223,7 @@ export class Matrix extends MatrixInterface {
1241
1223
* matrix.rotateZ(Math.PI / 4); // Rotate 45 degrees around the Z-axis
1242
1224
* console.log(matrix.matrix);
1243
1225
*
1244
- *
1226
+ * // p5.js script example
1245
1227
* <div class="norender"><code>
1246
1228
* function setup() {
1247
1229
*
@@ -1282,7 +1264,7 @@ export class Matrix extends MatrixInterface {
1282
1264
* matrix.perspective(Math.PI / 4, 1.5, 0.1, 100); // Set perspective projection
1283
1265
* console.log(matrix.matrix);
1284
1266
*
1285
- *
1267
+ * // p5.js script example
1286
1268
* <div class="norender"><code>
1287
1269
* function setup() {
1288
1270
*
@@ -1398,7 +1380,7 @@ export class Matrix extends MatrixInterface {
1398
1380
* const result = matrix.multiplyVec4(1, 2, 3, 1); // Transform the vector [1, 2, 3, 1]
1399
1381
* console.log(result); // Output: [1, 2, 3, 1] (unchanged for identity matrix)
1400
1382
*
1401
- *
1383
+ * // p5.js script example
1402
1384
* <div class="norender"><code>
1403
1385
* function setup() {
1404
1386
*
@@ -1454,7 +1436,7 @@ export class Matrix extends MatrixInterface {
1454
1436
* const transformedPoint = matrix.multiplyPoint(point);
1455
1437
* console.log(transformedPoint.toString()); // Output: [1, 2, 3] (unchanged for identity matrix)
1456
1438
*
1457
- *
1439
+ * // p5.js script example
1458
1440
* <div class="norender"><code>
1459
1441
* function setup() {
1460
1442
*
@@ -1507,7 +1489,7 @@ export class Matrix extends MatrixInterface {
1507
1489
* const transformedPoint = matrix.multiplyAndNormalizePoint(point);
1508
1490
* console.log(transformedPoint.toString()); // Output: [1, 2, 3] (unchanged for identity matrix)
1509
1491
*
1510
- *
1492
+ * // p5.js script example
1511
1493
* <div class="norender"><code>
1512
1494
* function setup() {
1513
1495
*
@@ -1562,7 +1544,7 @@ export class Matrix extends MatrixInterface {
1562
1544
* const transformedDirection = matrix.multiplyDirection(direction);
1563
1545
* console.log(transformedDirection.toString()); // Output: [1, 0, 0] (unchanged for identity matrix)
1564
1546
*
1565
- *
1547
+ * // p5.js script example
1566
1548
* <div class="norender"><code>
1567
1549
* function setup() {
1568
1550
*
@@ -1615,7 +1597,7 @@ export class Matrix extends MatrixInterface {
1615
1597
* const result = matrix.multiplyVec3(vector);
1616
1598
* console.log(result.toString()); // Output: Transformed vector
1617
1599
*
1618
- *
1600
+ * // p5.js script example
1619
1601
* <div class="norender"><code>
1620
1602
* function setup() {
1621
1603
*
0 commit comments