Can you provide more info about what information you need an maybe provide some details or context where you are going to use it?
I can imagine since you apply a set of translations and rotations in draw, you can keep track of all these transformations. However, if you are using peasycam, then you have to use some other ways.... It is easier if you post some code of what you have so far or showing your initial approach.
The project I'm working on is a bit too big to post here.
I've got it working now but I have to basically alter scale and push and pop the matrix through a different class so it can always track the current scale as it is set.
I'm dynamically sizing text based on how scaled up it is to allow scaled detail, (SHAPE mode is too low performance). It would be nice to not have to create an extra layer
Are you familiar with screenX() (...Y, Z) and modelX() (...Y, Z) ? These will allow you to compute equivalency points inside and outside a set of transforms and map those transforms to the screen.
You can also track translations / scales etc. by yourself using external variables.
In the more general case, while getMatrix() and setMatrix() are not documented in the public reference, you can find them in the Processing Javadoc for PApplet, here:
Note that if you need to do further computation, from the PMatrix2D documentation: float[] PMatrix2D.get(float[] target) "copies the matrix contents into a 6 entry float array."
However, functions/methods that are not documented in the reference might stop working at any time -- so if you can accomplish what you want with modelX() etc. then you should consider doing that instead -- it is also more portable across Processing modes.
...finally, some old discussions of problems accessing the transformation matrix:
Answers
Can you provide more info about what information you need an maybe provide some details or context where you are going to use it?
I can imagine since you apply a set of translations and rotations in draw, you can keep track of all these transformations. However, if you are using peasycam, then you have to use some other ways.... It is easier if you post some code of what you have so far or showing your initial approach.
Kf
The project I'm working on is a bit too big to post here.
I've got it working now but I have to basically alter scale and push and pop the matrix through a different class so it can always track the current scale as it is set.
I'm dynamically sizing text based on how scaled up it is to allow scaled detail, (SHAPE mode is too low performance). It would be nice to not have to create an extra layer
@San --
You said other than printing all the values to the console, which would be https://processing.org/reference/printMatrix_.html
Are you familiar with
screenX()
(...Y, Z) andmodelX()
(...Y, Z) ? These will allow you to compute equivalency points inside and outside a set of transforms and map those transforms to the screen.You can also track translations / scales etc. by yourself using external variables.
In the more general case, while
getMatrix()
andsetMatrix()
are not documented in the public reference, you can find them in the Processing Javadoc for PApplet, here:You can use these to get a PMatrix2D or PMatrix3D -- this still works (as of Processing 3.2.x):
...or, for an example where the current matrix tranform within a pushMatrix is saved before it is popped, and then used later:
Note that if you need to do further computation, from the PMatrix2D documentation:
float[] PMatrix2D.get(float[] target)
"copies the matrix contents into a 6 entry float array."However, functions/methods that are not documented in the reference might stop working at any time -- so if you can accomplish what you want with
modelX()
etc. then you should consider doing that instead -- it is also more portable across Processing modes....finally, some old discussions of problems accessing the transformation matrix:
Thanks!