We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi there, I have some strange behavior in my code.
void display() {
noStroke();
String note = freqAndNote.fromFreqToNote(frequency);
freqAndColour.noteToColour(note);
ellipse(loc.x, loc.y, 20, 20);
}
freqAndColour.noteToColour(note) returns the colour of the ellipse: fill((noteIndex * (100/12)), 50, octave * (100/6));
However, the size of the ellipses change when I cycle through different types of visualizations in my sketch. If the width and height are specified in pixels and there is a noStroke() before drawing, the size should be consistent. Right?
Any ideas?
Answers
when there is no
scale()
somewhere.....it's hard to say without seeing more code though
My sketch is quite long at this point, I don't really think it would be appropriate to post all of it here. I will add below all the code related to these ellipses. I can tell you that I don't use scale() anywhere though.
The ellipses are controlled using vector math, using the library toxiclibs, toxi.geom.*; Here is the code related to these ellipses:
And inside of draw() we have:
And outside of draw to create the items of the list:
"My sketch is quite long at this point, I don't really think it would be appropriate to post all of it here."
WHAT CAN WE DO TO CRUSH THIS SILLY NOTION?!?
It's should be sort of inappropriate to NOT post all your code.
Hi, Well I'm sorry about that. I guess I'm still new here. I'm not at home right now to post all of my work. However, what I asked earlier: if the width and height are specified in pixels and there is a noStroke() before drawing, the size should be consistent. Right?
Actually, if your sketch is too big, it's indeed not feasible to post it fully in this forum.
However, we do need to see both setup() & draw().
And most importantly, we need to see where any fields used by the posted code were declared & initialized!
Here's more code:
Some auxiliary classes:
I would really appreciated if someone would answer my question: if the width and height are specified in pixels and there is a noStroke() before drawing, the size should be consistent. Right?
Anything? :\
noStroke() just means to not draw an outline around your ellipses.
Also, no. Ellipses with the same width and height can appear different sizes, based on the scale of the coordinate system used to draw then. Example:
I don't use the function scale() in my code though :\
But your sketch is 3D, right?
Right, I use a 3D engine, but I don't use the Z coordinate, everything should be on the same plane. I thought it was necessary to use P3D for the vector math I'm doing. The only thing I can think of is I use push and popMatrix to do translate(width/2,height/2);
Could you run your sketch and take an image of it? I can't run it, so trying to picture where the ellipses of different sizes are is sort of hard. Or post a simplified example? Or are your ellipses the same size? If so, no problem...
Hi! I uploaded a short video with whats happening, about 15 secs long. So I start with the mode I'm trying to fix, then I switch to something else, and when I go back the size has changed. https://vid.me/7Bwt
Ignore the music, as I need something to be playing because the sketch samples the audio and produces the ellipses from the samples.
You'd think that something from the other modes was interfering, but the ellipses are drawn specifying pixels, the only thing I can think of is the translate, but that shouldn't change the size, just where they appear! I can't think of anything that makes sense.
I don't see where your code is drawing any ellipses... Can you point out /repost the part that does the actual drawing?
Hi there! In the class Note there is:
then I switch to something else
Ok, what is it?
Can you also try to go to 2D instead of 3D in setup() and in size()
Chrisir