Hello. I want to save drawn constructs, if they are too big to recalculate every tick. I don’t know exactly how it works, but I think it works with PMatrix. My Idea was:
ConstructXY x;
void setup(){
x = new ConstructXY()
}
void draw(){
background(255);
x.drawConstruct();
}
class ConstructXY{
PMatrix2D construct1= null;
ConstructXY() {
pushMatrix();
fill(0);
strokeWeight(2);
ellipse(100, 100, 40, 40);
rect(200, 200, 60, 10);
...
construct1 = getMatrix(construct1);
//popMatrix();
}
public void drawConstruct(){
// I want something that adds a matrix to another matrix
setMatrix(construct1);
}
}
Please format your code using the </> button in the message editor on the forum.
Can you be more precise about what kind of structure you need to save (do you have some visuals)? And also are you using a library, because I can’t see any PMatrix2D in the reference.
For example:
When I draw large transitions, it takes too much time to recalculate them using the Rect / Ellipse function.
It is easier to save the constructed element at the pixel level than to save the ellipse coordinates and calculate the object.
-> When I make a ellipse-transition I call the ellipse () method very often and when I calculate every pixel of the ellipse (or edge of the ellipse) every tick n times, it takes too long
Yes, PMatrix2D is a stack frame object for pushMatrix() and popMatrix(). Although you can get and set them directly, most users only interact with them by modifying the current PMatrix using things like translate() rotate() scale() – some users further learn to push and pop them – but few directly manipulate them (there isn’t a reference page).