I have my coordinates, can I zoom in?

Hi everyone…

I’m using discrete fourier transform to draw epicycles with processing library in Java. It looks like this :

It is basically bunch of circles rotating in harmony to draw something.

I have an ArrayList path which I follow:

``````beginShape();
for (int i = 0; i < path.size(); i++){
vertex(path.get(i).x, path.get(i).y);
}
endShape();
``````

What I want is to slowly zoom into the last element of this path, and see further the smaller circles up to the last one.

I tried translate() and scale() functions with various of combinations but I haven’t made any progress. Could anyone give me an idea how to do it?

Edit: Here is the source code : https://github.com/supernatrium/Epicycles_Java

I‘m not quite sure where you want to zoom in, but you can adapt this to any position you want.

``````scale(2);
translate(-posX -( width / 2.0 / 2.0), -posY - (height / 2.0 / 2.0));
``````

This will scale the sketch by 2* and the second line will set the Location of the origin to be the negative position minus half the width/height divided by the scaling factor.

The effect I want to see is like the center is fixed to the innermost rotating circle and the drawing is moving around. Then I want to zoom in to see smaller circles.

Indeed, that‘s what this Code can be used for if you adapt it.

You‘ll just need to replace the scalingFactor (2) by a value relative to the size of the ellipse (Circle) you want to zoom in to. Same goes for the scalingFactor in the translate method.

And as for the position in the translate method, just use the Center of the target ellipse (Circle).