PerfectLine
02-01-2011, 08:47 PM
So I stored a vector array of all the distances of vertices from an initial origin point.
vector $averageDist[] = {<<0,0,0>>};
It starts out with only one value in the array [0] being 0,0,0.
As I run my "for loop" I add each vector, which is the x,y,z in distance from the origin point, to the vector array. I end up with one vector for each point I have selected.
So the list ends up being this when I print it.
-0.31992 0.616774 1.341836
-0.319918 0.616774 -1.341836
-0.532443 0.616774 -0
0.060095 -0.035267 1.218362
0.060098 -0.035267 -1.218362
0.532441 -0.616774 1.064887
0.532443 -0.616774 -1.064887
0.363782 -0.616774 -0
Now, how I can get an individual value out of this array?
When I try to do
print $averageDist[3];
I do get the proper result
0.060095 -0.035267 1.218362
But if I want to single out say the Y value only I can't seem to get it.
print $averageDist[3].y;
// Error: Syntax error //
Yet, if I did make a vector that wasn't an array I could get the y in this fashion.
What is the method used for getting a single value out of a vector array?
:D
Thanks.
vector $averageDist[] = {<<0,0,0>>};
It starts out with only one value in the array [0] being 0,0,0.
As I run my "for loop" I add each vector, which is the x,y,z in distance from the origin point, to the vector array. I end up with one vector for each point I have selected.
So the list ends up being this when I print it.
-0.31992 0.616774 1.341836
-0.319918 0.616774 -1.341836
-0.532443 0.616774 -0
0.060095 -0.035267 1.218362
0.060098 -0.035267 -1.218362
0.532441 -0.616774 1.064887
0.532443 -0.616774 -1.064887
0.363782 -0.616774 -0
Now, how I can get an individual value out of this array?
When I try to do
print $averageDist[3];
I do get the proper result
0.060095 -0.035267 1.218362
But if I want to single out say the Y value only I can't seem to get it.
print $averageDist[3].y;
// Error: Syntax error //
Yet, if I did make a vector that wasn't an array I could get the y in this fashion.
What is the method used for getting a single value out of a vector array?
:D
Thanks.
