Author Topic: array of SimpleVectors  (Read 1250 times)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
array of SimpleVectors
« on: March 06, 2011, 04:23:23 pm »
Why is here error? Length of array is 3, but I can not read or write ...

Code: [Select]
SimpleVector[] positions = new SimpleVector[positionst.countTokens() / 3];
int positionsnumb = 0;
float x = Float.parseFloat(positionst.nextToken());
float y = Float.parseFloat(positionst.nextToken());
float z = Float.parseFloat(positionst.nextToken());
positions[positionsnumb].set(x, y, z);
« Last Edit: March 06, 2011, 05:01:48 pm by Thomas. »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: array of SimpleVectors
« Reply #1 on: March 06, 2011, 11:12:51 pm »
Nobody fills that array with actual instances of SimpleVector...

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: array of SimpleVectors
« Reply #2 on: March 07, 2011, 04:14:58 am »
Yeh, try changing that last line to:
Code: [Select]
positions[positionsnumb] = new SimpleVector(x, y, z);

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: array of SimpleVectors
« Reply #3 on: March 07, 2011, 09:55:58 am »
Thanks :)