Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

2d arrays

 
Stephen ODonnell
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a vector which i convert to an array of objects as follows:
Vector vctNumbers = (Vector)vctGraphItems.elementAt(1);
Object objArr[] = vctNumbers.toArray(); //array of objects
I now need to convert this 1-d Object array, to a 2-d float array:
float[][] array = ...
If anyone has done this before or can explain this to me i would be very greatful.
thanks,
Stephen O Donnell
 
Nathanael Ulrick
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming the Objects are actually Floats you would need a nested loop which copies the values one by one.
 
today's feeble attempt to support the empire
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!