We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I have a text file having data in the form of:
x & y co-ordinates:
880.4895 373.5595
797.7594 551.85364
582.87476 590.6258
in each line, i have to store these 3 lines in a arraylist of pvector each having x & y co-ordinates arraylist of size 3.
Can you please give me a sample code on how to split and load this data into arralist of pvectors.
Thanks in advance.
Answers
https://forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text
Still very confusing. Are those 3 coordinate pairs in the same line in their file like this?
880.4895 373.5595 797.7594 551.85364 582.87476 590.6258
Do you wanna an ArrayList of PVector[] array?
And each PVector[] stores 3 PVector coords.?
@GoToLoop Yes those are three co-ordinate pairs each pair in one line of the text file. Should be read to an arraylist of pvectors
Each pair in one separate line of text file, should be read into an arraylist of pvectors(x,y) of size same as the number of lines in text file.
@GoToLoop Yes in this case, we have to read each line and store x & y coordinates in arraylist of pvectors, whereas the default z will be zero. Can you please tell me how to read the input text file,
I usually do read it when it is a string of inputs, but in this case each line will have a pair of co-ordinates, Please show how to read and load the arraylist of pvectors
Thank you very much! That answers all.. :) :) really appreciate your help.