Help with optimizing formula for LCD object

Anthony Prechtl's icon

Hello, I am making a rotating hexagonal lattice, and it's working, but it uses a LOT of CPU whenever it is rotated or zoomed in/out.

In the attached zip file, there is a maxpat file and 2 text files. They all need to be in the same folder. The text files simply contain the "base" coordinates for 361 hexagons. When you open the maxpat file, just go into presentation mode of the main patch and mess with the controls.

On my computer I'm getting spikes of about 40% whenever one of the controls are moved. When I disconnect the LCD object and hook up the formula to a dead end, and then move the controls, the CPU spikes at around 36%. Not much of a difference, really.

The formula used to rotate the lattice is just a standard image rotation formula... What I don't understand is why there is such a big CPU hit (and the frame rate decreases) whenever it is rotated. I haven't tried rotating a .pict file with jit.rota because I need a vector lattice. But if you rotate an image in another program (e.g. Photoshop), there is only a very small CPU spike, and that has to rotate many thousands of pixels!

Any suggestions?

Thanks,
Anthony