• Post Reply Bookmark Topic Watch Topic
  • New Topic

How does this array work?  RSS feed

 
David Triple
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having trouble understanding how this works?



then later on in the program it adds this:



I been reading about arrays and indices but i cannot figure out what this means, and what the numbers in the indices represent:
face.addIndice(0);
face.addIndice(3);
face.addIndice(5);

 
Unnar Björnsson
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I been reading about arrays and indices but i cannot figure out what this means, and what the numbers in the indices represent:
face.addIndice(0);
face.addIndice(3);
face.addIndice(5);


The method addIndice() adds one integer number to the end of the vector by calling Vector.addElement(). The Vector method addElement takes an object reference (in this case Integer), so we start off with an empty vector then add '0' to it which increases it's size from 0 to 1 (since it has one element now), then '1' is added the the end of the vector increasing the size to 2, so the vector looks like this [0, 1] after those two steps.
After reading the code I gather that these numbers, stored in the vector are supposed to represent indices of a plane or face (geometry)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!