August 13th, 2006, 05:40 PM

Complex Counting
I have a math/algorithmic challenge.
I have a simulation where I have a number of point objects grouped on the surface of a sphere. Now I have a number of these spheres programmticaly determined and each with a different number of points that comprise each sphere.
What I wish to do is count the number of points which make up these objects. I.e. so that for example I count 34 points for sphere A, 40 for sphere B, 45 for sphere 50. They are not exact spheres and the points can be thought of as molecules/atoms making a structure. Therefore I wish to calculate the aggregation number of the spheres.
I store positions of the atoms (points) in 3 D space and I also have a cell indexing architecture  working on a nearest neighbour cell basis. In otherwords given an atom one can determine the atoms in neighbouring cells. One can adjust the finetuning of the cell size.
My question thus relates to how I can count the number of atoms in each sphere given the fact that there is no ordering to the atoms in the spheres. Obviously if the spheres are seperated by some large distance then I can do this without too much trouble. However does anyone have any idea of how best to cope with cases where spheres are seperate but are close together such that the neighbour list of one atom will bring in those on another sphere.
Thanks
September 11th, 2006, 04:41 PM

I have worked on a similar problem, but in 2D space. For my 2D application, I stored the data for each object in a unique data structure, and in it's own coordinate space, so imagine:
 X, Y origins and angle of rotation for each object's coordinate space
 Data Points in each object's coordinate space, for that object's entities
Calculations within each object (distances, areas, etc.) were easily done by considering only their relative coordinate space.
I built a set of subroutines for pointtopoint calculations, such as the distance between a point in one object's coordinate space and a point in the second objects coordinate space.
The program I built to do this was written in Pascal, and ran in DOS on some of the original PC's (~1984), and was a dog, taking 1015 minutes to do run the number of data points we were looking at. On current day units it still runs in DOS, but takes just a second or less to run.
I do not think I have the source code any more, and I surely do not have a Borland Turbo Pascal compiler, but it is my understanding that the program is stilled used by the company it was developed for on a fairly regular basis.
September 12th, 2006, 05:26 AM

Hi Oscar,
you can get old versions of turbo pascal from Borlands museum.
If you want a more modern Pascal compiler then have a look at either FreePascal or bloodsheds DevPascal.
GNU also have a pascal compiler available (I think devpascal uses the gnu compiler but with an ide & other useful tools.
Displeaser
Vi Veri Veniversum Vivus Vici.