What is the best way to store coordinates
|
12-16-2013, 06:45 AM
Post: #2
|
|||
|
|||
RE: What is the best way to store coordinates
Hello,
points are 2 real numbers (assuming 3D)... This gives you a couple of possibility for storage: - 2 numbers - in a list - in a matrice (as a single line, as a single column, as 2 elements side by side with other elements) - 1 complex number - in a list - in a matrice (in a vector or a real matrice?) - other solutions are possible (such as a string), but are unlikely to be the best solution... The storage that you will use will depend on what you are trying to do whith the object and which build in functions are available to handle them. Are the points that you are going to store part of a point grid? if yes, then a matrix might be a good solution. If on the onctrary, you have an arbitrary number of points, a list might be more adapted. A matrice tend to be faster than a list and takes less memory (because 1 matrice is just 1 block of memory with all the data in it, 8 bytes per numbers). while a list is an array of pointers on objects (one per number), yeilding much more memory used and memory allocations (which are slow)... remember, list processing is your friend! for example, assuming that you are storing points as complex numbers in a list. a rotation by 90° is just a multiplicaiton of the list of complex nubmers by (0, 1) as in: local l:= { My List of points }; l:= l*(0,1); // rotates all points by 90° Cyrille |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
What is the best way to store coordinates - cdodds - 12-16-2013, 05:57 AM
RE: What is the best way to store coordinates - cyrille de brébisson - 12-16-2013 06:45 AM
RE: What is the best way to store coordinates - ArielPalazzesi - 12-16-2013, 10:54 AM
RE: What is the best way to store coordinates - Tim Wessman - 12-16-2013, 03:04 PM
RE: What is the best way to store coordinates - cyrille de brébisson - 12-17-2013, 09:41 AM
RE: What is the best way to store coordinates - Tim Wessman - 12-17-2013, 03:30 PM
|
User(s) browsing this thread: 1 Guest(s)