Skip to content

Commit 668934c

Browse files
committed
p5.Matrix documentaion update
1 parent 32b8a2f commit 668934c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/math/p5.Matrix.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,32 +73,32 @@ function matrix(p5, fn) {
7373
*
7474
* // Create a 4x4 identity matrix
7575
* 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]
7777
*
7878
* // Add two matrices
7979
* const matrix1 = new p5.Matrix([1, 2, 3, 4, 5, 6, 7, 8, 9]);
8080
* const matrix2 = new p5.Matrix([9, 8, 7, 6, 5, 4, 3, 2, 1]);
8181
* 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]
8383
*
8484
* // Reset the matrix to an identity matrix
8585
* 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]
8787
*
8888
* // Apply a scaling transformation
8989
* 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]
9191
*
9292
* // Apply a rotation around the X-axis
9393
* 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]
9595
*
9696
* // Apply a perspective transformation
9797
* 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]
9999
*
100100
* // Multiply a vector by the matrix
101-
* const vector = new Vector(1, 2, 3);
101+
* const vector = new p5.Vector(1, 2, 3);
102102
* const transformedVector = matrix.multiplyPoint(vector);
103103
* console.log("Transformed Vector:", transformedVector.toString());
104104
* }

0 commit comments

Comments
 (0)