r/processing • • Jul 08 '24

Help request Help Needed: Ellipse Size Interference Issue in Processing

Hi everyone,

I’m a musician with no prior experience in Java or graphic-generating languages. For a project, I decided to learn Processing to create visualizations. My code has grown significantly, spanning multiple tabs, and I've encountered an issue with two ellipses that should remain centered and fixed in size but don’t.

Problem Summary:

Issue: The sizes of two centered ellipses change unexpectedly.

Observation: The size changes occur whenever another tab that uses ellipses is active.

Debugging Steps:

  • Verified variable names are unique.
  • Confirmed OSC messages provide correct data.
  • Debug prints show expected values, but the displayed graphics do not match.

Detailed Findings:

  • When ellipses from other tabs are processed and drawn, they affect the size of the central ellipses.
  • If only the central ellipses are drawn, their sizes remain consistent, regardless of data changes for other ellipses.

Anyone has any idea of what else I could try? I have been stuck on this for days, and I am starting to suspect that there might be a deeper issue within Processing or my implementation that causes these conflicts. I am dealing with many other types of objects and shapes and this seems to only happen with the ellipse.

I’d appreciate any insights or suggestions you might have.See relevant code on https://github.com/betodaviola/byon_test
I am very far on this project which is bringing me joy but is also massive and I am starting to be afraid that I was out of my depth.

Edit 1 and 2: fix font size and a draft of this I forgot to delete before posting.

Edit 3: forgot to add debugging steps.

Edit 4: to clarify: the ellipses drawn in the eclipse should not change in size. videos of what is going on can be seen below. Interesting enough, if I add a grid of squares to debug, it fixes the bad behavior when the Ripples are activated, but not when the walkers are activated

Video without the grid: https://youtu.be/HHUG1alDo4Q

Video with the grid: https://youtu.be/Rhnkvlofx3Y

Final edit: fixed by u/topinanbour-rex comment:

I needed to encapsulate all of my display() functions with push() and pop() to avoid interference, although it seemed to affect performance a little bit but that might be my not so great computer and I will keep playing around with it. Thank you to everyone that helped.

3 Upvotes

25 comments sorted by

View all comments

Show parent comment

2

u/betodaviola Jul 08 '24

The two ellipses drawn on the eclipse tab

When they grow, they grow together keeping the proportion. The way which they change size are affected by the ripples and the walkers

2

u/LuckyDots- Jul 08 '24

so the ellipses on the eclipse tab need to stay centered while growing proportionally?

2

u/betodaviola Jul 08 '24

No, they should not grow at all, yet they do when the ripples and walkers are on screen.

2

u/betodaviola Jul 08 '24

It's like the variables clthat change the size of the ripples and walkers are affecting it. It's much more pronounced in the ripples since it changes constantly, and make the eclipse continuously grow with them. As for them the walkers, it doesn't change continuously but when I change the walker little ellipses size, it makes the eclipse hunt in size as well.

2

u/betodaviola Jul 08 '24

The eclipse ellipses sizes are only dependent on the width and height, so I have no idea how this would happen

2

u/LuckyDots- Jul 08 '24 edited Jul 08 '24

Not possible to recreate for me as I think this is hooked up to some kind of controller which is changing the variables, maybe try breaking it down into smaller chunks and get each bit working on its own then put it back together again.

Might be that you're setting the sizes in the display() void, this is being called continuously in draw so will be resetting the size over and over, You can set this in the Eclipse() {} constructor instead or the class constructor.

Maybe call update separately from display too in draw so

draw() {
myEclipse.display();
myEclipse.update();
}

2

u/LuckyDots- Jul 08 '24

ecZ and ecY are being set by your moon[0], moon[1] values but they're also not declared anywhere.

Your ecR angle is being reset continuously alsom, set that once in the constructor then increment it.

It could be because of

    ecX = moon[0];
    ecY = moon[1];
    ecR = moon[2];

as this is being called repeatedly, so its trying to set the position using the translate(width/2, height/2) but then is switching back and forth between the position of ecX = moon[0]; and ecY = moon[1];

That would be my best guess

2

u/betodaviola Jul 09 '24

I applied changes trying fixing everything you mentioned and the undesired effect was still there. I discovered something interesting though: if i put a grid of squares to check the changes in size better bu looking at the patch, it behaves the way I want it to for the ripples, but it does not fix the walkers. It makes even less sense to me now! I am currently updating the files in the github and I managed to record a video to show what is going on. It will take a few minutes for me to link it here as a reply to this comment, but if you see, the red growing ellipses are my "ripple", and you will see the eclipse growing when they are around. The fast moving blue objects are the walkers. TO see the debugging grid, it needs to be uncommitted in the setup() and draw() of the new code

2

u/betodaviola Jul 09 '24

Video without the grid: https://youtu.be/HHUG1alDo4Q

Video with the grid: https://youtu.be/Rhnkvlofx3Y

2

u/LuckyDots- Jul 09 '24 edited Jul 09 '24

EDIT - Just seen you've fixed it! :D

2

u/betodaviola Jul 09 '24

Thank you for your help!

2

u/LuckyDots- Jul 09 '24

You're welcome! I didn't realise push and pop encapsulated styles so I learned something new myself! I wondered if there was a need to use pushMatrix / popMatrix but I could only see one translate which was already encapsulated!

→ More replies