Sergei Khashin, Gleb Shkryabin


Points on the sphere, farthest from each other as far as possible


main.cpp &nbps;&nbps;- sources in C++,
sphere.exe - exe-file (win-32, console).

The only place in the program, which is able to depend on the compiler is a random number generator and its initialization in function setRandom():

	srand( (unsigned)time( NULL ) );       // initialization
    ...
	v[j] = (2.0*rand())/(RAND_MAX + 1)-1;  // usage

Usage:

sphere.exe dim N output.file
where
dim - the dimension of the space
N    - the number of points
output.file - output file name.

For example, after:

sphere.exe 3 7 t_03_007.txt
we obtain file t_03_007.txt:
 -0.886931437216585  0.430451726983704  0.167522942947134
 -0.281206480235253  0.301874829287633 -0.910930569756149
 -0.155888595626764 -0.172912942837985  0.972522421311007
  0.867700100437096  0.230591710299671 -0.440368026589722
  0.566825684220030 -0.803680903286935  0.181123298888883
  0.247124422731369  0.869636059430273  0.427390505075013
 -0.643231982116783 -0.758826372079828 -0.102152602601601
containing 7 points on the sphere in 3-dimensional space, with the distance between each pair of them not less then 1.243582213282345.

free counters