@@ -73,32 +73,32 @@ function matrix(p5, fn) {
73
73
*
74
74
* // Create a 4x4 identity matrix
75
75
* const matrix = new p5.Matrix(4);
76
- * console.log("Original p5.Matrix:", matrix.matrix);
76
+ * console.log("Original p5.Matrix:", matrix.matrix.toString()); // Output: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
77
77
*
78
78
* // Add two matrices
79
79
* const matrix1 = new p5.Matrix([1, 2, 3, 4, 5, 6, 7, 8, 9]);
80
80
* const matrix2 = new p5.Matrix([9, 8, 7, 6, 5, 4, 3, 2, 1]);
81
81
* matrix1.add(matrix2);
82
- * console.log("After Addition:", matrix1.matrix); // Output: [10, 10, 10, 10, 10, 10, 10, 10, 10]
82
+ * console.log("After Addition:", matrix1.matrix.toString() ); // Output: [10, 10, 10, 10, 10, 10, 10, 10, 10]
83
83
*
84
84
* // Reset the matrix to an identity matrix
85
85
* matrix.reset();
86
- * console.log("Reset p5.Matrix:", matrix.matrix);
86
+ * console.log("Reset p5.Matrix:", matrix.matrix.toString()); // [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
87
87
*
88
88
* // Apply a scaling transformation
89
89
* matrix.scale(2, 2, 2);
90
- * console.log("Scaled p5.Matrix:", matrix.matrix);
90
+ * console.log("Scaled p5.Matrix:", matrix.matrix.toString()); // [2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1]
91
91
*
92
92
* // Apply a rotation around the X-axis
93
93
* matrix.rotate4x4(Math.PI / 4, 1, 0, 0);
94
- * console.log("Rotated p5.Matrix (X-axis):", matrix.matrix);
94
+ * console.log("Rotated p5.Matrix (X-axis):", matrix.matrix.toString()); // [2, 0, 0, 0, 0, 1.4142135381698608, 1.4142135381698608, 0, 0, -1.4142135381698608, 1.4142135381698608, 0, 0, 0, 0, 1]
95
95
*
96
96
* // Apply a perspective transformation
97
97
* matrix.perspective(Math.PI / 4, 1, 0.1, 100);
98
- * console.log("Perspective p5.Matrix:", matrix.matrix);
98
+ * console.log("Perspective p5.Matrix:", matrix.matrix.toString());// [2.4142136573791504, 0, 0, 0, 0, 2.4142136573791504, 0, 0, 0, 0, -1.0020020008087158, -1, 0, 0, -0.20020020008087158, 0]
99
99
*
100
100
* // Multiply a vector by the matrix
101
- * const vector = new Vector(1, 2, 3);
101
+ * const vector = new p5. Vector(1, 2, 3);
102
102
* const transformedVector = matrix.multiplyPoint(vector);
103
103
* console.log("Transformed Vector:", transformedVector.toString());
104
104
* }
0 commit comments