Click to See Complete Forum and Search --> : Importing 2D graph data from a file


fragy153
March 7th, 2005, 07:57 AM
Hi Guys

I have the following problem

I am writting an MFC application to create 2-D graphs. The data for these graphs will be imported from text files. ( x and y coordinates)

Sometimes these files can be really large ( which means millions of points)

I guess I need to load all this data to the memory. And then sample from it what i need to display to the screen.

What is the best best way to store this data to the memory??

Is dynamic memory allocation with malloc and realloc OK?
Or should I use vectors??

Any other ideas??

thanks!

Leo77
March 8th, 2005, 05:05 PM
try kd trees, or grid... they are good for 2d data

fragy153
March 9th, 2005, 04:34 AM
what are these??

I have no idea


anymore hids on that? (links etc)

Leo77
March 9th, 2005, 10:10 AM
Man, try to find something that talks about it (books, links on the internet...).
They are ways to organize 2d data. I would spend a week explaining to you, but basically they divide the whole data in areas (based on the concentration), so you dont need to linear search on the whole thing every time you need your data back...
Its really good for maps (and any other 2d data), and its kind of simple.

see this links
http://www.rolemaker.dk/nonRoleMaker/uni/algogem/kdtree.htm
http://www.informatik.uni-trier.de/~ley/db/access/grid.html
http://www.ems-i.com/wmshelp/Files/File_Formats/2D_Grid_Files.htm

andytim
April 8th, 2005, 02:02 AM
What kind of format is your shape text file?
Andy
------------------------------------------
XD++ MFC Library V9.0 -- http://www.********.net