Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions regarding code in the tutorials (IG.duration and for loop) #20

Open
Higemoto opened this issue Nov 18, 2018 · 0 comments
Open

Comments

@Higemoto
Copy link

Hi,
I'm currently training on IGeo and reached the last tutorial of this page http://igeo.jp/tutorial/36.html (updating Agents using vectors).

I was wondering why do we need a for loop in the following :
import processing.opengl.;
import igeo.
;
void setup(){
size(480, 360, IG.GL);
IG.duration(250);
int num = 40;
float inc = 2PI/num;
for(int i=0; i < num; i++){
new MyAgent(IG.v(40
cos(iinc), 40sin(iinc), 0),
IG.v(5
cos((i+6)*inc), sin((i+6)*inc), 0));
}
}

the IG.duration is setting up how many times the action is done, what is the role of that For Loop and the variable "int num = 40" ?

Does it mean there will be 40 initial instances starting at 40 different positions as the i is implemented in the vectors ?

Thanks in advance,
Gari,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant