Added print() method to PMatrix (Fixes #811) by Sumamasonia · Pull Request #1355 · processing/processing4

Hi @catilac! The reason I updated the implementations is to leverage polymorphism properly as you suggested.

Previously, both classes had their own independent print() logic. By adding public void print() to the PMatrix interface, I added the @OverRide annotation to the existing methods in PMatrix2D and PMatrix3D to explicitly link them.

Also, I refactored the formatting logic into toString(). This makes the code cleaner and allows developers to use System.out.println(matrix) as well as matrix.print(), with both using the same formatting logic. Let me know if you’d prefer me to revert the implementation changes and keep the original print() methods as they were!